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: 

Displaying error messages from application log

Former Member
0 Kudos

Hi,

I am using the function module RV_DELIVERY_CREATE for creating delivery in my program. If the sy-subrc is not zero i.e if delivery is not created, i have to display error messages collected inside the application.How can i do this ?

The object nd subobject are existing in SLG0 but when i

tried to see the object and subobject in SLG1 transaction , no logs were found.

Do we need to activate the object and sunobject somewhere before logging can take place??

I am using the following code in my program to display the logs but it is displaying no logs found:

..........

CALL FUNCTION 'APPL_LOG_SET_OBJECT'

EXPORTING

object = 'ZCH_SCL'

subobject = 'DL'

  • LOG_HANDLE = ' '

  • NO_LOG = ' '

  • EXCEPTIONS

  • OBJECT_NOT_FOUND = 1

  • SUBOBJECT_NOT_FOUND = 2

  • OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'APPL_LOG_INIT'

EXPORTING

OBJECT = 'ZCH_SCL'

SUBOBJECT = 'DL'

  • LOG_HANDLE = ' '

  • EXCEPTIONS

  • OBJECT_NOT_FOUND = 1

  • SUBOBJECT_NOT_FOUND = 2

  • OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

PERFORM z_call_rv_delivery_create. " to call fm rv_delivery_create

IF sy-subrc ne 0.

CALL FUNCTION 'APPL_LOG_DISPLAY_INTERN'

EXPORTING

object = 'ZCH_SCL'

subobject = 'DL'

title_list_screen = 'Error Logs'

  • COLUMN_SELECTION = '11112221122 '

  • COLUMN_SELECTION_MSG_JUMP = '1'

  • EXTERNAL_NUMBER_DISPLAY_LENGTH = 20

  • I_S_DISPLAY_PROFILE =

  • IMPORTING

  • NUMBER_OF_PROTOCOLS =

  • EXCEPTIONS

  • OBJECT_NOT_FOUND = 1

  • SUBOBJECT_NOT_FOUND = 2

  • OTHERS = 3

.

...................

thanks,

vartika

3 REPLIES 3

VB09104
Active Participant
0 Kudos

Hi Vartika,

you need to save that log after creating and appending to it.

here is a code to save that log.

****************************************************

  • If log created, save to database

if e_bal_hndl is not initial.

refresh: bal_hndl.

append e_bal_hndl to bal_hndl.

call function 'BAL_DB_SAVE'

exporting

i_client = sy-mandt

  • i_in_update_task = 'X'

i_t_log_handle = bal_hndl

importing

e_new_lognumbers = log_no

exceptions

log_not_found = 1

save_not_allowed = 2

numbering_error = 3

others = 4.

*********************************************

u have to write this code after appending info to Log.

hope this will help.

regards,

vikas

Former Member
0 Kudos

Hi Vikas,

Can you please tell the entire process in detail.

i.e which function module is for creating the logs and appending data to it and to the database and how to display the logs through the ABAP code

As the function module i m using prezsently is not writing data to DB nor displaying the logs.i guess i m using wrong function modules.

Thanks,

vartika

Former Member
0 Kudos

Hi Gupta ,

Cann't use BAPI instead of FM ?