Application Development and Automation 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: 
Read only

Logging in ABAP

Former Member
0 Likes
1,161

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
908

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

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

3 REPLIES 3
Read only

Former Member
0 Likes
909

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

Read only

Former Member
0 Likes
908

Hi,

Try this:

BAL_DB_SEARCH

Find logs in the database

BAL_DB_LOAD

Load logs from the database

Thanks & Regards,

Krishna...

Read only

Former Member
0 Likes
908

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.