How to use Cloud BAdI to modify returns item data
Cloud BAdI(Business Add-In ) is part of App Extensibility. In this blog post, you will learn how to customize your application using BAdIs.
From CE2202, a new Cloud BAdI SD_SLS_MODIFY_RETURNS_ITEM is enabled. BAdI SD_SLS_MODIFY_RETURNS_ITEM is called whenever a customer return is created by business user. You can use this BAdI to automatically enter returns-specific data in a returns order.
To customize your BAdI logic, logon to the SAP Fiori launchpad as an Administrator and open Custom Logic.
Choose Custom Logic in top menu bar and choose Create.
Fill the following entries and choose Create.
- Business Context: Sales: Sales Document Item
- BAdI Description: Modification of Item-Level Returns Data for Accelerated Returns
- Implementation Description: for example: Modify return item
- Implementation ID: Generated by default
Choose Draft, implement your logic in Draft Logic section.
For example, you can set the follow-up activity code and data related to this follow-up activity automatically based on customer-defined business rules. For example, if certain materials must always be shipped to the supplier for inspection, you can set follow-up activity Ship to Supplier and the supplier number.
if customerreturn-soldtoparty = '0010300003' and customerreturnitem_in-material = 'TG13' and customerreturnitem_out-custretitmfollowupactivity is initial. customerreturnitem_out-custretitmfollowupactivity = '0005'. customerreturnitem_out-supplier = '0010300006'. endif.
Sold-to-party should be 10 characters, add leading zeros if sold-to-party is less than 10 characters.
Set the follow-up activity in the parameter customerreturnitem_out to “initial” to make sure this customized logic is executed only when you create the returns order and the follow-up activity has not been filled yet.
Choose Save Draft and then Publish.
With this customized logic, when you try to create a return which sold-to-party is 10100003 and material is TG13, then BAdI will set follow-up activity to 0005 and supplier to 10300006.
All Fields in CustomerReturnItem_out are changeable.
|Global Field Name||Technical Name||Description|
|CUSTRETITMFOLLOWUPACTIVITY||FU_CODE||Follow-Up Activity Code|
|RETURNSINSPECTIONCOMMENT||INSP_SHORT_TEXT||Inspection Comment Line|
|PRODUCTISINSPECTEDATCUSTSITE||AT_CUSTOMER_SITE||Inspection at Customer Site|
|SUPPLIER||LIFNR||Vendor’s account number|
|RETURNSREFUNDCODE||MSR_REFUND_CODE||Returns Refund Code|
|REPLACEMENTMATERIALQUANTITY||REPLACE_QTY||Replacement Material Quantity|
|REPLACEMENTMATERIALQTYUNIT||REPLACE_UNIT||Replacement Material Unit of Measure|
|REPLACEMENTMATLSUPPLYINGPLANT||PAYING_PLANT||Supplying Plant for Replacement Material|
This blog post only shows a simple case using BAdI to accelerate creation of customer return. Basically, you can achieve various enhancement against your business process. For more details, check the BAdI documentation in the Custom Logic app.