08-25-2011 2:18 PM
Hi,
i need to use Application log, and i would like to have a tree of data, for example :
. File number xxxxxx
. Header
. Message 1
. Message 2
. Data
. Message 1
. Message 2
I know to use FM 'BAL_LOG_CREATE', 'BAL_LOG_MSG_ADD' and 'BAL_DSP_LOG_DISPLAY' but how can i implement my need ? I take a look at the programme SBAL_DEMO_05 that is my need but sorry i don't understand how it works.
Thanks for your help.
08-31-2011 11:06 AM
the structure of a BAL message is fixed but you have one generic field called CONTEXT of type BAL_S_CONT
look at it in the DDIC : you have pairs of tabname and value
tabname contains the name of structure and value the contents of structure
the tree display comes from the display profile: see structure BAL_S_PROF
you have fields called LEV1_FCAT, LEV2_FCAT and so on... which allow you to create n levels in your tree
look at routine display_logs in your sample program to see how to populate the levels (basically one field of context per level)
08-31-2011 12:26 PM
First read some documentation to better understand SBAL_DEMO_05 program, try [Application Log|http://help.sap.com/saphelp_tm80/helpdata/en/d3/1fa03940fab918e10000000a114084/frameset.htm] [Guidelines for Developers|http://help.sap.com/saphelp_tm80/helpdata/en/d6/5d7f38f52f923ae10000009b38f8cf/frameset.htm]
Regards,
Raymond
05-25-2012 7:50 AM
Hi all,
you can also use CL_PTU_MESSAGE to display and log the messages
sample code is below
data: g_log type ref to cl_ptu_message,
ls_log type bal_s_log.
* maintain from transaction slg0 (object and subobject of obcejt)
ls_log-object = 'ZOBJ'.
ls_log-subobject = 'ZSUB'.
create object g_log
exporting
is_log = ls_log.
call method g_log->if_ptu_message~add_text
exporting
iv_type = 'S'
iv_text = 'Program executed'.
call method g_log->if_ptu_message~add_text
exporting
iv_type = 'W'
iv_text = 'There Will be warnings'.
call method g_log->if_ptu_message~add_text
exporting
iv_type = 'E'
iv_text = 'Also Errors!!'.
g_log->save_log( ).
call method g_log->display_log.