Friday, June 12, 2020

Handling error messages return from bapi return parameter use FM :Format Message

I was getting error as  its displaying E VL 363 00000.


the easiest solution was to read the return table and pass to FM : Format_Message

READ TABLE gt_doretn INTO lw_doretn WITH KEY type 'E'.
IF sy-subrc 0.
  DATAl_msg_str(100).
  CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
      id        LW_DORETN-id
      lang      sy-langu
      no        LW_DORETN-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.
  MESSAGE L_MSG_STR TYPE 'E'.

ELSE.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait 'X'.
ENDIF.