Publishing BADI and analyzing data logic via Tracing | Custom Logic App | S/4 HANA Public Cloud Edition | 2308 Release
2023-12-14 06:11:11 Author: blogs.sap.com(查看原文) 阅读量:44 收藏

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.

Custom%20Logic%20app 

App Custom Logic

Another access option is through the Custom Fields app

App%20Custom%20Fields

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

Aba%20Custom%20Logic

Custom Logic Tab

Current Custom Logic app

App%20Custom%20Logic%20atualizado

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:


Clicando%20em%20New%20-%20Nova%20implementa%E7%E3o

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%20Points%20-%20Lista%20de%20BADIs%20dispon%EDveis

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)

Nomeando%20sua%20implementa%E7%E3o

Naming your implementation

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

Custom%20Logic%20publicada

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%20Code%20Editor

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%20Sample%20Code

Show Sample Code

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

Par%E2metros%20de%20importa%E7%E3o

Importing parameters

Par%E2metros%20changing%20-%20Sa%EDda

Changing parameters

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

Atalhos

Shortcuts

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

Versionamento%20de%20c%F3digos

Code versioning

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

Testando%20cen%E1rios%20poss%EDveis%20atrav%E9s%20de%20variantes

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%20Logic%20Tracing

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

Definindo%20Trace

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

Publica%E7%E3o%20e%20implementa%E7%E3o%20finalizados%20com%20sucesso

Publication and implementation completed successfully


文章来源: https://blogs.sap.com/2023/12/13/publishing-badi-and-analyzing-data-logic-via-tracing-custom-logic-app-s-4-hana-public-cloud-edition-2308-release/
如有侵权请联系:admin#unsafe.sh