BAPI - Sales document - Copy control issues
I am creating a Credit memo referencing an invoice using the function "SD_SALESDOCUMENT_CREATE'.
I get the invoice pricing details using RV_INVOICE_DOCUMENT_READ. Populate the inputs manually and pass those values to SD_SALESDOCUMENT_CREATE' with the flag logic_switch-pricing set to 'G'.
I have two issues,
1. Group conditions(Freight) value is not copied from the value that is passed. Please let me know
2. pricing procedure is not copied. But I was able to overcome this by exporting the invoice pricing procedure to memory before calling the fn "SD_SALESDOCUMENT_CREATE" and importing the value in the Sales order userexit(MV45AFZZ) and change pricing procedure in tables tkomk / VBAK . Not sure if this is the correct way to implement. Please advise.
Brad Bohn replied
Good points, though I tend to avoid the COPY BAPI approach because it sometimes requires a second BAPI CHANGE call or other exit adjustments to 'fix' or adjust the new document. If you use the COPY BAPI function though, your standard item category based repricing settings will take affect. If you want to change that, you can also use the USEREXIT_PRICING_RULE exit in RV61AFZA. Though the CALL_BAPI variable is not available to detect the BAPI call mode, the FLAG_DIALOG_STATUS parameter ID set by the BAPI is available.