‎2008 Aug 12 6:46 AM
In BAPI even after collecting of return parameters and looping into 'FORMAT_MESSAGE' i am not able to get the success messages in the outpot?
can any one give me how to do this ?
‎2008 Aug 12 6:56 AM
Hi Krishna,
Are you sure you are getting sucess messages form BAPI, If you got message then it will diffinitely store in BApi return table .Read the table with message type as S and Send that to Format_message .Here is the sample code for using ffunction module FORMAT_MESSAGE.
LOOP AT MESSTAB.
MOVE-CORRESPONDING MESSTAB TO MESSAGES.
MESSAGES-PLNUM = PLAN-PLNUM.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = MESSTAB-MSGID
LANG = MESSTAB-MSGSPRA
NO = MESSTAB-MSGNR
V1 = MESSTAB-MSGV1
V2 = MESSTAB-MSGV2
V3 = MESSTAB-MSGV3
V4 = MESSTAB-MSGV4
IMPORTING
MSG = MESSAGES-TEXT.
APPEND MESSAGES.
ENDLOOP.
‎2008 Aug 12 6:56 AM
Hi Krishna,
Are you sure you are getting sucess messages form BAPI, If you got message then it will diffinitely store in BApi return table .Read the table with message type as S and Send that to Format_message .Here is the sample code for using ffunction module FORMAT_MESSAGE.
LOOP AT MESSTAB.
MOVE-CORRESPONDING MESSTAB TO MESSAGES.
MESSAGES-PLNUM = PLAN-PLNUM.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = MESSTAB-MSGID
LANG = MESSTAB-MSGSPRA
NO = MESSTAB-MSGNR
V1 = MESSTAB-MSGV1
V2 = MESSTAB-MSGV2
V3 = MESSTAB-MSGV3
V4 = MESSTAB-MSGV4
IMPORTING
MSG = MESSAGES-TEXT.
APPEND MESSAGES.
ENDLOOP.
‎2008 Aug 12 7:10 AM
Hello Krishna
Regarding the messages returned by BAPIs you can only be sure that if an error occurred you will receive an error message (of type A(bort), E(error) or X(dump)).
However, in case of a successful BAPI call you may get a S(uccess) message or not. Some BAPIs do not return anything if they succeeded.
Thus, I usually evaluate the result of a BAPI call like this:
" Call BAPI, messages are returned as TABLES parameter RETURN and stored in itab LT_RETURN:
LOOP AT lt_return TRANSPORTING NO FIELDS
WHERE ( type CA 'AEX' ).
EXIT.
ENDLOOP.
" BAPI failed
IF ( syst-subrc = 0 ).
" BAPI succeeded
ELSE.
ENDIF.
Regards
Uwe
‎2008 Aug 13 5:16 AM
Hi,
Every BAPI is having the return table with the name of (RETURN) to handle error messages.. it refers the structure BAPIRET2 structure..
this are the main fields in structure BAPIRET2..
TYPE Message type
ID Message Class
MESSAGE Message Text
MESSAGE_V1 Message Variable
MESSAGE_V2 Message Variable
MESSAGE_V3 Message Variable
MESSAGE_V4 Message Variable
PARAMETER Parameter Name
base on TYPE field u can find where the message is error / successed one...
hope helpful
Raghunath.S
‎2008 Aug 17 2:41 PM