Create Custom Logic Using Key User Extensibility and Perform Trace
- How to create custom logic for an existing custom field in the app Custom Fields
- How to run a trace for the Fiori app Create Purchase Order in the app Custom Logic Tracing
- How to check the output value of this custom field using Custom Logic Tracing
- How to check the custom logic of this custom field, in Custom Fields
- You have a license for SAP S/4HANA Cloud
- You are familiar with Key User extensibility in SAP S/4HANA Cloud. If not, see the More Information section
- You are familiar with the app Custom Logic Tracing. If not, see the More Information section
- In SAP Fiori launchpad, you have the following authorizations:
SAP_BR_PURCHASERfor the app Create Purchase Order - Advanced
SAP_BR_ADMINISTRATORfor Custom Logic Tracing and Custom Logic
- You have created a custom field using Key User extensibility
- In Custom Logic, you have created a
YY1_FILLHEADERCUSTOMFIELDS_000in the business context and
BAdIdefinition Modify Purchase Order Header (
The administrator receives an welcome e-mail after provisioning. This e-mail includes the system URL. By removing
/uiyou can log into the SAP S/4HANA Cloud ABAP Environment system. Further information can be found Developer Extensibility: Connect to the ABAP System.
Throughout this tutorial, the placeholder
000 is used. Always replace this with your initials or group number.
- Step 1
Open the app Custom Fields.
Change to the Custom Logic tab, search for the
Open the Details screen (by choosing the arrow on the right).
You can now see the Published Logic and Draft Logic, if they exist, relevant to the custom field.
- Step 2
Comment out any existing code.
In the custom logic for the field
yy1_zhdrprnt2_pdh_000, copy the following code.
This code will copy the content from a standard field,
purchaseorder-supplyingplantinto the custom field,
IF purchaseorder-supplyingplant is not initial. purchaseorderchange-yy1_zhdrprnt2_pdh_000 = purchaseorder-supplyingplant. endif.
Save and publish your custom code.
You are now ready to trace the effects of your custom code when a purchase order is created.
- Step 3
Open the app Custom Logic Tracing and choose Start Trace.
Enter the following information, remembering to change the placeholder to your group number or initials:
Field Name Value Name Test Create PO Custom Fields
Trace User Your user Stored until future date in the format
- Step 4
IMPORTANT: While Trace is running, create a purchase order as follows.
Open Create Purchase Order - Advanced.
In the top header, change the Order Type to Stock Transport Order and the Supplying Plant to 1010.
Enter the Supplying Plant, 1010
In the header section, go to the Custom Fields tab, check that the custom field ZPOHDRPRINT2 now contains the value 1010.
On the Org Data tab, enter the following:
Field Name Value Purchase Organization 1010 Group 001 Company code 1010
If you check the custom field
YY1_ZHDRPRNT2_PDH_000, it is now filled with the same value as Supplying Plant, 1010.
In the Item Overview section, enter the following. Ignore any warnings.
Field Name Value Material
PO Quantity 1 Delivery Date future date in the format
The other fields - Material Group, Plant Storage Location - should be filled automatically.
- Step 5
Choose Finish trace.
Open the trace. In Trace Hierarchy, choose the last call of
(This is necessary because the
BAdIimplementation is called several times.)
Then choose the parameter Purchase Order.
Scroll right down to the field
YY1_ZHDRPRNT2_PDH_000. Check that its value = 1010.
- Step 6
In which Fiori app do you find all custom implementations that are called during a process?
- Step 7
- SAP Help Portal: Business Add-Ins (
- SAP Help Portal: ABAP Platform App Implementation: Custom Logic Tracing
- SAP Help Portal: Sourcing and Procurement: Adaptation of App Behavior (Overview and List of Available
- SAP Help Portal: Business Add-Ins (