본문 바로가기
MM/Purchasing

[MM] PO 변경 이력 (CDHDR, CDPOS)

by clode 2024. 7. 10.
728x90
반응형

PO 변경이력

 

OBJECTID : PO Number

TCODE : Transaction code 

TABNAME : Table name

 

  SELECT a~ebeln
         a~ebeln AS objectid
         b~ebelp a~bedat b~werks
         b~matnr b~matkl b~mtart b~txz01
    INTO CORRESPONDING FIELDS OF TABLE gt_po
    FROM ekko AS a
         INNER JOIN ekpo AS b
      ON a~ebeln EQ b~ebeln
   WHERE a~ebeln IN s_ebeln
     AND a~bstyp EQ c_f
     AND a~bsart IN gr_bsart
     AND a~loekz EQ space
     AND b~loekz EQ space
     AND a~bedat IN s_bedat
     AND a~ekorg IN s_ekorg
     AND a~ekgrp IN s_ekgrp
     AND a~lifnr IN s_lifnr
     AND b~werks IN s_werks
     AND b~mtart IN s_mtart
     AND b~matnr IN s_matnr
     AND a~aedat NE space.


* 오더의 변경 번호 데이터
* CDHDR Read
  CLEAR : gt_cdhdr, gt_cdhdr[].
  SELECT objectclas objectid changenr username
         udate utime tcode planchngnr act_chngno
         was_plannd change_ind langu version
    INTO CORRESPONDING FIELDS OF TABLE gt_cdhdr
    FROM cdhdr
     FOR ALL ENTRIES IN gt_po
   WHERE objectclas EQ c_einkbeleg
     AND objectid   EQ gt_po-objectid
     AND change_ind EQ c_u.

  IF gt_cdhdr[] IS NOT INITIAL.

    SELECT objectclas objectid changenr tabname tabkey
           fname chngind text_case unit_old unit_new
           cuky_old cuky_new value_new value_old
      INTO CORRESPONDING FIELDS OF TABLE gt_cdpos
      FROM cdpos
       FOR ALL ENTRIES IN gt_cdhdr
     WHERE objectclas EQ gt_cdhdr-objectclas
       AND objectid EQ gt_cdhdr-objectid
       AND changenr EQ gt_cdhdr-changenr
       AND tabname  IN ('EKPO', 'EKET')
       AND chngind  EQ c_u.

    CLEAR : gt_name, gt_name[].
    SELECT a~bname b~name_first b~name_last
      INTO CORRESPONDING FIELDS OF TABLE gt_name
      FROM usr21 AS a
           INNER JOIN adrp AS b
        ON a~persnumber EQ b~persnumber
       FOR ALL ENTRIES IN gt_cdhdr
     WHERE a~bname EQ gt_cdhdr-username.
728x90
반응형

댓글