T-CODE : MD04 에서 실행 시켰을 때
계획이 변경 되어 Rescheduling Date 에 변경 된 날짜가 들어 갑니다. Rescheduling Date 값을 찾기 위해 어떤 TABLE 을 이용해서 구해야 하는지에 대해 도움을 받고자 합니다.
MD04 를 디버깅 해보니 어떤 TABLE 에 딱 들어가 있지는 않는 거 같구요. 어떠한 값을 이용하여 로직으로 구해야 하는거 같은데 어떻게 구성해야 할 지 막막합니다.
현업 요구 사항 : 생산 계획 변동이 심해서 3일 확정을 하기 힘들어 당장 내일 계획이 바뀔 수 있기 때문에 구매오더에 Deliverty Date를 Rescheduling Date로 업데이트 요청 하여 업체에 알려 주기를 바랍니다.
댓글 4
-
정군
2009.07.07 03:15
-
노름마치
2009.07.07 03:31
* MRP element를 보고 대상이무엇인지 파악해야 하겠네요.
* MRP element(EN) MRP element(KO)
* -------------------------------
* REQUIRED
* (VC)CusOrd VC_고객오더
* (VJ)Delvry VJ_일반납품
* (VI)FOCDly VI_무상납품
* (PP)IndReq PP_독립소요
* (SB)DepReq SB_계획오더
* (AR)OrdRes AR_생산오더
* (MR)MtlRes MR_수동예약
* (BB)SubReq BB_외주요청
* (RP)Return RP_업체반품
* (UL)StTRes UL_재고이전
* (U1)Ord.DS U1_운송오더
* (U2)PRqRel U2_재고이전
* (SH)SafeSt SH_안전재고
*
* OPEN ORDER
* (PA)PldOrd PA_계획오더
* (BA)PurRqs BA_구매요청
* (BE)POitem BE_구매오더
* (FE)PrdOrd FE_생산오더
* (LA)ShpgNt LA_구매납품
* (UR)TrnRes UR_재고이전
*
* STOCK
* (QM)QM-lot QM_검사재고
* (KB)CustSt KB_오더재고
* (LK)SubcSt LK_업체재고
* (WB)Stock WB_창고재고
* (LB)SLocSt LB_MRP제외재고 <- 제외
* 아래는 실행해 보면 알거에요.
REPORT y_md_stockrequirement_list.
*&---------------------------------------------------------------------*
*& TABLE 선언
*&---------------------------------------------------------------------*
TABLES : marc,
mara.
TYPE-POOLS: slis, kkblo.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA: ls_layout TYPE slis_layout_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
DATA: l_title TYPE sy-title.
DATA: ls_selfield TYPE slis_selfield.
*&---------------------------------------------------------------------*
*& 내부테이블 선언
*&---------------------------------------------------------------------*
DATA : lt_mdez LIKE mdez OCCURS 0 WITH HEADER LINE.
DATA : lt_mt61d TYPE mt61d.
DATA : BEGIN OF it_mdez OCCURS 0.
INCLUDE STRUCTURE mdez.
DATA : matnr LIKE marc-matnr,
werks LIKE marc-werks,
mtart LIKE mara-mtart,
maktx LIKE makt-maktx.
DATA : END OF it_mdez.
DATA : BEGIN OF it_mat OCCURS 0,
werks LIKE marc-werks,
matnr LIKE marc-matnr,
END OF it_mat.
*&---------------------------------------------------------------------*
*& SELECTION-SCREEN 정의
*&---------------------------------------------------------------------*
SELECTION-SCREEN SKIP.
SELECT-OPTIONS s_werks FOR marc-werks MODIF ID wrk.
SELECT-OPTIONS s_matnr FOR marc-matnr MODIF ID mat.
SELECTION-SCREEN SKIP.
SELECT-OPTIONS s_mtart FOR mara-mtart.
SELECT-OPTIONS s_dismm FOR marc-dismm.
SELECT-OPTIONS s_dispo FOR marc-dispo.
SELECT-OPTIONS s_disls FOR marc-disls.
SELECT-OPTIONS s_ekgrp FOR marc-ekgrp.
SELECTION-SCREEN SKIP.
SELECT-OPTIONS s_dat00 FOR it_mdez-dat00.
SELECT-OPTIONS s_delkz FOR it_mdez-delkz.
*&---------------------------------------------------------------------*
*& START-OF-SELECTION
*&---------------------------------------------------------------------*
START-OF-SELECTION.
CLEAR it_mat.
REFRESH it_mat.
SELECT marc~werks AS werks
marc~matnr AS matnr
INTO CORRESPONDING FIELDS OF TABLE it_mat
FROM marc
JOIN mara
ON marc~matnr = mara~matnr
WHERE marc~werks IN s_werks
AND marc~matnr IN s_matnr
AND marc~dismm IN s_dismm
AND marc~dispo IN s_dispo
AND marc~disls IN s_disls
AND marc~ekgrp IN s_ekgrp
AND mara~mtart IN s_mtart
AND mara~lvorm = ''
AND marc~lvorm = ''
GROUP BY marc~werks
marc~matnr.
IF it_mat[] IS INITIAL.
MESSAGE i899(mm) WITH 'Data not found!'.
EXIT.
ENDIF.
SORT it_mat BY werks matnr.
CLEAR it_mdez.
REFRESH it_mdez.
LOOP AT it_mat.
CLEAR lt_mdez.
REFRESH lt_mdez.
CLEAR lt_mt61d.
CALL FUNCTION 'MD_STOCK_REQUIREMENTS_LIST_API'
EXPORTING
matnr = it_mat-matnr
werks = it_mat-werks
IMPORTING
e_mt61d = lt_mt61d
TABLES
mdezx = lt_mdez.
CHECK NOT lt_mdez[] IS INITIAL.
DELETE lt_mdez WHERE dat00 NOT IN s_dat00.
DELETE lt_mdez WHERE delkz NOT IN s_delkz.
LOOP AT lt_mdez.
MOVE-CORRESPONDING lt_mdez TO it_mdez.
it_mdez-matnr = it_mat-matnr.
it_mdez-werks = it_mat-werks.
it_mdez-maktx = lt_mt61d-maktx.
it_mdez-mtart = lt_mt61d-mtart.
APPEND it_mdez.
CLEAR it_mdez.
ENDLOOP.
ENDLOOP.
IF it_mdez[] IS INITIAL.
MESSAGE i000(zmle) WITH 'Data not found'.
EXIT.
ENDIF.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-seltext_l = 'Matl.Code'.
ls_fieldcat-outputlen = 12.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'MAKTX'.
ls_fieldcat-seltext_l = 'Matl.Desc.'.
ls_fieldcat-outputlen = 25.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'MTART'.
ls_fieldcat-seltext_l = 'Matl.Type'.
ls_fieldcat-outputlen = 8.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'WERKS'.
ls_fieldcat-seltext_l = 'Plant'.
ls_fieldcat-outputlen = 6.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'PLUMI'.
ls_fieldcat-seltext_l = 'Receipt/issue ind.'.
ls_fieldcat-outputlen = 8.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'DAT00'.
ls_fieldcat-seltext_l = 'Receipt/Requirements date'.
ls_fieldcat-outputlen = 10.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'DELKZ'.
ls_fieldcat-seltext_l = 'MRP Element'.
ls_fieldcat-outputlen = 8.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'DELB0'.
ls_fieldcat-seltext_l = 'Abbreviation for MRP element'.
ls_fieldcat-outputlen = 8.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'EXTRA'.
ls_fieldcat-seltext_l = 'MRP element data'.
ls_fieldcat-outputlen = 30.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'MNG01'.
ls_fieldcat-seltext_l = 'Quantity received or required'.
ls_fieldcat-outputlen = 15.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'MNG02'.
ls_fieldcat-seltext_l = 'Available quantity'.
ls_fieldcat-outputlen = 15.
APPEND ls_fieldcat TO lt_fieldcat.
l_title = 'MD04-STOCK/REQUIREMENT LIST'.
ls_layout-window_titlebar = 'MD04-STOCK/REQUIREMENT LIST'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
is_layout = ls_layout
i_callback_program = sy-repid
it_fieldcat = lt_fieldcat[]
TABLES
t_outtab = it_mdez. -
정군
2009.07.07 18:06
흠.. SR list 펑션을 드려야 하는데 MRP list 펑션을 올렸었나 보네요;;
노름마치님 펑션을 사용하면 맞을 것 같습니다.
-
mm_dsshin
2009.07.09 00:46
정군님, 노름마치님 답변 감사 드립니다. 해당 함수를 확인 해 보니 md04를 표현해 주는 함수가 맞네요 ^^
그 함수를 이용해서 현업의 요구사항을 들어 줄 수 있을 듯합니다. 감사합니다.
MD04는 프로그램을 실행할 때 들어가는 것이라서, 어디 테이블에 데이터가 들어가는게 아닙니다.
MD05와는 다릅니다.
MD_MRP_LIST_API
를 참조로 해보세요.