ACC_DOCUMENT 增强

BADI  -- IF_EX_ACC_DOCUMENT~CHANGE

  METHOD if_ex_acc_document~change.

    DATA: wa_extension   TYPE bapiparex,
          ext_value(960) TYPE c,
          wa_accit       TYPE accit,
          l_ref          TYPE REF TO data.

    FIELD-SYMBOLS: <l_struc> TYPE any,
                   <l_field> TYPE any.

    SORT c_extension2 BY structure.

    LOOP AT c_extension2 INTO wa_extension.

      AT NEW structure.
        CREATE DATA l_ref TYPE (wa_extension-structure).
        ASSIGN l_ref->* TO <l_struc>.
      ENDAT.

*      CONCATENATE wa_extension-valuepart1 wa_extension-valuepart2
*                  wa_extension-valuepart3 wa_extension-valuepart4
*             INTO ext_value.

      CALL METHOD cl_abap_container_utilities=>read_container_c
        EXPORTING
          im_container           = wa_extension+30
        IMPORTING
          ex_value               = ext_value
        EXCEPTIONS
          illegal_parameter_type = 1
          OTHERS                 = 2.

      MOVE ext_value TO <l_struc>.

      ASSIGN COMPONENT 'POSNR' OF STRUCTURE <l_struc> TO <l_field>.
      READ TABLE c_accit WITH KEY posnr = <l_field>
            INTO wa_accit.
      IF sy-subrc IS INITIAL.
        MOVE-CORRESPONDING <l_struc> TO wa_accit.
        MODIFY c_accit FROM wa_accit INDEX sy-tabix.
      ENDIF.
    ENDLOOP.


  ENDMETHOD.

 

posted @ 2024-11-21 20:34  Lan_dev  阅读(0)  评论(0编辑  收藏  举报