Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
anakarladyna
Explorer
1,272

Introduction


In the S/4 HANA Public Cloud world, developers engage in implementing their BADI's and crafting logical codes to customize an application through the Custom Logic app. This app allows them to analyze the implementations available for each scenario based on its context and theme.

Need


Implementation of a BADI for logical development in an S/4 HANA Public Cloud Edition environment, release 2308. To achieve this goal, we must follow the following steps:


 

1. Acessing the app


Search in the "Apps" filter for the "Custom Logic" application. Note that there is a deprecated version, which should not be used.

 


App Custom Logic


 

Another access option is through the Custom Fields app


App Custom Fields


 

In the Custom Logic tab, it will inform you that the app is deprecated, and will take you to the current app



Custom Logic Tab


 


 


Current Custom Logic app



Updated Custom Logic app


 


 

2. Identifying BADI


When you click create an implementation, you will first need to define the Business Context of the scenario in which you want to publish a logical implementation:




Clicking on New - New implementation


You can view the documentation for each one to see what it is receiving as input and what parameters it is possible to modify.


Extension Points - List of available BADIs


 


 



3. Implementing BADI


After selecting the BADI, follow the steps to name it and publish it in the environment (step 2 will depend on each scenario)


Naming your implementation


 

At the end, it is necessary to publish it in the environment



Custom Logic published


4. Publishing your logic code

 

In the Open Code Editor, it is possible to implement the desired logic according to the availability of each BADI.


 



Open Code Editor


 


In Show Sample Code, each BADI provides an example of how to declare the structures and fill in the data for the respective logic.


Show Sample Code


 


You can view the import and export parameters on the right side of the screen



Importing parameters


 



Changing parameters


 


 

In Show Keyboard Shortcuts there are some shortcuts that make coding easier, such as pretty printer or code completion



Shortcuts


 


 


In the Compare tab, we can see all the published versions for comparison or retrieval



Code versioning


 


 


In the Test tab, we can simulate the code by adding values and saving them as variants


 



Testing possible scenarios through variants


 


 



 


 


 


 


5. Enabling Tracing for data analysis (debug option)


 

To analyze the result of the data and the behavior of each logical command implemented in the BADI, we can't set a breakpoint as we do in the On-premise and enter debug mode during the scenario execution. However, we have the support of Tracing to check the return of the information we want to obtain.

For this, it is necessary to access the Custom Logic Tracing app.




Custom Logic Tracing


 

By clicking on Start Trace, it is possible to define the name, the user, until when the tracing will remain in the list for consultation, and the number of minutes for which you want to perform the tracing



Defining Trace


 


 

At this moment, the result variables you want to visualize need to be inserted with this line of code in your BADI:
Examples
cl_ble_trace_writer=>write_info_message( message = | title for identification in trace: { structure-field} | ).

cl_ble_trace_writer=>write_info_message( message = | title for identification in trace: { variable} | ).



Example of the scenario I will run:
cl_ble_trace_writer=>write_info_message( message = | headernetweight : { ls_deliverydocument-headernetweight } | ).

 


 

After running the scenario with active tracing, you can view its result:


 


 

It is also possible to view the importing/changing parameters that were loaded at runtime in the BADI.


 

 

 

Evidence of the final scenario


BADI implemented and published for use in the environment


 



Publication and implementation completed successfully


 

 

Labels in this area