Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
marspark
Participant
Many SAP systems provide some Remote-Enabled Function Modules (RFC) as interfaces to external systems. To trace the issues of system integration. We often need log tables to store the exporting/importing parameters' values..

It is a dull work to create lots of log tables for FM. And given the complex and interdependent nature of an SAP system, it may be imperative to carefully manage the log code and tables, in order to avoid duplication. And there may be several background jobs to make sure that the outdated logs be archived/cleaned.

To simplify the log work of FM, I created a tool: abap fm logger.

With abap fm logger, we can save logs of different FM in just ONE table. Search logs in a general report program, like this,

https://raw.githubusercontent.com/hhelibeb/helloworld/master/log%20report.png

The importing/exporting values are not store in separate table fields, but in 4 special fields with JSON format.

We can also reprocess records by log id (like WE19 for IDoc).

 

And it is very easy to use. Benefit from a unified JSON field format, we don't need to write special code for the different interface definition. Here is an example,
FUNCTION z_fm.

**initialize logger. It should be always on the top of the FUNCTION.
/afl/log_init.

**optional, you can specify at most 3 fields for search.
/afl/set_custom_fields 'cust field1' 'cust field2' 'cust field3'.

**optional, you can save a status code and message text for search.
/afl/set_status 'S' 'message'.

**save logs. It should be always on the bottom of the FUNCTION.
/afl/save.

ENDFUNCTION.

 

In the most cases, we may just need two macros /afl/log_init and /afl/save. It is enough.

You can access https://github.com/hhelibeb/abap-fm-logger for more details of abap fm logger and install it by abapGit.

Feel free to comment the tool.

Thanks

8 Comments