03-03-2011 8:45 AM
Hi,
I amI creating application log and filling messages in my custom program. In order to provide more information to the user, I am using the CONTEXT field while calling the BAL_LOG_MSG_ADD function. After the main program finishes, the function BAL_DSP_LOG_DISPLAY displays the log as expected. However, the recording of the same app log which can be seen by calling tcode SLG1 does not show the additional fields, only messages. Is there a way to enable these additional data to be shown in SLG1?
Thanks!
Igor
Here is my sample program:
DATA: gs_log TYPE bal_s_log,
gs_msg TYPE bal_s_msg,
gt_handle TYPE bal_t_logh,
gs_handle LIKE LINE OF gt_handle,
gs_context TYPE bal_s_ex01,
l_s_display_profile TYPE bal_s_prof,
l_s_fcat TYPE bal_s_fcat.
* create log entry
gs_log-extnumber = 'TEST_APPLOG'. "#EC NOTEXT
gs_log-aluser = sy-uname.
gs_log-alprog = sy-repid.
gs_log-object = 'ALERT'. "possible entries in BALSUB table, maint tcode SLG0
gs_log-subobject = 'ALERT_LCL'.
CALL FUNCTION 'BAL_LOG_CREATE'
EXPORTING
i_s_log = gs_log
IMPORTING
e_log_handle = gs_handle.
APPEND gs_handle TO gt_handle.
* add message 3 to log
CLEAR gs_msg.
gs_msg-msgty = 'W'.
gs_msg-msgid = 'OO'.
gs_msg-msgno = '023'.
* add context
gs_context-carrid = 'LH'.
gs_context-connid = '0400'.
gs_context-fldate = '20100101'.
gs_context-id = '12'.
gs_msg-context-value = gs_context.
gs_msg-context-tabname = 'BAL_S_EX01'.
CALL FUNCTION 'BAL_LOG_MSG_ADD'
EXPORTING
i_s_msg = gs_msg
i_log_handle = gs_handle.
* save log to DB - display with tcode SLG1
CALL FUNCTION 'BAL_DB_SAVE'
EXPORTING
i_t_log_handle = gt_handle.
* get standard display profile
CALL FUNCTION 'BAL_DSP_PROFILE_SINGLE_LOG_GET'
IMPORTING
e_s_display_profile = l_s_display_profile.
* add passenger ID to message table
l_s_fcat-ref_table = 'BAL_S_EX01'.
l_s_fcat-ref_field = 'ID'.
l_s_fcat-col_pos = 100.
APPEND l_s_fcat TO l_s_display_profile-mess_fcat.
* display log (possible w/o saving)
CALL FUNCTION 'BAL_DSP_LOG_DISPLAY'
EXPORTING
i_t_log_handle = gt_handle
i_s_display_profile = l_s_display_profile.
04-27-2012 2:42 PM
hi igor,
i found a reply to your question on another site:
i found a way to view the parameters in SLG1:
if i add the parameter name and value as message 2 and 3 i can view them in the display.
hi prahbu,
igor is right. i need this functionality for slg1. i don't even use the 'BAL_DSP_LOG_DISPLAY' function but if i use it i get the ok list in a z_transaction just not in SLG1.
thanks for your help guys,
best regards,
emilia
04-26-2012 3:20 PM
hi Igor,
did you solve this error?
can you share with me your solution?
thanks,
emilia
04-27-2012 10:08 AM
Hi ,
you need to maintain field catalog for those fieilds..
" here he mainatined only for field 'ID' that why he cant see all the fields on the log"
* add passenger ID to message table
l_s_fcat-ref_table = 'BAL_S_EX01'.
l_s_fcat-ref_field = 'ID'.
l_s_fcat-col_pos = 100.
APPEND l_s_fcat TO l_s_display_profile-mess_fcat.
regards...
Prabhu
04-27-2012 1:03 PM
Hi, Emilia,
I am trying to find in my notes - it was long time ago and I don't have access to client's system. I don't remember really...
Prabhu,
Field ID is shown when you run the program, but not in SLG1. This is the problem, not other fields.
KR,
Igor
04-27-2012 2:42 PM
hi igor,
i found a reply to your question on another site:
i found a way to view the parameters in SLG1:
if i add the parameter name and value as message 2 and 3 i can view them in the display.
hi prahbu,
igor is right. i need this functionality for slg1. i don't even use the 'BAL_DSP_LOG_DISPLAY' function but if i use it i get the ok list in a z_transaction just not in SLG1.
thanks for your help guys,
best regards,
emilia
04-27-2012 2:51 PM
Hi, Emilia,
I remember now - this is how I did it exactly! But you still deserve your points for this reply.
Cheers,
Igor