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: 

Message tracing from an Internal Table

former_member190178
Participant
0 Kudos

Hi Experts,

I am using a BAPI which is giving me a return Internal table back loaded with the success, error and the warning messages. I would like to show those on my screen.

Can anyone tell me how to do it?.

Regards,

-=Soniya=-

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You can simply write those msgs on screen after BAPI execution.

e.g. write 😕 t_return-message.

Or

You can create ALV report.

Regards,

Aparna

4 REPLIES 4

Former Member
0 Kudos

You can simply write those msgs on screen after BAPI execution.

e.g. write 😕 t_return-message.

Or

You can create ALV report.

Regards,

Aparna

Former Member
0 Kudos

Hi

Put the foll code:

Loop at it_ret into wa_ret.

write: / wa_ret-message. " you can add more fields also If u want.

Endloop.

Regards,

Vishwa.

Former Member
0 Kudos

Hi Soniya,

With this function, you can to get the message text.

CALL FUNCTION 'FORMAT_MESSAGE'
 EXPORTING
   ID              = MSGID
   LANG            = SY-LANGU
   NO              = MSGNO
   V1              = MSGV1
   V2              = MSGV2
   V3              = MSGV3
   V4              = MSGV4
 IMPORTING
   MSG             = V_MSG
 EXCEPTIONS
   NOT_FOUND       = 1
   OTHERS          = 2
          .
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Here, V_MSG has a length of 200 & is a character type variable.

Regards,

R.Nagarajan.

-


We can -


Former Member
0 Kudos

Hi,

We can show all mesages returned from BAPI in END-OF-SELECTION event.

Plz try this way:



*Internal table to hold messages from BAPI call
 DATA:  RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'BAPI_PO_CREATE1'
  EXPORTING
    POHEADER                     = HEADER
    POHEADERX                    = HEADERX
*   POADDRVENDOR                 =
*   TESTRUN                      =
* IMPORTING
*   EXPPURCHASEORDER             =
*   EXPHEADER                    =
*   EXPPOEXPIMPHEADER            =
 TABLES
   RETURN                       = RETURN
   POITEM                       = ITEM
   POITEMX                      = ITEMX.

*&---------------------------------------------------------------------*
*Confirm the document creation by calling database COMMIT
*&---------------------------------------------------------------------*
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
 EXPORTING
   WAIT          = 'X'
* IMPORTING
*   RETURN        =
          .

END-OF-SELECTION.
*&---------------------------------------------------------------------*
*Output the messages returned from BAPI call
*&---------------------------------------------------------------------*
LOOP AT RETURN.
 WRITE / RETURN-MESSAGE.
ENDLOOP.

this will write data to screen.

thanx.

Edited by: Dhanashri Pawar on Oct 6, 2008 8:46 AM