
In the Create Sales Orders - Automatic Extraction app, the system starts data extraction and data proposal for sales order requests immediately after your purchase order files are uploaded. If SAP pre-delivered proposal rules do not satisfy your business needs, key users can create custom logic to modify sales order request data based on your own rules. (To know more about the default proposal rules, see Create Sales Orders - Automatic Extraction on SAP Help Portal.)
Here is an example of how to create your custom logic. You want the custom logic to work as follows:
To create custom logic, SAP S/4HANA Cloud users should use the BAdI SD_SOR_AUTO_XTRCTN_MODIFY in the Custom Logic app, and SAP S/4HANA users can also call transaction se18 to open the enhancement spot ES_SD_SOR_AUTO_XTRCTN_MODIFY. The screenshots in following procedure are based on SAP S/4HANA Cloud 2402.
Creating Custom Logic
1. Open the Custom Logic app (extensibility specialist role SAP_BR_EXTENSIBILITY_SPEC).
2. On the Custom Logic tab, click Create.
3. Search for “SD_SOR_AUTO_XTRCTN_MODIFY” or “Sales Order Request”, and choose the extension point. Click Step 2.
Specify a description for your implementation. The system generates an ID according to your description. Click Review.
Click Create.
Once an implementation is created, click Publish.
The code editor includes three tabs: Develop, Test and Compare. You can write code and check parameters info on the Develop tab. Click Edit to start writing.
Note: In our case, the custom logic involves both header and item fields. So, the output parameters include salesorderrequestheaderchanged (for header) and salesorderrequestitemschanged (for items).
In your code for the sales order request header, specify "company code = 0001" as the condition, and "sales area = 0001/01/01" as the result.
In your code for sales order request items, specify "requested delivery date = initial" as the condition, and "requested delivery date = current date + 7 days" as the result. Note that the current system date is retrieved from class cl_abap_context_info and method get_system_date.
Tip: The code editor support auto-completion. You can press "Ctrl + Space" to get suggestions and press "Shift + Enter" to insert the full signature.
5. Once the code is done, click Save. We recommend that you test your logic before publishing it.
Testing Custom Logic
Switch to the Test tab. Here you need to provide test data in the import parameters manually.
1. Enter "0001" for company code in the import parameter for sales order request header.
2. Input one row of test data in the import parameter for the sales order request items source. Specify a sales order request ID and an item ID.
3. Input one row of test data in the import parameter for sales order request items. Enter the same sales order request ID and item ID, with an empty request delivery date.
4. Save the test data by clicking Save As, and specify a variant name. Later you can switch test data using variants.
5. Click Test and check the test result in output parameters. The system should have set the sales area and the item request delivery date to expected values.
Publishing Custom Logic
Once the test is passed, you can Click Publish.
More Samples
Click Show Sample Code in the code editor window. The samples show how you can use the import and changing parameters. You can copy the code snippets and adjust them as needed.
1. Determinate Ship-to as Sold-to
With the custom logic, the system fills the ship-to party with the sold-to party for sales order requests whose sales area is 1010/10/03 and for which no ship-to party can be determined.
2. Assign Sales Area According to Ship-to
With the custom logic, the system assigns a sales area according to the ship-to party for sales order requests whose company code is F001.
3. Change Sales Order Type
With the custom logic, the system changes the sales order type from OR (default type) to CCIS for sales order requests whose sales area is 1010/10/00.
4. Determinate Header Requested Delivery Date According to Items
With the custom logic, the system sets the header requested delivery date to the earliest requested delivery date in all items.
5. UoM Conversion
With the custom logic, the system changes the UoM to KG and sets the requested quantity to "requested quantity*100" for sales order request items whose UoM is BAG.
You can find series of blogs about this solution in below link.
The Link Collection for Create Sales Orders – Automatic Extraction | SAP Blogs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
25 | |
24 | |
16 | |
14 | |
10 | |
10 | |
9 | |
7 | |
7 | |
7 |