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: 

how to creat a internal table for sesion log error

Former Member
0 Kudos

Hi, every one

I have to create a itab for session error

log

I want put all error in one itab.

how to creat a internal table for sesion log error

2 REPLIES 2

0 Kudos

use itab of structure BDCMSGCOLL and use that itab in the CALL TRANSACTION[T-CODE] -


MESSAGES INTO [ITAB of Structure BDCSGCOLL].

if useful reward.

Clemenss
Active Contributor
0 Kudos

Hi Sandy,

please have a look at function group SBAL. It is used to store, read, delete and (optional) save mesages permanent in the application log.

For every error, use the MESSAGE command with addition INTO <field>. This will set the SY-MSG.. fields. You can adapt this form fot the transfer of messages to the log:


*&---------------------------------------------------------------------*
*&      Form  log_symsg
*&---------------------------------------------------------------------*
*       append message from system fields to aplication log
*----------------------------------------------------------------------*
form log_symsg  using    pr_sbal type ref to /well/u_cl_sbal.
  data:
    ls_balmsg     type bal_s_msg.

  ls_balmsg-msgid = sy-msgid.
  ls_balmsg-msgno = sy-msgno.
  ls_balmsg-msgty = sy-msgty.
  ls_balmsg-msgv1 = sy-msgv1.
  ls_balmsg-msgv2 = sy-msgv2.
  ls_balmsg-msgv3 = sy-msgv3.
  ls_balmsg-msgv4 = sy-msgv4.

  case sy-msgty.
    when 'E'. ls_balmsg-probclass = '1'.
    when 'S'. ls_balmsg-probclass = '2'.
    when 'W'. ls_balmsg-probclass = '3'.
    when 'I'. ls_balmsg-probclass = '4'.
  endcase." sy-msgty

  call method pr_sbal->msg_add
    exporting
      i_s_msg        = ls_balmsg
    exceptions
      msg_not_stored = 1
      no_handle      = 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.

endform.                    " log_symsg

Note: The "call method pr_sbal->msg_add" can only beused if an appropriate class exists. I created one hiduing the use of FUNCTION 'BAL_LOG_MSG_ADD'.

Regards,

Clemens