05-31-2011 5:12 PM
Hi,
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.
Thank You.
05-31-2011 5:35 PM
Does your freight condition allow manual overrides or give priority to manual conditions? That's in effect what you are specifying if you are specifying the value in the interface. The pricing type field doesn't behave the way you probably think it does.
Pricing procedures are assigned by sales org, customer PP indicator and doc type PP indicator. So, the question would be why does your credit memo pick up an incorrect/unexpected value? What happens when you create with reference in VA01? Isn't your credit memo configured to pick up the same PP? You should definitely not force a value in a user exit.
05-31-2011 5:35 PM
Does your freight condition allow manual overrides or give priority to manual conditions? That's in effect what you are specifying if you are specifying the value in the interface. The pricing type field doesn't behave the way you probably think it does.
Pricing procedures are assigned by sales org, customer PP indicator and doc type PP indicator. So, the question would be why does your credit memo pick up an incorrect/unexpected value? What happens when you create with reference in VA01? Isn't your credit memo configured to pick up the same PP? You should definitely not force a value in a user exit.
05-31-2011 6:43 PM
Thank you for your response.
In VA01, we can create credit memo with reference or w/o reference. If we create a Credit memo with reference the pricing procedure gets copied from the reference document whereas if it is created w/o reference the pricing procedure is determined based on customisation. We have defined a different pricing procedure for credit memo document type.
I need to create credit memo referencing an invoice using "SD_SALESDOCUMENT_CREATE". This function does not have the pricing procedure field so I try to update the refernce pricing procedure in the userexit. Please advise the correct way of implementing this.
Also the frieght is set up as Header and group condition and automatic entry has priority.
05-31-2011 7:12 PM
Hello
If you want to copy all the details from invoice to credit memo request and modify the pricing type to 'G', then
please follow the below steps
1. Use BAPI_SALEDOCUMENT_COPY - This will copy the invoice data to credit memo.
2. If you need to modify the Credit memo data based on credit memo type then ask the functional owner to put the custom copy control routine (VOFM routines) and you can modify the custom routine for the VBAK/ VBAP and VBKD etc as required.
3. For the pricing issue, you need to implement a BADI in program MV45AF0T_TVCPA_SELECT. The enhancement spot is Enhancement-point TVCPA_SELECT_01 SPOTS ES_SAPMV45A.
Here modify TVCPA-KNPRS = 'G' when TVCPA-AUARN = < Credit memo Type>.
There may be other validation, depending on the business need.
Let may me know, it helps you. Thanks.
Edited by: Atul Mohanty on May 31, 2011 8:12 PM
Edited by: Atul Mohanty on May 31, 2011 9:14 PM
05-31-2011 9:51 PM
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.
06-01-2011 3:22 AM
Brad - you are correct, it needs other adjustment if we use bapi copy depending on business need. Thanks.