CO15批次确定,标准的太蛋疼了详解编程语言

1.批次确定的配置,之前有转过,自己也动手配过,可以是可以,但是蛋疼,用户不愿意去弹出的界面选批次。。。
2.因为这边的批次全部是按年月日+流水生成的,所以在批次确定这里就需要按照批次的号来排序选择了

一:INCLUDE LV01FFD0

FORM DIALOG最开始:屏蔽标准的弹窗界面

ENHANCEMENT 1  ZCO15_ENHS.    "active version 
IF SY-TCODE = 'CO15'. 
  no_dialog = 'X'. 
ENDIF. 
ENDENHANCEMENT.

二:INCLUDE  LCOWBFC1

FORM call_batch_determination 最后位置:批次手动逻辑重新确定

ENHANCEMENT 1  ZCO15_ENH.    "active version 
"循环内表处理 
DATA:GV_LINE TYPE I."重新生成的两表对应序列 
DATA:VT_MCHB TYPE TABLE OF MCHB. 
DATA:VS_MCHB TYPE MCHB. 
DATA:LV_ERFMG TYPE MB_ERFMG."需求数量 
DATA:LV_LINE TYPE I. 
DATA:LV_FLAG TYPE C. 
CLEAR:GV_LINE,VT_MCHB[],VS_MCHB,LV_ERFMG,LV_LINE."情况临时变量/ 
DESCRIBE TABLE GT_CONTROL_TAB LINES LV_LINE. 
IF SY-TCODE = 'CO15'. 
SORT GT_COMP BY MATNR ASCENDING. 
LOOP AT GT_COMP." WHERE MARK = 'X'. 
GV_LINE = GV_LINE + 1."初始化次数 
AT NEW MATNR. 
LV_FLAG = 'X'. 
CLEAR:VT_MCHB[]. 
ENDAT. 
LV_ERFMG = GT_COMP-ERFMG."将数量存入变量,后续判断使用 
* 
*        IF GT_COMP-CHARG IS NOT INITIAL."排出已经确定的批次 
*          LV_ERFMG = LV_ERFMG - GT_COMP-ERFMG. 
*        ENDIF. 
IF GT_COMP-MARK EQ 'X' AND GT_COMP-LGORT IS NOT INITIAL 
AND GT_COMP-WERKS IS NOT INITIAL AND GT_COMP-CHARG IS INITIAL. 
"查询所有物料,工厂,库位级别的批次库存 
IF LV_FLAG = 'X'. 
SELECT MATNR WERKS LGORT CHARG CLABS INTO CORRESPONDING FIELDS OF TABLE VT_MCHB 
FROM MCHB WHERE MATNR = GT_COMP-MATNR 
AND WERKS = GT_COMP-WERKS 
AND LGORT = GT_COMP-LGORT 
AND LVORM = '' 
AND CLABS <> 0. 
ENDIF. 
SORT VT_MCHB BY CHARG ASCENDING. 
LOOP AT VT_MCHB INTO VS_MCHB WHERE CLABS <> 0. 
IF LV_ERFMG > 0."判断是否数量已满足 
IF VS_MCHB-CLABS >= LV_ERFMG."满足数量要求,选择批次,并把数量置0 
GT_COMP-CHARG = VS_MCHB-CHARG. 
VS_MCHB-CLABS = VS_MCHB-CLABS - LV_ERFMG."更新批次剩余数量 
LV_ERFMG = 0. 
ELSE."数量不足,使用全部本批次,不足数量循环下一批,并插入行 
GT_COMP-CHARG = VS_MCHB-CHARG. 
LV_ERFMG = LV_ERFMG - VS_MCHB-CLABS. 
GT_COMP-ERFMG = VS_MCHB-CLABS. 
VS_MCHB-CLABS = VS_MCHB-CLABS - LV_ERFMG."更新批次剩余数量 
IF VS_MCHB-CLABS < 0. 
VS_MCHB-CLABS = 0. 
ENDIF. 
GT_COMP-IND_ST = GV_LINE. 
INSERT GT_COMP. 
CLEAR:GT_COMP-CHARG. 
GT_COMP-ERFMG = LV_ERFMG. 
GV_LINE = GV_LINE + 1."自增一位 
LV_LINE = LV_LINE + 1."自增一位 
GT_CONTROL_TAB-IND_TO_TABLE = LV_LINE. 
GT_CONTROL_TAB-IND_FOR_START_SORT = LV_LINE. 
APPEND GT_CONTROL_TAB. 
ENDIF. 
MODIFY VT_MCHB FROM VS_MCHB. 
ENDIF. 
ENDLOOP. 
ENDIF. 
GT_COMP-IND_ST = GV_LINE. 
MODIFY GT_COMP. 
CLEAR:LV_FLAG. 
ENDLOOP. 
ENDIF. 
ENDENHANCEMENT.

其实隐式增强用起来很爽的,很多程序都是DIALOG程序,只要找到对应位置,就和DIALOG开发一样了。。。

原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/18674.html

(0)
上一篇 2021年7月19日
下一篇 2021年7月19日

相关推荐

发表回复

登录后才能评论