SAP|【测试】工艺路线展开Function

在开发的时候会碰到有批量展示C203主配方清单的需求,正常我们做一般离散制造行业工艺路线清单的时候只要通过以下几个表的相互链接就可以直接取数。

  1. MAPL - 分配任务清单到物料
  2. PLKO - 任务清单 - 表头
  3. PLAS - 任务清单 - 工序/作业选择
  4. PLPO - 任务清单 - 工序/作业
  5. CRHD - 工作中心表头
示例代码:
SELECT A~WERKS A~MATNR A~PLNTY A~PLNNR A~PLNAL A~DATUV B~KTEXT D~BMSCH D~MEINH D~LAR01 D~VGE01 D~VGW01 D~LAR02 D~VGE02 D~VGW02 D~LAR03 D~VGE03 D~VGW03 D~LAR04 D~VGE04 D~VGW04 D~LAR05 D~VGE05 D~VGW05 D~LAR06 D~VGE06 D~VGW06 D~PLNKN D~DATUV AS DATUV_P E~NAME1 F~MAKTX G~ARBPL H~KTEXT AS ARBPL_KTEXTFROM MAPL AS AINNER JOIN PLKO AS B ON A~PLNTY = B~PLNTY AND A~PLNNR = B~PLNNR AND A~PLNAL = B~PLNALINNER JOIN PLAS AS C ON A~PLNTY = C~PLNTY AND A~PLNNR = C~PLNNR AND A~PLNAL = C~PLNALINNER JOIN PLPO AS D ON D~PLNTY = C~PLNTY AND D~PLNNR = C~PLNNR AND D~PLNKN = C~PLNKNINNER JOIN T001W AS E ON A~WERKS = E~WERKSINNER JOIN MAKT AS F ON A~MATNR = F~MATNRINNER JOIN CRHD AS G ON D~ARBID = G~OBJIDINNER JOIN CRTX AS H ON G~OBJID = H~OBJIDINNER JOIN MARA AS I ON A~MATNR = I~MATNR INNER JOIN MARC AS J ON A~WERKS = J~WERKS AND A~MATNR = J~MATNRINTO CORRESPONDING FIELDS OF TABLE GT_ROUTING_LISTWHERE A~WERKS IN S_WERKS AND A~MATNR IN S_MATNR AND A~LOEKZ = ' ' AND B~LOEKZ = ' ' AND C~LOEKZ = ' ' AND D~LOEKZ = ' ' AND A~PLNTY IN S_PLNTY AND F~SPRAS = SY-LANGU AND H~SPRAS = SY-LANGU AND I~MTART IN S_MTART AND J~DISPO IN S_DISPO.

但是流程制造行业则不然,通常他们的主配方是类似下图所示的:
SAP|【测试】工艺路线展开Function
文章图片

查看PLPO表 有的工作中心(也就是这里所说的资源)会不显示,给开发造成了一些困扰,具体业务我也不清楚,熟悉流程制造行业的朋友可以留言告知。
SAP|【测试】工艺路线展开Function
文章图片

这里用到一个比较好用的函数:CP_EX_PLAN_READ
CALL FUNCTION 'CP_EX_PLAN_READ' EXPORTING CMODE_IMP= 'R' PLNTY_IMP= GT_TAB-PLNTY PLNNR_IMP= GT_TAB-PLNNR PLNAL_IMP= GT_TAB-ALNAL STTAG_IMP= SY-DATUM *CHECK_IMP= 'X' *CUOBJ_IMP= *PARNT_IMP= ' ' *FCAPO_IMP= ' ' *TCA11_IMP= ' ' *FLG_VAL_REC_IMP= ' ' *STLNR_IMP= *I_PLAS_KEY_TAB= *PRODCOST= ' ' *I_BUSINESS_OBJECT= *I_FLG_CHARACTERISTICS_PLANNING= ' ' *I_EDGNO= *VBELN_IMP= ' ' *POSNR_IMP= 0 *LOSGR_IMP= 1 *I_PLANT= *I_FLG_CALLED_F_MRP= ' ' *IMPORTING *RES_APPR_CHK_EXP= *ERROR_EXP= *E_MAPL= *PI_SET_USED= TABLES *MLST_EXP= *PLAB_EXP= *PLAS_EXP= *PLFH_EXP= *PLFL_EXP= *PLFT_EXP= *PLFV_EXP= PLKO_EXP= LT_PLKO_EXP *PLMZ_EXP= PLPO_EXP= LT_PLPO_EXP *PLTX_EXP= *AENNR_EXP= *PLMK_EXP= *PLMW_EXP= EXCEPTIONS NOT_FOUND= 1 PLNAL_INITIAL = 2 OTHERS= 3. IF SY-SUBRC <> 0. ENDIF.

只要输入以下参数即可:
  • PLNTY - 任务清单类型(类型“2”)
  • PLNNR -任务清单组码
  • PLNAL - 组计数器
  • STTAG - 生效日期(当前日期)
特别需要注意的是“PLNAL”(组计数器)字段,需要加入前导零,不然函数是取不到值的。
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING INPUT= GT_TAB-ALNAL IMPORTING OUTPUT = GT_TAB-ALNAL.

SAP|【测试】工艺路线展开Function
文章图片

SAP|【测试】工艺路线展开Function
文章图片


仅此记录,别无他用,请CSDN管理员不要删除我的博文了,谢谢了。
SAP|【测试】工艺路线展开Function
文章图片

【SAP|【测试】工艺路线展开Function】

    推荐阅读