Quantcast
Channel: SCN : Document List - SAP ERP Sales and Distribution (SAP SD)
Viewing all articles
Browse latest Browse all 239

Controlling Returns Order with Reference to Canceled Invoice & Invoice for which subsequent Doucment is existing.

$
0
0

In SAP Standard it is possible to Cancel the Invoice for which we have already created & completed Returns Order. Similarly we can create Returns Order for an Invoice that is already Canceled.

 

We felt that is not logical behavior & raised a query to SAP & below is the reply we received:

 

Quote

Your system works correct, there is no program error.

 

Creation of a sales documents with reference to a billing document does not prevent any actions done on the billing document.

 

Furthermore it is also possible to create a return with reference to a canceled billing document.

 

In transaction VOFA you could set an own copying requirement (field TVFK-GRBED_S) for the used billing document type.

Unquote

 

So we decided to develop Custom Routines & insert the same at appropriate places. (Routines were created / modified after taken necessary access keys from SAP)

 

1. Sales Invoice for with Returns Order have be created, should not be allowed to be canceled.

 

Following was the Routine created:

 

FORM BEDINGUNG_PRUEFEN_601.

 

* This Routine is used to restrict cancellation of billing documents against Return Orders.

*{ INSERT ECDK951721 1

DATA : lv_vbeln TYPE vbeln_von.

SY-SUBRC = 0.

IF vbak-vbeln NE space.

SELECT SINGLE vbeln FROM vbfa Into lv_vbeln WHERE vbelv = vbak-vbeln AND

vbtyp_n = 'H'.

IF SY-SUBRC = 4.

SY-SUBRC = 0.

EXIT.

ELSEIF sy-subrc = 0.

MESSAGE 'Billing document cannot be canceled as Returns Order was generated against this Invoice' TYPE 'E'.

 

ENDIF.

endif.

 

*} INSERT

ENDFORM.

 

The above Routine was assigned at Copying Requirements for Cancellation in Billing Type

 

Now when we tried to Cancel the Invoice for which Returns Order was created, system gave a error message.

 

2. Now, for Invoices that are already Canceled, system should not allow to create Returns Order

 

Here we have to create / modify a Copying Requirement & assign the same at Billing Document to Sales Document Copying Control (T-Code VTAF)

 

Normally Copying Requirement 021 is assigned at Billing Document to Sales Document Copying Control so the below code was added to the 021 Requirement & new Requirements (601) was created).

 

Following was the ABAP code added to standard Routine 021 (& new Routine created):

 

IF vbrk-fksto = 'X'.

MESSAGE 'Return Order Cannot be Raised Against Canceled Billing Document' TYPE 'E'.

ENDIF.

 

After assignment of above new Requirements to VTAF Copying Controls, when we try to create Returns Order for Canceled Invoice, system gave a error message.

 

I am trying to upload images of the above settings, but there seems to be some issue currently.


Viewing all articles
Browse latest Browse all 239

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>