1,简介
可以通过FM SHP_DELIVERY_CREATE_NOREF 创建无参照的交货单。
2,例子程序
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
REPORT ztest_create_norefdn. * define data DATA:l_vstel TYPE vstel, l_lfart TYPE lfart, l_vkorg TYPE vkorg, l_vtweg TYPE vtweg, l_spart TYPE spart, l_kunnr TYPE kunwe, lwa_date TYPE shp_set_of_dates, lit_vbfs TYPE vbfs_t, lwa_vbfs LIKE LINE OF lit_vbfs, lit_items_out TYPE shp_dlv_itm_t, lwa_items_out LIKE LINE OF lit_items_out, lit_items TYPE shp_noref_itm_t, lwa_items LIKE LINE OF lit_items. l_vstel = '8800'. l_lfart = 'YMVP'. l_vkorg = '8800'. l_vtweg = '00'. l_spart = '01'. l_kunnr = '0000403000'. "has leading 0 lwa_date-wadat = sy-datum. "Goods Issue Date lwa_date-wauhr = sy-uzeit. "Time of Goods Issue (Local, Relating to a Plant) lwa_date-lfdat = sy-datum. "Delivery Date lwa_date-lfuhr = sy-uzeit. "Time of delivery CLEAR:lwa_items. lwa_items-matnr = '000000000057413726'. "has leading 0 lwa_items-lfimg = 2. "quantity lwa_items-vrkme = 'ST'. lwa_items-werks = '8800'. lwa_items-arktx = 'Description A'. APPEND lwa_items TO lit_items. CLEAR:lwa_items. lwa_items-matnr = 'PACXXXZ'. lwa_items-lfimg = 3. lwa_items-vrkme = 'ST'. lwa_items-werks = '8800'. lwa_items-arktx = 'Description B'. APPEND lwa_items TO lit_items. CALL FUNCTION 'SHP_DELIVERY_CREATE_NOREF' EXPORTING if_vstel = l_vstel "Shipping Point/Receiving Point if_lfart = l_lfart "Delivery Type if_vkorg = l_vkorg "Sales Organization if_vtweg = l_vtweg "Distribution Channel if_spart = l_spart "Division if_kunwe = l_kunnr "Goods Recipient is_dates = lwa_date "Essential Deadlines in Delivery (Can Be Predefined) it_items = lit_items "Delivery Items Without Reference IMPORTING et_dlv_items = lit_items_out "Delivery Items et_messages = lit_vbfs. "Error Log for Collective Processing LOOP AT lit_vbfs TRANSPORTING NO FIELDS WHERE msgty = 'E'. ENDLOOP. IF sy-subrc <> 0. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = abap_true. ELSE. CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'. ENDIF. |
3,测试
运行例子程序后,通过VL03N查看创建的交货单
以上。
发表评论