Application Development 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: 

LOG functionality issue in ABAP screen

jatin_grover
Product and Topic Expert
Product and Topic Expert
0 Kudos
356

Hi,

I am creating a log in a sub-screen using the following flow logic:-

1. Create log using FM 'BAL_LOG_CREATE'

2. Adding messages using FM 'BAL_LOG_MSG_ADD'

3. Create a display profile where the column is set as Message text from stru BAL_S_SHOW-T_MSG

4. Initialization of display profile using FM 'BAL_DSP_OUTPUT_INIT'

5. And finally setting the data to be displayed using FM 'BAL_DSP_OUTPUT_SET_DATA'

Though everything works fine and log gets generated but in the message text column i get the message no, message class also which i need to suppress which i am not able to figure out how.

Below you can find the subroutine called for each message:-

FORM LOG_MSG_ADD USING

value(i_log_handle) TYPE balloghndl.

DATA: l_s_msg TYPE bal_s_msg.

  • define data of message for Application Log

l_s_msg-msgty = sy-msgty.

l_s_msg-msgid = sy-msgid.

l_s_msg-msgno = sy-msgno.

l_s_msg-msgv1 = sy-msgv1.

l_s_msg-msgv2 = sy-msgv2.

l_s_msg-msgv3 = sy-msgv3.

l_s_msg-msgv4 = sy-msgv4.

  • add this message to log file

CALL FUNCTION 'BAL_LOG_MSG_ADD'

EXPORTING

i_log_handle = i_log_handle

i_s_msg = l_s_msg

EXCEPTIONS

OTHERS = 1.

IF sy-subrc 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM.

Kindly suggest me pointers.

Thanks,

Jatin

6 REPLIES 6

Former Member
0 Kudos
164

Call FM BAL_DSP_PROFILE_SINGLE_LOG_GET to get the standard display profile, adjust the MESS_FCAT component in the profile structure (ie. remove your unwanted columns), then pass this updated profile when you call 'BAL_DSP_OUTPUT_INIT'.

jatin_grover
Product and Topic Expert
Product and Topic Expert
0 Kudos
164

Hi Daniel,

I was doing something similar as to what you suggested but in a different manner like:-

FORM GET_DISPLAY_PROFILE  CHANGING C_S_DISPLAY_PROFILE TYPE BAL_S_PROF.

DATA:
    l_s_fcat                     TYPE bal_s_fcat.

* Message text
  CLEAR l_s_fcat.
  l_s_fcat-col_pos   = 1.
  l_s_fcat-ref_table = 'BAL_S_SHOW'.
  l_s_fcat-ref_field = 'T_MSG'.
  APPEND l_s_fcat TO c_s_display_profile-mess_fcat.

In this case i am only adding T_MSG to the display profile.

Though i tried the approach which you also told and there is no change in the log.

So the end result is there are 2 columns in the log:-

1. Type - Displaying the icons

2. Message Text - which is displaying the Messgae type, Message class , message no and message text in one column based on the messages inserted through the subroutine specified on top in the thread.

Regards,

Jatin

0 Kudos
164

Check original language of the message and if it was translated to the language in which the log was created/displayed.

The format you describe is used eg. when there is no translation available.

jatin_grover
Product and Topic Expert
Product and Topic Expert
0 Kudos
164

Messages are defined in EN and the log is also being displayed in EN.

Does the context structure in bal_s_msg have any role in this as this structure is used while calling function module.

CALL FUNCTION 'BAL_LOG_MSG_ADD'
       EXPORTING
            i_log_handle = i_log_handle
            i_s_msg      = l_s_msg
       EXCEPTIONS
            OTHERS       = 1.

0 Kudos
164

I'd double check if the message really exist.

I can reproduce your symptoms if I populate l_s_msg with wrong data.

If I mistype for example MSGID is see following data in the text column:

"MSGTY:MSGID:MSGNO"

Do you raise the message your self before adding it to the log or it's a result of some standard function?

You can also put a breakpoint in LSBAL_DISPLAY_BASEF05 FORM msg_txt_read to see why it is not getting proper text.

jatin_grover
Product and Topic Expert
Product and Topic Expert
0 Kudos
164

I was using the message which is defined in the message class but instead of text it consisted of 4 placeholders i.e. &1 &2 &3 &4 which i was filling in my program.

So instead of using FM BAL_LOG_MSG_ADD now i am using FM BAL_LOG_MSG_ADD_FREE_TEXT which has solved the problem.