作者:格林威治 | 来源:互联网 | 2023-07-23 16:28
批量创建TO单据GV_TAPOS GV_TAPOS + 1. 转储单行号 GS_OUTPUT-TAPOS GV_TAPOS.
批量创建TO单据
GV_TAPOS = GV_TAPOS + 1. "转储单行号
GS_OUTPUT-TAPOS = GV_TAPOS.
CLEAR:GS_LTAP_CREAT.
GS_LTAP_CREAT-MATNR = GS_OUTPUT-MATNR. "物料
GS_LTAP_CREAT-WERKS = GS_OUTPUT-WERKS. "工厂
GS_LTAP_CREAT-LGORT = GS_OUTPUT-LGORT. "库存地点
GS_LTAP_CREAT-CHARG = GS_OUTPUT-CHARG. "批次
GS_LTAP_CREAT-SOBKZ = GS_OUTPUT-SOBKZ. "特殊库存标志
GS_LTAP_CREAT-SONUM = GS_OUTPUT-PSPNR. "特殊库存编号
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = GS_LTAP_CREAT-SONUM
IMPORTING
OUTPUT = GS_LTAP_CREAT-SONUM.
GS_LTAP_CREAT-SQUIT = 'X'. "标识: 确认转储单项目
"调拨行号&行号 将调拨单号 后8 位,调拨单行号 后4 位拼接存储在 TAP-WEMPF
IF GS_OUTPUT-ZGODYNPRO IS NOT INITIAL AND GS_OUTPUT-ZPOSNR IS NOT INITIAL.
CONCATENATE GS_OUTPUT-ZGODYNPRO+2(8) GS_OUTPUT-ZPOSNR+2(4)
INTO GS_LTAP_CREAT-WEMPF .
ENDIF.
* GS_LTAP_CREAT-WEMPF = ''. "收货方/运达方
GS_LTAP_CREAT-ANFME = GS_OUTPUT-VSOLA."以备选计量单位计的需求数量
GS_LTAP_CREAT-ALTME = GS_OUTPUT-MEINS. "帐面库存单位的可选计量单位
* GS_LTAP_CREAT-LETYP = . "仓储单位类型
GS_LTAP_CREAT-VLTYP = GS_OUTPUT-VLTYP. "源仓储类型
GS_LTAP_CREAT-VLBER = '001'. "源发地仓储区
GS_LTAP_CREAT-VLPLA = GS_OUTPUT-VLPLA. "源发地仓储位
* GS_LTAP_CREAT-VLQNR = GS_OUTPUT-VLQNR. "源发地仓储位数量
GS_LTAP_CREAT-NLTYP = GS_OUTPUT-NLTYP. "目的地仓储类型
GS_LTAP_CREAT-NLBER = '001'. "目的地仓储区
GS_LTAP_CREAT-NLPLA = GS_OUTPUT-NLPLA. "目的地仓位
APPEND GS_LTAP_CREAT TO GT_LTAP_CREAT.
CALL FUNCTION 'L_TO_CREATE_MULTIPLE'
EXPORTING
I_LGNUM = GV_LGNUM
I_BWLVS = '317'
* I_BETYP = ' '
* I_BENUM = ' '
* I_LZNUM = ' '
* I_NIDRU = ' '
* I_DRUKZ = ' '
* I_NOSPL = ' '
I_UPDATE_TASK = 'X'
I_COMMIT_WORK = 'X'
I_BNAME = SY-UNAME
* I_KOMPL = 'X'
* I_SOLEX = 0
* I_PERNR = 0
* I_MINWM = ' '
* I_AUSFB = ' '
IMPORTING
E_TANUM = GV_TANUM
TABLES
T_LTAP_CREAT = GT_LTAP_CREAT
T_LTAK = GT_LTAK_VB
T_LTAP_VB = GT_LTAP_VB
EXCEPTIONS
NO_TO_CREATED = 1
BWLVS_WRONG = 2
BETYP_WRONG = 3
BENUM_MISSING = 4
BETYP_MISSING = 5
FOREIGN_LOCK = 6
VLTYP_WRONG = 7
VLPLA_WRONG = 8
VLTYP_MISSING = 9
NLTYP_WRONG = 10
NLPLA_WRONG = 11
NLTYP_MISSING = 12
RLTYP_WRONG = 13
RLPLA_WRONG = 14
RLTYP_MISSING = 15
SQUIT_FORBIDDEN = 16
MANUAL_TO_FORBIDDEN = 17
LETYP_WRONG = 18
VLPLA_MISSING = 19
NLPLA_MISSING = 20
SOBKZ_WRONG = 21
SOBKZ_MISSING = 22
SONUM_MISSING = 23
BESTQ_WRONG = 24
LGBER_WRONG = 25
XFELD_WRONG = 26
DATE_WRONG = 27
DRUKZ_WRONG = 28
LDEST_WRONG = 29
UPDATE_WITHOUT_COMMIT = 30
NO_AUTHORITY = 31
MATERIAL_NOT_FOUND = 32
LENUM_WRONG = 33
MATNR_MISSING = 34
WERKS_MISSING = 35
ANFME_MISSING = 36
ALTME_MISSING = 37
LGORT_WRONG_OR_MISSING = 38
ERROR_MESSAGE = 40
OTHERS = 39.