多条 Message 处理

FUNCTION send_message_direct.
*"--------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(IT_RETURN) TYPE  BAPIRETTAB OPTIONAL
*"     REFERENCE(IV_SEND_IF_ONE) TYPE  BOOLEAN DEFAULT ABAP_TRUE
*"--------------------------------------------------------------------

  DATA: lt_return  TYPE  bapirettab.

  FIELD-SYMBOLS: <lfs_return> TYPE bapiret2.

    lt_return[] = it_return[].

  CALL FUNCTION 'MESSAGES_INITIALIZE'
    EXPORTING
      reset = abap_true.

  LOOP AT lt_return ASSIGNING <lfs_return>.
    CALL FUNCTION 'MESSAGE_STORE'
      EXPORTING
        arbgb  = <lfs_return>-id
        msgty  = <lfs_return>-type
        msgv1  = <lfs_return>-message_v1
        msgv2  = <lfs_return>-message_v2
        msgv3  = <lfs_return>-message_v3
        msgv4  = <lfs_return>-message_v4
        txtnr  = <lfs_return>-number
      EXCEPTIONS
        OTHERS = 0.
  ENDLOOP.

  CALL FUNCTION 'MESSAGES_SHOW'
    EXPORTING
      send_if_one = iv_send_if_one
      i_use_grid  = abap_true
      show_linno  = abap_false
    EXCEPTIONS
      OTHERS      = 0.

ENDFUNCTION.

你可能感兴趣的:(message)