Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Application log

vg24
Explorer
0 Likes
2,231

I am new to ABAP and have been wanting to get log number from log handle using FM BAL_DB_SEARCH. Can someone help me by telling me how to do it?

Thanks in advance!!

9 REPLIES 9
Read only

Enda
Product and Topic Expert
Product and Topic Expert
0 Likes
1,953

Welcome and thanks for visiting SAP Community to get answers to your questions. Check out our tutorial to get started in SAP Community: https://developers.sap.com/tutorials/community-start.html By adding a picture to your profile you encourage readers to respond to your question. Learn more about your profile here: https://developers.sap.com/tutorials/community-profile.html

Read only

TammyPowlas
SAP Mentor
SAP Mentor
1,953

Hello,

There is a nice wiki that explains this - please see https://wiki.scn.sap.com/wiki/display/Snippets/Using+Application+Log

Read only

0 Likes
1,953

Thank you for the reply!!

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,953

I don't understand your issue, you have both the log number and log handle in BAL_DB_SEARCH.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,953

From BAL_DB_SEARCH with somer filter criteria passed to i_s_log_filter you get an internal table of log header in e_t_log_header (BALHDR)

so you could for example

  • Read the log data with BAL_DB_LOAD

and then (in a loop)

  • Read header data (at new log_handle) with BAL_LOG_HDR_READ
  • Read messages with BAL_LOG_MSG_READ

What is your exact requirement?

Read only

0 Likes
1,953

The exact requirement is to enter a specific log handle and get log number as the output in a variable. I have managed to get the log number, now it needs to be put inside a variable.

Read only

0 Likes
1,953
  • Fill the range LOG_HANDLE of deep structure I_S_LOG_FILTER with a record containing I/EQ/values/initial values (e.g. code similar to the code in BAL_FILTER_CREATE)
  • Call BAL_DB_SEARCH
  • Check for errors
  • Loop at returned internal table E_T_LOG_HEADER for value(s) of field LOGNUMBER
  • Move the value to a variable (internal table of variables)
Read only

keremkoseoglu
Contributor
0 Likes
1,953

Not a direct answer to your question, but this repository may make your Application Log access a little easier: https://github.com/keremkoseoglu/simbal

Read only

0 Likes
1,953

It's done. Thank you for the help!!