‎2006 Dec 18 12:15 PM
I have a problem when I want to call de BAPI 'BAPI_MESSAGE_GETDETAIL'.
I have a table it_idoc with the necesary fields for the bapi. but I want to put the result of the bapi in the field i_idoc - message for every case in the it_idoc.
I don't have any idea how I can write the message on the field idoc-message.
thanks..
loop at it_idoc.
read table it_bapi with key docnum = it_idoc-docnum.
move-corresponding it_bapi to it_idoc.
modify it_idoc.
CALL FUNCTION 'BAPI_MESSAGE_GETDETAIL' destination 'NONE'
EXPORTING
ID = it_idoc-stamid
NUMBER = it_idoc-stamno
LANGUAGE = SY-LANGU
TEXTFORMAT = 'ASC'
LINKPATTERN =
MESSAGE_V1 = it_idoc-stapa1
MESSAGE_V2 = it_idoc-stapa2
MESSAGE_V3 = it_idoc-stapa3
MESSAGE_V4 = it_idoc-stapa4
IMPORTING
MESSAGE =
RETURN = ?????????
TABLES
TEXT =
modify it_idoc.
endloop.
‎2006 Dec 18 12:34 PM
Hello
The BAPI returns the message in its entirety in parameter <b>MESSAGE</b> (220 Char). The long text, if available, is return line by line in the TABLES parameter <b>TEXT</b>.
Parameter <b>RETURN</b> puts the individual parts of the message together in the standard structure BAPIRET2 (Note: RETURN-MESSAGE = MESSAGE parameter).
DATA:
ld_idx TYPE i,
ld_msg TYPE bapi_msg,
ls_idoc LIKE LINE OF it_idoc.
LOOP AT it_idoc INTO ls_idoc.
ld_idx = syst-tabix.
* Call the BAPI
ALL FUNCTION 'BAPI_MESSAGE_GETDETAIL'
EXPORTING
ID = ls_doc-stamid
NUMBER = ls_idoc-stamno
* LANGUAGE = SY-LANGU
TEXTFORMAT = 'ASC'
* LINKPATTERN =
MESSAGE_V1 = ls_idoc-stapa1
MESSAGE_V2 = ls_idoc-stapa2
MESSAGE_V3 = ls_idoc-stapa3
MESSAGE_V4 = ls_idoc-stapa4
IMPORTING
MESSAGE = ld_msg.
ls_idoc-message = ld_msg. " if types are not compatible
MODIFY it_idoc FROM ls_idoc INDEX ld_idx
TRANSPORTING message.
ENDLOOP.Regards
Uwe
‎2006 Dec 18 12:34 PM
Hello
The BAPI returns the message in its entirety in parameter <b>MESSAGE</b> (220 Char). The long text, if available, is return line by line in the TABLES parameter <b>TEXT</b>.
Parameter <b>RETURN</b> puts the individual parts of the message together in the standard structure BAPIRET2 (Note: RETURN-MESSAGE = MESSAGE parameter).
DATA:
ld_idx TYPE i,
ld_msg TYPE bapi_msg,
ls_idoc LIKE LINE OF it_idoc.
LOOP AT it_idoc INTO ls_idoc.
ld_idx = syst-tabix.
* Call the BAPI
ALL FUNCTION 'BAPI_MESSAGE_GETDETAIL'
EXPORTING
ID = ls_doc-stamid
NUMBER = ls_idoc-stamno
* LANGUAGE = SY-LANGU
TEXTFORMAT = 'ASC'
* LINKPATTERN =
MESSAGE_V1 = ls_idoc-stapa1
MESSAGE_V2 = ls_idoc-stapa2
MESSAGE_V3 = ls_idoc-stapa3
MESSAGE_V4 = ls_idoc-stapa4
IMPORTING
MESSAGE = ld_msg.
ls_idoc-message = ld_msg. " if types are not compatible
MODIFY it_idoc FROM ls_idoc INDEX ld_idx
TRANSPORTING message.
ENDLOOP.Regards
Uwe