‎2006 Nov 03 1:51 PM
Hi Guys,
I am working on documentation of a BAPI used SAP insurance module. Now I want to see all the error messages associated/ handled in that BAPI. How can I do that ? Is there a table in data dictionary where I can see error messages handled by a given Function module/ BAPI?
Any inputs will be highly appreciated.
Thanks.
Regards,
Tushar.
‎2006 Nov 03 2:08 PM
‎2006 Nov 03 2:14 PM
Hi,
If a BAPI Module has a Return Structure or Return Table, the connector checks for the message types A (abort) and E (error) to determine if the service call request processed successfully. A message type A or E indicates that the service call request failed to process. If a BAPI does not have a Return Structure or Return Table, you must implement your own error handling
Your bapi will return the error messages if you have a structure and capture the messages in a table. The message table should have the structure BAPIRET2.
Eg:
data: gi_return TYPE STANDARD TABLE OF bapiret2.
Call the BAPI function
CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
EXPORTING
documentheader = g_docheader
IMPORTING
OBJ_TYPE =
OBJ_KEY =
OBJ_SYS =
TABLES
accountgl = gi_accountgl
currencyamount = gi_amount
return = gi_return
EXTENSION1 =
Regards,
Sookshma
‎2006 Nov 03 3:02 PM
You can narrow it down a bit. Go to SE37 and enter the name of your BAPI. Then:
GOto -> Main program.
Double click on the top include. That will take you to the ABAP editor. Double click on the message-id used by the program. This will take you to the messages for the function group.
The BAPI can use messages from other message classes and not all messages in this class may be used by your BAPI, but it should be a start.
Rob
‎2006 Nov 04 9:46 AM
Hi,
here´s one possible solution:
CALL FUNCTION 'MESSAGES_INITIALIZE'.
LOOP AT it_return_bapi.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = it_return_bapi-id
exception_if_not_active = ' '
msgty = it_return_bapi-type
msgv1 = it_return_bapi-message_v1
msgv2 = it_return_bapi-message_v2
msgv3 = it_return_bapi-message_v3
msgv4 = it_return_bapi-message_v4
txtnr = it_return_bapi-number
zeile = ' '
EXCEPTIONS
message_type_not_valid = 1
not_active = 2
OTHERS = 3.
ENDLOOP.
CALL FUNCTION 'MESSAGES_STOP'
EXCEPTIONS
a_message = 04
e_message = 03
i_message = 02
w_message = 01.
IF NOT sy-subrc IS INITIAL.
CALL FUNCTION 'MESSAGES_SHOW'
EXPORTING
i_use_grid = 'X'
i_amodal_window = i_amodal_window
EXCEPTIONS
inconsistent_range = 1
no_messages = 2
OTHERS = 3.
ENDIF.
ENDFUNCTION.
Best regards