生产订单工艺路线修改

一、生产订单修改工艺路线

现有标准函数可以修改生产订单的工艺路线:CO_SE_PRODORD_CHANGE,但是该函数添加工艺路线时,不能传入采购信息记录和采购组织等字段,因此对标准函数进行改造

二、复制和修改标准函数

复制标准函数为ZCO_SE_PRODORD_CHANGE

因为要添加的字段时在工艺路线上,因此修改工艺路线对应的结构

 添加上自定义的字段和更新标识

修改程序中对应的创建和修改的结构

创建结构中添加缺少的字段

 更新结构中添加缺少的字段和更新标识

创建和修改时,赋值传入的数据

 复制更新和修改函数

ZCO_SE_PRODORD_OPR_CREATE中新建子例程,维护传入的字段。修改函数ZCO_SE_PRODORD_OPR_CHANGE,同样位置调用同一个子例程

 

 复制原有的包含文件,模仿现有的字段赋值子例程,编写新的子例程赋值新增的字段

"-----------------------------------------@斌将军--------------------------------------------
*
&---------------------------------------------------------------------* *& Form opr_set_external_wx *&---------------------------------------------------------------------* * 导入外协采购信息记录和采购组织等字段 *----------------------------------------------------------------------* FORM opr_set_external_wx USING p_infnr TYPE infnr p_infnr_x TYPE c p_ekorg TYPE ekorg p_ekorg_x TYPE c p_meinh TYPE vorme p_meinh_x TYPE c p_umren TYPE cp_umren p_umren_x TYPE c p_zmerh TYPE dzmerh p_zmerh_x TYPE c p_zeier TYPE dzeier p_zeier_x TYPE c p_mgvrg TYPE mgvrg p_mgvrg_x TYPE c p_esokz TYPE esokz p_esokz_x TYPE c p_netpr TYPE iprei p_netpr_x TYPE c p_peinh TYPE epein p_peinh_x TYPE c p_waers TYPE waers p_waers_x TYPE c p_sortl TYPE sorti p_sortl_x TYPE c p_create TYPE c. DATA: ls_t024 TYPE t024. DATA: lv_msgv1 TYPE symsgv, lv_msgv2 TYPE symsgv, lv_msgv3 TYPE symsgv, lv_msg_vornr(9) TYPE c. *--> Take over material group IF NOT p_create IS INITIAL. "create gs_afvgd-infnr = p_infnr. gs_afvgd-ekorg = p_ekorg. gs_afvgd-meinh = p_meinh. gs_afvgd-umren = p_umren. gs_afvgd-zmerh = p_zmerh. gs_afvgd-zeier = p_zeier. gs_afvgd-mgvrg = p_mgvrg. gs_afvgd-esokz = p_esokz. gs_afvgd-preis = p_netpr. gs_afvgd-preis = p_peinh. gs_afvgd-waers = p_waers. gs_afvgd-sortl = p_sortl. ELSE. "change IF NOT p_infnr_x IS INITIAL. gs_afvgd-infnr = p_infnr. ENDIF. IF NOT p_ekorg_x IS INITIAL. gs_afvgd-ekorg = p_ekorg. ENDIF. IF NOT p_meinh_x IS INITIAL. gs_afvgd-meinh = p_meinh. ENDIF. IF NOT p_umren_x IS INITIAL. gs_afvgd-umren = p_umren. ENDIF. IF NOT p_zmerh_x IS INITIAL. gs_afvgd-zmerh = p_zmerh. ENDIF. IF NOT p_zeier_x IS INITIAL. gs_afvgd-zeier = p_zeier. ENDIF. IF NOT p_mgvrg_x IS INITIAL. gs_afvgd-mgvrg = p_mgvrg. ENDIF. IF NOT p_esokz_x IS INITIAL. gs_afvgd-esokz = p_esokz. ENDIF. IF NOT p_netpr_x IS INITIAL. gs_afvgd-preis = p_netpr. ENDIF. IF NOT p_peinh_x IS INITIAL. gs_afvgd-peinh = p_peinh. ENDIF. IF NOT p_waers_x IS INITIAL. gs_afvgd-waers = p_waers. ENDIF. IF NOT p_sortl_x IS INITIAL. gs_afvgd-sortl = p_sortl. ENDIF. ENDIF. *--> Take over purchasing group IF NOT gs_afvgd-infnr IS INITIAL. SELECT SINGLE infnr, ekorg, esokz, werks FROM eine INTO @DATA(lt_eine) WHERE infnr = @gs_afvgd-infnr AND ekorg = @gs_afvgd-ekorg. IF sy-subrc NE 0. lv_msgv1 = gs_afvgd-ekorg. lv_msgv2 = gs_afvgd-infnr. PERFORM error_handling USING gs_caufvd-aufnr gc_error_msg gc_msgid_wx '010' lv_msgv1 lv_msgv2 space space CHANGING gs_return. EXIT. ENDIF. ENDIF. IF NOT gs_afvgd-ekorg IS INITIAL. SELECT SINGLE ekorg, ekotx FROM t024e INTO @DATA(lt_t024e) WHERE ekorg = @gs_afvgd-ekorg. IF sy-subrc NE 0. lv_msgv1 = gs_afvgd-ekorg. PERFORM error_handling USING gs_caufvd-aufnr gc_error_msg gc_msgid_wx '011' lv_msgv1 space space space CHANGING gs_return. EXIT. ENDIF. ENDIF. IF NOT gs_afvgd-meinh IS INITIAL. SELECT SINGLE * FROM t006 INTO @DATA(lt_t006) WHERE msehi = @gs_afvgd-meinh. IF sy-subrc NE 0. lv_msgv1 = gs_afvgd-meinh. PERFORM error_handling USING gs_caufvd-aufnr gc_error_msg gc_msgid_wx '012' lv_msgv1 space space space CHANGING gs_return. EXIT. ENDIF. ENDIF. ENDFORM. " opr_set_external_wx
"-----------------------------------------@斌将军--------------------------------------------

在外协传参时,最好将外协相关的字段都增强进去,这样赋值给采购申请不会缺少数据,之前缺少部分字段,导致采购申请数量、价格、类别、排序字符串等缺失,使用BAPI修改过工单后,在CO02中手动修改保存时将会宕机

 源码中通过工艺创建采购申请的赋值语句在SAPLCOZF->LCOZFU02->CO_ZF_FILL_EBAN_FROM_AFVGD中

 

定期更文,欢迎关注

 
 
posted @ 2021-11-09 16:02  斌将军  阅读(1235)  评论(2编辑  收藏  举报