Skip to Content
author's profile photo Former Member
Former Member

Logging in ABAP

Hi,

I have used the Function Module - BAL_LOG_MSG_ADD.

But when i try to find the Logs using transaction "slg1", it says no logs found in the database.

Is there any other Function Module which persist the Logs in the database.

Thanks

Piyush

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 18, 2008 at 05:57 AM

    HI ,

    use the FM: BAL_LOG_CREATE

    BAL_DSP_LOG_DISPLAY

    BAL_DB_SAVE

    BAL_DSP_MSG_LONGTEXT

    AND ALSO refer the following link it will solve your problem :

    http://help.sap.com/saphelp_nw04/Helpdata/EN/bb/6811f980ae11d3966f00a0c930660b/content.htm

    regards

    rahul

    Edited by: RAHUL SHARMA on Dec 18, 2008 6:59 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 18, 2008 at 06:08 AM

    Hi,

    Try this:

    BAL_DB_SEARCH

    Find logs in the database

    BAL_DB_LOAD

    Load logs from the database

    Thanks & Regards,

    Krishna...

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 18, 2008 at 07:08 AM

    Hi,

    Here is a piece of coding ...use it to your effect

    DATA: lv_object TYPE balobj_d VALUE 'INVRPT',

    lv_suboject TYPE balsubobj VALUE 'ZMI39',

    create a function module ZPCO_1453_ERROR_HANDLING

    constants :

    lc_mstyp_E type msid value 'E',

    lc_probclass_1 type BALPROBCL value '1',

    lc_mstyp_w type msid value 'W',

    lc_probclass_2 type BALPROBCL value '2'.

    DATA: lv_loghead TYPE bal_s_log.

    DATA: lv_loghandle TYPE BALLOGHNDL.

    DATA: ls_logmsg TYPE bal_s_msg.

    DATA: ls_message TYPE bal_s_msg.

    DATA: lt_log_handle TYPE bal_t_logh,

    ls_log_handle LIKE LINE OF lt_log_handle.

    *initialize the log object/subobject (lv_loghandle is a global variable)

    lv_loghead-EXTNUMBER = EXTERNAL_ID.

    lv_loghead-object = OBJECT.

    lv_loghead-subobject = SUBOBJECT.

    lv_loghead-aldate_del = sy-datum + 90. "expires in 90 days

    CALL FUNCTION 'BAL_LOG_CREATE'

    EXPORTING

    i_s_log = lv_loghead

    IMPORTING

    e_log_handle = lv_loghandle

    EXCEPTIONS

    OTHERS = 1.

    IF sy-subrc = 1.

    RAISE OTHERS.

    ENDIF.

    *add the messages to the log

    Loop at MESSAGE into ls_message.

    if ls_message-MSGTY = lc_mstyp_w.

    ls_message-PROBCLASS = lc_probclass_2.

    endif.

    if ls_message-MSGTY = lc_mstyp_E.

    ls_message-PROBCLASS = lc_probclass_1.

    endif.

    MOVE-CORRESPONDING ls_message to ls_logmsg.

    CALL FUNCTION 'BAL_LOG_MSG_ADD'

    EXPORTING

    i_log_handle = lv_loghandle

    i_s_msg = ls_logmsg

    EXCEPTIONS

    OTHERS = 1.

    IF sy-subrc = 1.

    RAISE OTHERS.

    ENDIF.

    ENDLOOP.

    *save the log

    ls_log_handle = lv_loghandle.

    APPEND ls_log_handle TO lt_log_handle.

    CALL FUNCTION 'BAL_DB_SAVE'

    EXPORTING

    i_t_log_handle = lt_log_handle

    EXCEPTIONS

    OTHERS = 1.

    IF SY-SUBRC = 1.

    RAISE OTHERS.

    ENDIF.

    Pass your data to this function module..

    CALL FUNCTION 'ZPCO_1453_ERROR_HANDLING'

    EXPORTING

    object = lv_object

    subobject = lv_suboject

    MESSAGE = lv_message1.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.