Wednesday, 7 June 2017

CAT7 - Transfer to controlling

Enhancement

FM name  K40C_DOCUMENT_CREATE

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Function Module K40C_DOCUMENT_CREATE, End                                                                                                         A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1  ZCOEP_UPDATE_AWART.    "active version

  IF sy-tcode 'CAT7'.
    DATA ls_coep LIKE LINE OF itcoep.
    TYPESBEGIN OF ty_catsdb,
             pernr    TYPE catsdb-pernr,
             awart    TYPE catsdb-awart,
           END OF ty_catsdb.
    DATA gt_catsdb TYPE TABLE OF ty_catsdb,
           gs_catsdb TYPE ty_catsdb.
    DATA lv_index TYPE i.
    CLEAR gt_catsdb[].
    IF itcoep[] IS NOT INITIAL.
      SELECT
            pernr
            awart
            FROM catsdb
            INTO TABLE gt_catsdb
            FOR ALL ENTRIES IN itcoep
            WHERE pernr itcoep-pernr AND
            belnr doc_header-refbn.
    ENDIF.
    IF gt_catsdb[] IS NOT INITIAL.
      lv_index 1.
      LOOP AT itcoep INTO ls_coep.
        READ TABLE gt_catsdb INTO gs_catsdb WITH KEY pernr ls_coep-pernr.
        IF sy-subrc 0.
          ls_coep-awart gs_catsdb-awart.
          MODIFY itcoep FROM ls_coep INDEX lv_index TRANSPORTING awart.
        ENDIF.
        CLEAR ls_coep,gs_catsdb.
        lv_index lv_index + 1.
      ENDLOOP.
    ENDIF.
  ENDIF.

ENDENHANCEMENT.
*$*$-End:   (1)---------------------------------------------------------------------------------$*$*
endfunction.

*---------------------------------------------------------------------*
* History:                                                            *
* --------                                                            *
* CC 08/21/01 AL0K044370 note 428818 ZLENR / BUZEI inconsistent       *
*---------------------------------------------------------------------*

No comments:

Post a Comment