使用する
このレポートは、サービスBAPI BapiService.MessageGetDetail()を使用して、エラーメッセージの短いテキストと長いテキストを表示します。
*------------------------------------------------------------------------** read a message short and longtext using the BAPI ** BAPI_MESSAGE_GETDETAIL of the object BapiService. **------------------------------------------------------------------------** Datendeklaration DATA : MY_ID LIKE BAPIRET2-ID, MY_NUMBER LIKE BAPIRET2-NUMBER, MY_TEXTFORMAT LIKE BAPITGA-TEXTFORMAT, MY_MESSAGE_V1 LIKE BAPIRET2-MESSAGE_V1, MY_MESSAGE LIKE BAPIRET2-MESSAGE, MY_RETURN TYPE BAPIRET2.DATA BEGIN OF MY_TEXT OCCURS 1. INCLUDE STRUCTURE BAPITGB.DATA END OF MY_TEXT.* Objekt mit Werten füllenMOVE 'FI' TO MY_ID. "message id of message to readMOVE '024' TO MY_NUMBER. "message number of message to readMOVE 'ASC' TO MY_TEXTFORMAT. "text format, here ASCIIMOVE '0001' TO MY_MESSAGE_V1. "text to fill into message* Aufruf des BAPIsCALL FUNCTION 'BAPI_MESSAGE_GETDETAIL' EXPORTING ID = MY_ID NUMBER = MY_NUMBER* LANGUAGE = SY-LANGU TEXTFORMAT = MY_TEXTFORMAT MESSAGE_V1 = MY_MESSAGE_V1* MESSAGE_V2 =* MESSAGE_V3 =* MESSAGE_V4 = IMPORTING MESSAGE = MY_MESSAGE RETURN = MY_RETURN TABLES TEXT = MY_TEXT .* Ausdrucken der Ergebnisse WRITE : / 'Input' COLOR 5.WRITE : / 'my_id...........:', MY_ID.WRITE : / 'my_number.......:', MY_NUMBER.WRITE : / 'my_textformat...:', MY_TEXTFORMAT.WRITE : / 'my_message_v1...:', MY_MESSAGE_V1.WRITE : / 'Output' COLOR 5.WRITE : / 'my_message........:', MY_MESSAGE.WRITE : / 'my_return.........:', MY_RETURN.WRITE : / 'Text output' COLOR 5.LOOP AT MY_TEXT. WRITE : / MY_TEXT.ENDLOOP.