LT01 创建转储单
一、LT01创建转储单
采购订单——MIGO收货——虚拟仓位——LT01上架——实体仓位——LT01下架——虚拟仓位——MIGO发料——生产订单
二、参考代码
"-----------------------------------------@斌将军-------------------------------------------- DATA: lt_ltap_creat TYPE TABLE OF ltap_creat, ls_ltap_creat TYPE ltap_creat. DATA: lv_lgnum TYPE ltak-lgnum, lv_bwlvs TYPE ltak-bwlvs, lv_tanum TYPE ltak-tanum, lv_vltyp TYPE ltap-vltyp, " 源仓储类型 lv_vlber TYPE ltap-vlber, " 源发地仓储区 lv_vlpla TYPE ltap-vlpla, " 源发地仓储位 lv_nltyp TYPE ltap-nltyp, " 目的地仓储类型 lv_nlber TYPE ltap-nlber, " 目的地仓储区 lv_nlpla TYPE ltap-nlpla. " 目的地仓位 SELECT werks, lgort, lgnum FROM t320 INTO TABLE @DATA(lt_t320) WHERE werks = gs_data-werks AND lgort = gs_data-lgort. IF sy-subrc EQ 0. SORT lt_t320 BY werks lgort. READ TABLE lt_t320 INTO DATA(ls_t320) WITH KEY werks = gs_data-werks lgort = gs_data-lgort BINARY SEARCH. IF sy-subrc EQ 0. lv_lgnum = ls_t320-lgnum. ENDIF. ENDIF. "上架仓储类型 *SELECT * werks, * lgort, * lfdnr *INTO TABLE @DATA(lt_twlad) *FROM twlad *WHERE werks = gs_data_str-werks * AND lgort = gs_data_str-lgort. * *IF sy-subrc EQ 0. * SORT lt_twlad BY werks lgort. * READ TABLE lt_twlad INTO DATA(ls_twlad) WITH KEY werks = gs_data-werks * lgort = gs_data-lgort BINARY SEARCH. * IF sy-subrc EQ 0. * lv_vltyp = ls_twlad-lfdnr. " 源仓储类型 * ENDIF. *ENDIF. SELECT lgnum, lqnum, lgtyp FROM lqua INTO TABLE @DATA(lt_lqua) FOR ALL ENTRIES IN @lt_lljp WHERE lgnum = @gs_data_str-lgnum AND lqnum = @gs_data_str-lqnum. SORT lt_lqua BY lgnum lqnum. lv_bwlvs = '999'. " 移动类型 LOOP AT gt_item INTO ls_item. PERFORM matnr_input CHANGING ls_item-matnr. CLEAR ls_ltap_creat. ls_ltap_creat-matnr = ls_item-matnr. " 物料编号 ls_ltap_creat-werks = ls_item-werks. " 工厂 ls_ltap_creat-lgort = ls_item-lgort. " 存储地点 ls_ltap_creat-charg = ls_item-charg. " 批次编号 ls_ltap_creat-anfme = ls_item-menge. " 数量 ls_ltap_creat-altme = ls_item-meins. " 基本计量单位 READ TABLE lt_lqua INTO DATA(ls_lqua) WITH KEY lgnum = ls_item-lgnum lqnum = ls_item-lqnum BINARY SEARCH. IF sy-subrc EQ 0. ls_ltap_creat-vltyp = ls_lqua-lgtyp. " 源仓储类型 ENDIF. ls_ltap_creat-vlber = '001'. " 源发地仓储区 ls_ltap_creat-vlpla = ls_item-lgpla. " 源发地仓储位 ls_ltap_creat-nltyp = 'Y00'. " 目的地仓储类型 ls_ltap_creat-nlber = '001'. " 目的地仓储区 ls_ltap_creat-nlpla = 'Y00'. " 目的地仓位 APPEND ls_ltap_creat TO lt_ltap_creat. ENDLOOP. CALL FUNCTION 'L_TO_CREATE_MULTIPLE' EXPORTING i_lgnum = lv_lgnum i_bwlvs = lv_bwlvs * I_BETYP = ' ' * I_BENUM = ' ' * I_LZNUM = ' ' * I_NIDRU = ' ' * I_DRUKZ = ' ' * I_NOSPL = ' ' * I_UPDATE_TASK = ' ' i_commit_work = 'X' i_bname = sy-uname * I_KOMPL = 'X' * I_SOLEX = 0 * I_PERNR = 0 * I_MINWM = ' ' * I_AUSFB = ' ' IMPORTING e_tanum = lv_tanum TABLES t_ltap_creat = lt_ltap_creat * T_LTAK = * T_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 OTHERS = 39. IF sy-subrc <> 0. cs_return-type = 'E'. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO cs_return-message. EXIT. ENDIF. "-----------------------------------------@斌将军--------------------------------------------
定期更文,欢迎关注