你好,请问关于工艺路线分料到N多工序,有没有批导程序呀!
发布网友
发布时间:2022-04-30 03:27
我来回答
共2个回答
懂视网
时间:2022-04-30 07:49
工藝路線SQL
标签:
热心网友
时间:2022-04-30 04:57
工艺路线的组件分配是在CA02种用BDC来进行的;
其实在创建工艺路线的时候,BAPI_ROUTING_CREATE这个BAPI本身就可以进行组件分配,当然如果已经在存在了,那么就用BDC吧! 下面是一部分代码,你可以适当修改。
"""调用BDC进行组件分配
""""
"______首先需要展开BOM
data: begin of WT_ITAB occurs 10,
MATNR like MARA-MATNR, "父件物料编码
POSNR LIKE STPOB-POSNR, "项目号
STLNR LIKE STPOB-STLNR, "00214339
IDNRK like MARA-MATNR, "子件物料编码
OJTXP like MAKT-MAKTX, "子件物料描述
MEINS like MARA-MEINS. "子件计量单位
data: end of WT_ITAB.
"------查询行号的内表
DATA : BEGIN OF IT_COLUM OCCURS 0,
VORNR LIKE RCM01-VORNR,
POSNR LIKE STPOB-POSNR, "项目号
STLNR LIKE STPOB-STLNR."00214339
" COLUM TYPE I.
data: end of IT_COLUM.
"给IT_COLUM赋予前三个值
LOOP AT COMPONENTALLOCATION.
CLEAR IT_COLUM.
IT_COLUM-VORNR = COMPONENTALLOCATION-ACTIVITY.
IT_COLUM-POSNR = COMPONENTALLOCATION-ITEM_NO.
IT_COLUM-STLNR = COMPONENTALLOCATION-BOM_NO.
APPEND IT_COLUM.
ENDLOOP.
READ TABLE MATERIALTASKALLOCATION INTO MAAA INDEX 1.
LOOP AT IT_COLUM .
"" 下面开始用BDC了
CLEAR iw_bdcdata. "bdc_dynpro
iw_bdcdata-program = 'SAPLCPDI'.
iw_bdcdata-dynpro = '1010'.
iw_bdcdata-dynbegin = 'X'.
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'BDC_CURSOR'.
iw_bdcdata-fval = 'RC271-PLNNR' .
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'BDC_OKCODE'.
iw_bdcdata-fval = '/00' .
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'RC27M-MATNR'.
iw_bdcdata-fval = MAAA-MATERIAL . "z最开始的父件物料
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'RC27M-WERKS'.
iw_bdcdata-fval = MAAA-PLANT . "工厂
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'RC271-PLNNR'.
iw_bdcdata-fval = GROUP . "组
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'RC271-STTAG'.
iw_bdcdata-fval = MAAA-VALID_FROM . "有效日期
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'RC271-PLNAL'.
iw_bdcdata-fval = '1' . "组计数器
APPEND iw_bdcdata TO it_bdcdata. "以上为第一屏
CLEAR iw_bdcdata. "bdc_dynpro
iw_bdcdata-program = 'SAPLCPDI'.
iw_bdcdata-dynpro = '1400'.
iw_bdcdata-dynbegin = 'X'.
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'BDC_CURSOR'.
iw_bdcdata-fval = 'RC27X-ENTRY_ACT' .
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'BDC_OKCODE'.
iw_bdcdata-fval = '=MATA' .
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'RC27X-ENTRY_ACT'.
iw_bdcdata-fval = '1' .
APPEND iw_bdcdata TO it_bdcdata. "进入了分配界面了
"查询动作
CLEAR iw_bdcdata. "bdc_dynpro
iw_bdcdata-program = 'SAPLCMDI'.
iw_bdcdata-dynpro = '1000'.
iw_bdcdata-dynbegin = 'X'.
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'BDC_CURSOR'.
iw_bdcdata-fval = 'RCM01-MATNR' .
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'BDC_OKCODE'.
iw_bdcdata-fval = '=FIND' .
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_dynpro
iw_bdcdata-program = 'SAPLCM01'.
iw_bdcdata-dynpro = '1055'.
iw_bdcdata-dynbegin = 'X'.
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'BDC_CURSOR'.
iw_bdcdata-fval = 'SEARCH_BY-STLNR' .
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'BDC_OKCODE'.
iw_bdcdata-fval = '=GOON' .
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'SEARCH_BY-STLNR'.
iw_bdcdata-fval = IT_COLUM-STLNR . ".........00214339
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'SEARCH_BY-POSNR'.
iw_bdcdata-fval = IT_COLUM-POSNR . ".........0003
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'FIRST_HIT'.
iw_bdcdata-fval = 'X' .
APPEND iw_bdcdata TO it_bdcdata.
""new
CLEAR iw_bdcdata. "bdc_dynpro
iw_bdcdata-program = 'SAPLCMDI'.
iw_bdcdata-dynpro = '1000'.
iw_bdcdata-dynbegin = 'X'.
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'BDC_CURSOR'.
iw_bdcdata-fval = 'RCM01-MATNR' .
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'BDC_OKCODE'.
iw_bdcdata-fval = '=NEW' .
APPEND iw_bdcdata TO it_bdcdata.
"""工序
CLEAR iw_bdcdata. "bdc_dynpro
iw_bdcdata-program = 'SAPLCM01'.
iw_bdcdata-dynpro = '1090'.
iw_bdcdata-dynbegin = 'X'.
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'BDC_CURSOR'.
iw_bdcdata-fval = 'RCM01-VORNR' .
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'BDC_OKCODE'.
iw_bdcdata-fval = '=GOON' .
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'RCM01-VORNR'.
iw_bdcdata-fval = IT_COLUM-VORNR . "工序0010 0020 0030
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'RCM01-PLNFL'.
iw_bdcdata-fval = '0' .
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_dynpro
iw_bdcdata-program = 'SAPLCMDI'.
iw_bdcdata-dynpro = '1000'.
iw_bdcdata-dynbegin = 'X'.
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'BDC_CURSOR'.
iw_bdcdata-fval = 'RCM01-MATNR' .
APPEND iw_bdcdata TO it_bdcdata.
CLEAR iw_bdcdata. "bdc_field
iw_bdcdata-fnam = 'BDC_OKCODE'.
iw_bdcdata-fval = '=BU' .
APPEND iw_bdcdata TO it_bdcdata. "保存退出
CALL TRANSACTION 'CA02' USING it_bdcdata
MODE 'N' UPDATE 'S' MESSAGES INTO it_message.来自:求助得到的回答