ZMD_MRP_PARAMETERS
3000公司下工厂跑MRP时,如果为外购则通过外挂表取infor record计划交期。
METHOD if_ex_md_mrp_parameters~adjust_material_master_params. TYPES:BEGIN OF ieord, matnr TYPE c LENGTH 18, werks TYPE c LENGTH 4, zeord TYPE n LENGTH 5, vdatu TYPE d, bdatu TYPE d, lifnr TYPE c LENGTH 10, reswk TYPE c LENGTH 4, ekorg TYPE c LENGTH 4, * IGMNG type p length 13 decimals 3, END OF ieord. DATA: it_eord TYPE STANDARD TABLE OF ieord, il_eord TYPE ieord. DATA:output TYPE char40, l_addrstr TYPE ni_nodeaddr. *&add by rainy on 20150604. *&通过ip break. * CALL FUNCTION ‘TH_USER_INFO‘ * IMPORTING * terminal = output * addrstr = l_addrstr. * IF l_addrstr = ‘192.168.0.200‘ . * BREAK-POINT. * ENDIF. break test_13. *&->end add by rainy on 20150604. IF sy-cprog = ‘RMMRP000‘ OR sy-tcode = ‘MD01‘ OR sy-tcode = ‘MD02‘ OR sy-tcode = ‘MD03‘. CLEAR: it_eord, it_eord[], il_eord. * break: pp10. * if IM_MT61D-matnr = ‘22-05-500277-1‘. SELECT matnr werks zeord vdatu bdatu lifnr reswk ekorg INTO CORRESPONDING FIELDS OF TABLE it_eord FROM eord WHERE werks = im_mt61d-werks AND matnr = im_mt61d-matnr. *&->add by rainy on 20150603--- DEVK905062 *& 定义 TYPES:gt_eine TYPE STANDARD TABLE OF eine. DATA: wa_eine TYPE eine. DATA: wa_zextsource TYPE zextsource. *&->end add by rainy on 20150603 LOOP AT it_eord INTO il_eord. IF il_eord-reswk = ‘1000‘. "and sy-datum >= il_eord-VDATU and sy-datum <= il_eord-BDATU. * select single WEBAZ into CH_MT61D_EXT-WEBAZ "袁生确认只在3000工厂维护内外购统一的收货处理时间 * from marc * where werks = ‘1000‘ * and matnr = IM_MT61D-matnr. * if sy-subrc <> 0. * CH_MT61D_EXT-WEBAZ = 0. * endif. *&A1.外挂表zextsource取货源(物料+工厂->采购组+供应商) SELECT SINGLE * INTO wa_zextsource FROM zextsource WHERE matnr EQ im_mt61d-matnr AND werks EQ im_mt61d-werks. *& IF sy-subrc EQ 0. *&A2.通过物料+工厂(‘1000’)+zextsource货源找info record 的计划交货时间 SELECT SINGLE aplfz INTO ch_mt61d_ext-plifz"* INTO CORRESPONDING FIELDS OF wa_eine FROM eine JOIN eina ON eine~infnr EQ eina~infnr WHERE eina~matnr EQ im_mt61d-matnr AND eina~lifnr EQ wa_zextsource-lifnr AND eina~loekz NE ‘X‘ AND eine~werks EQ ‘1000‘ AND eine~ekorg EQ wa_zextsource-ekorg. IF sy-subrc <> 0. ch_mt61d_ext-plifz = 0. ENDIF. ch_changed = ‘X‘. ELSE. * MESSAGE ‘外挂表没有维护‘ im_mt61d-matnr im_mt61d-werks ‘货源信息‘ *&A3.当外挂表没有数据,按照原来逻辑。 SELECT SINGLE aplfz INTO ch_mt61d_ext-plifz FROM eine INNER JOIN eina ON eine~infnr = eina~infnr INNER JOIN eord ON eord~werks = eine~werks AND eord~matnr = eina~matnr AND eord~lifnr = eina~lifnr AND eord~ekorg = eine~ekorg WHERE eord~matnr = im_mt61d-matnr AND eord~werks = ‘1000‘ AND eina~loekz <> ‘X‘. IF sy-subrc <> 0. ch_mt61d_ext-plifz = 0. ENDIF. ch_changed = ‘X‘. ENDIF. *&->start notes by rainy on 20150603. *&->前期逻辑注释 * SELECT SINGLE aplfz INTO ch_mt61d_ext-plifz * FROM eine INNER JOIN eina * ON eine~infnr = eina~infnr * INNER JOIN eord * ON eord~werks = eine~werks * AND eord~matnr = eina~matnr * AND eord~lifnr = eina~lifnr * AND eord~ekorg = eine~ekorg * WHERE eord~matnr = im_mt61d-matnr * AND eord~werks = ‘1000‘ * AND eina~loekz <> ‘X‘. * IF sy-subrc <> 0. * ch_mt61d_ext-plifz = 0. * ENDIF. * ch_changed = ‘X‘. *&->end notes by riany on 20150603. ENDIF. CLEAR il_eord. ENDLOOP. ENDIF. ENDMETHOD.
时间: 2024-10-07 08:59:02