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 is not displayed in SLG1

Former Member

Hi SAP-Fans,

I want to log erros that occur in reports. Therefore I implemented the method "add" from the class "CL_RECA_MESSAGE_LIST" in my report. This works fine. Unfortunately the errors won't be displayed in the transaction SLG1. How can I change that? Or ist there another transaction to display the created errors?

Best regards,

Benjamin

1 ACCEPTED SOLUTION

Hi,

In order to view the logs in SLG1, you need to create application log object using funciton module BAL_LOG_CREATE and add error messages using function modules BAL_LOG_MSG_ADD & BAL_DB_SAVE.

For detailed explanation check below link.

SAPTechnical.COM - ABAP based Application Log

Regards,

Satish

14 REPLIES 14

Former Member
0 Kudos

This message was moderated.

0 Kudos

Hi Gayatri,


Thanks for you help.

The link I have already found, but unfortunately it doesn't work any more.

Any other ideas?

Best regards,

Benjamin

former_member220028
Active Contributor
0 Kudos

Hi,

to display, you call the display method.

if you want to save it in slg1, you have to call the save method.

regards

Stefan Seeburger

0 Kudos

Hi,

I'd love to do it, but there is no method called 'save' in 'CF_RECA_MESSAGE_LIST' or 'IF_RECA_MESSAGE_LIST'. I tried it with "IF_RECA_MESSAGE_LIST->STORE", but without success.
Any further ideas for a method?

Best regards,

Benjamin

Hi,

In order to view the logs in SLG1, you need to create application log object using funciton module BAL_LOG_CREATE and add error messages using function modules BAL_LOG_MSG_ADD & BAL_DB_SAVE.

For detailed explanation check below link.

SAPTechnical.COM - ABAP based Application Log

Regards,

Satish

0 Kudos

Hi,

well it should work...

i didnt know the class IF_RECA_MESSAGE_LIST but the "store" method calls BAL_DB_SAVE, so it looks fine. did you

check for any error msges when creating/saving?

check if the handle is always the same (init/add/save)

check if you maybe did a wrong protokoll selection in SLG1

maybe you have to set a commit work or wait till your programm finished to see the protokoll in slg1.

dont know any more, maybe you have to debug to find out why it is not getting saved.

regards

Stefan Seeburger

0 Kudos

Hi,

I added "Commit work" after "IF_RECA_MESSAGE_LIST->STORE". Now it works.

Thanks Mr. Seeburger.

Best regards,

Benjamin Warnecke

0 Kudos

Benjamin,

I have used the below FMs to capture the logs in SLG1 but I have to repeat the

BAL_LOG_MSG_ADD & BAL_DB_SAVE.multiple times to capture the change logs depending on the various scenarios I have.

.

BAL_LOG_CREATE

BAL_LOG_MSG_ADD

BAL_DB_SAVE.

I would like to know if "CL_RECA_MESSAGE_LIST" is a better way of handling this when compared to the above.Thanks.

K.Kiran.

0 Kudos

Hi Kiran,

using the log with ABAP OO (CL_RECA_MESSAGE_LIST) consist of max. 4 steps. It seems to be easier, than the version with FM.

The steps are

1. Create instance of the message collector class

  Data: lo_message_list type REF TO IF_RECA_MESSAGE_LIST.

  CALL METHOD cf_reca_message_list=>create

2. Add message to log

  CALL METHOD lo_message_list->add

3. Save message

  CALL METHOD lo_message_list->store

4. Commit work (not always necessary or allowed)

  COMMIT WORK.

Hope, I could help you.

Best regards,

Benjamin

0 Kudos

Benjamin,

May be when you find time you can post a document or blog with code snippet so that I can see how it will improvise my current version of capturing the logs.Thanks.

K.Kiran.

0 Kudos

Hi,

the following code shows how to create an entry in the log:
Data: lo_message_list type REF TO IF_RECA_MESSAGE_LIST.
CALL METHOD cf_reca_message_list=>create
*  EXPORTING
*    id_object       = 'ZFORMS'
*    id_subobject    = 'MAIL'
*    id_extnumber    =
*    id_deldate      = RECA0_DATE-MIN
*    if_delnotbefore = ABAP_FALSE
   RECEIVING
     ro_instance     = lo_message_list
     .

data: ls_message type RECAMSG.

CALL METHOD lo_message_list->add
   EXPORTING
*    is_message   =
     id_msgty     = 'E'
     id_msgid     = 'Z_BW_MESSAGES'
     id_msgno     = '000'
     id_msgv1     = 'Fehler aufgetreten bla bla'
*    id_msgv2     = 'Fortsetzung bla bla'
*    id_msgv3     =
*    id_msgv4     =
*    id_msgd1     = 'SY-datum'
*    id_msgd2     =
*    id_msgd3     =
*    id_msgd4     =
*    if_cumulate  =
*    id_detlevel  =
*    id_probclass =
*    id_tabname   =
*    id_fieldname =
*    id_value     =
*    id_index     =
*    id_intreno   =
*    id_custact   =
*    id_sublog    =
*    id_context   =
   IMPORTING
     es_message   = ls_message
     .

CALL METHOD lo_message_list->store
"  EXPORTING
"    if_in_update_task = ABAP_TRUE
   EXCEPTIONS
     error             = 1
     others            = 2
         .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

commit work.


Is syntax-highlighting available in this forum?


Best regards,

Benjamin

Former Member
0 Kudos

Hi Benjamin,

To display & store your customized message in SLG1,  you can create your own FM by referring the below link:-

http://scn.sap.com/docs/DOC-59182

Regards

Shashank Singhal

0 Kudos

Hi Shashank,


thanks for the link, but the problem is already solved only the commit was missing.


Best regards,

Benjamin