05-09-2011 5:13 PM
Hi All..,
I am calling Bapi if its successfull ok . some times if it returns error messages those will be stored in return parameter type bapiret2.
if i want to display the message i am looping it and printing wa-type,wa-id,wa-msg_log_no,wa-message_v1,wa-message etc..
but its displyaing only error type(E) and id(IO/VL) msg_log_no(229/213) something like that.. but i want the description of that error type which is stored in table T100. how can achieve..???
ex: E 213 contains serial no already assigned..
i tried like this.....
loop at it_return into wa_return.
write:/ wa_return-type,wa_return-id,wa_return-msg_log_no,wa_return-message.
endloop.
its displaying E IO 229 00000.
i can check the same in se91 by giving id IO and number 229 .. which is stored in table T100.. the same i want to display through the program..
Please help.......
Thanks
Anand
05-09-2011 5:17 PM
Try FM FORMAT_MESSAGE.
DATA: l_msg_str(100).
loop at it_return into wa_return.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_return-id
lang = sy-langu
no = wa_return-number
v1 = message_v1
v2 = message_v2
v3 = message_v3
v4 = message_v4
IMPORTING
msg = l_msg_str " Message text
EXCEPTIONS
not_found = 1
OTHERS = 2.
endloop.
05-09-2011 5:17 PM
Try FM FORMAT_MESSAGE.
DATA: l_msg_str(100).
loop at it_return into wa_return.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_return-id
lang = sy-langu
no = wa_return-number
v1 = message_v1
v2 = message_v2
v3 = message_v3
v4 = message_v4
IMPORTING
msg = l_msg_str " Message text
EXCEPTIONS
not_found = 1
OTHERS = 2.
endloop.
05-09-2011 5:21 PM
i tried Formate_message.. but the result is same...like my write statement from it_return loop
its not getting the message from the table T100
05-09-2011 5:24 PM
Have u passed right parameters to the FM. Better paste ur code.
Have you tried like below code.
DATA: l_msg_str(100).
loop at it_return into wa_return.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_return-id
lang = sy-langu
no = wa_return-number
v1 = wa_return-message_v1
v2 = wa_return-message_v2
v3 = wa_return-message_v3
v4 = wa_return-message_v4
IMPORTING
msg = l_msg_str " Message text
EXCEPTIONS
not_found = 1
OTHERS = 2.
write:/ l_msg_str.
endloop.
05-09-2011 5:36 PM
Hi thank you for helping..
i passed correctly even i checked in debugging mode those parameters doesn't contain any data....
any other FM?
05-09-2011 5:39 PM
05-09-2011 5:54 PM
Never mind. SAPFAN is on it.
Edited by: Sampath Kumar on May 9, 2011 10:54 AM
05-09-2011 6:11 PM
ok fine..
dont mind..
Did you got my point.. i want to get the message from standard message table T100 based on error number from bapi return parameter. because bapi return internal table doesn't have message test nothing..it just showing empty all the message variables..
05-09-2011 9:19 PM
Alright here is more details
Following BAPI can be used to get the message for any message id, Message no and/or for message variables that comes from BAPI in the form of BAPIRET2 structure or in fact any form as long as you have the Message ID/no and language.
For example:
call function 'BAPI_MESSAGE_GETDETAIL'
exporting
id = msgid
number = msgno
language = sy-langu
textformat = 'NON'
message_v1 = msgv1
message_v2 = msgv2
message_v3 = msgv3
message_v4 = msgv4
importing
message = message
return = wa_return.
What the above BAPI does is simple. for example, if you get just message id(V0) and number(010) in IT_BAPIRET2 - (Obviously, you should loop the internal table to work area) - BAPI selects message text from message class V0 and number 001 and gives you the formatted message (System: More than 9 windows open: system limit reached) . You can see the same in SE91 .
If you get any message variables in IT_BAPIRET2 for example ID(Message class) = V0 and number 040 and MSGV1 = 'xxxx' and MSGV2 = '8'
Then the same bapi would return the message Data backup table 'XXXX' with RC= 8
This is as simple as selecting messages from error table T100 for Language/application area (message class/id) and message number but the only difference is the bapi formats the data based on message variable and you dont need to code it.
If you dont see any data in IT_BAPIRET2 then that is fine.
05-15-2011 12:17 PM
05-10-2011 8:21 PM
Usually I had no problem using MESSAGE field in the BAPI return table. Are you saying this field is not getting populated? Strange...