[SAP ABAP] - Convert BAPI Message

FUNCTION YOFM_CONVERT_BAPI_MESSAGE.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  TABLES
*"      RETURN_IN STRUCTURE  BAPIRET2 OPTIONAL
*"      RETURN_OUT STRUCTURE  YST_RETURN OPTIONAL
*"----------------------------------------------------------------------

*  DATA : lv_message(10).
*  LOOP AT return_in.
*    return-type = return_in-type.
*    CONCATENATE return_in-type return_in-number INTO lv_message.
*    MESSAGE  lv_message(return_in-id) WITH return_in-message_v1 return_in-message_v2 return_in-message_v3 return_in-message_v4 INTO return-message_v1.
*    APPEND return.
*  ENDLOOP.

  LOOP AT return_in.
    return_out-type return_in-type.
    CALL FUNCTION 'RPY_MESSAGE_COMPOSE'
      EXPORTING
        language                sy-langu
        message_id              return_in-id
        message_number          return_in-number
        message_var1            return_in-message_v1
        message_var2            return_in-message_v2
        message_var3            return_in-message_v3
        message_var4            return_in-message_v4
      IMPORTING
        message_text            return_out-message_v1
*    TABLES
*      LONGTEXT                =
      EXCEPTIONS
        message_not_found       1
        OTHERS                  2.

    APPEND return_out.
  ENDLOOP.
ENDFUNCTION.



YST_RETURN
 

Comments