zoukankan      html  css  js  c++  java
  • SD根据订单创建出库单(相关的函数列表的介绍系列篇(2))

    创建订单样例代码参见:http://blog.csdn.net/CompassButton/archive/2007/05/09/1601712.aspx 

    可以根据一个订单或者部分订单项来创建出库单,代码如下:
    * Populating the item data
    lx_sales_item-ref_doc = l_vbeln.
    lx_sales_item-ref_item = c_000010.
    lx_sales_item-dlv_qty = fp_l_quantity.
    lx_sales_item-sales_unit = fp_afpo-meins.

    APPEND lx_sales_item TO li_sales_item.

    * Function Module to create delivery
    CALL FUNCTION 'BAPI_OUTB_DELIVERY_CREATE_SLS'
    EXPORTING
    ship_point = l_vstel
    IMPORTING
    delivery = fp_l_delivery
    TABLES
    sales_order_items = li_sales_item
    return = li_return1.

    IF fp_l_delivery IS INITIAL.
    * Error message Delivery not created
    MESSAGE e049
    ENDIF.

    lx_vbkok-vbeln_vl = fp_l_delivery.
    lx_vbkok-vbtyp_vl = c_vbtype_j .
    lx_vbkok-vbeln = fp_l_delivery.
    lx_vbkok-wabuc = c_wabuc_x.

    lx_vbpok-vbeln_vl = fp_l_delivery.
    lx_vbpok-posnr_vl = c_posnr.
    lx_vbpok-vbeln = fp_l_delivery.
    lx_vbpok-posnn = c_posnr.
    lx_vbpok-matnr = fp_afpo-matnr.
    lx_vbpok-charg = fp_afpo-charg.
    lx_vbpok-werks = fp_afpo-dwerk.
    lx_vbpok-taqui = c_wabuc_x.
    lx_vbpok-pikmg = fp_l_quantity.
    APPEND lx_vbpok TO li_vbpok.

    * Clearing the implicit lock that mb_create_goods_mvt has. That
    * prevents it from bieng called more then once within same LUW.
    PERFORM clear_xcommit IN PROGRAM saplmbwl.

    * FM to perform picking,confirmation W-M status and PGI.
    CALL FUNCTION 'WS_DELIVERY_UPDATE'
    EXPORTING
    vbkok_wa = lx_vbkok
    synchron = c_xfeld_x
    delivery = fp_l_delivery
    update_picking = c_xfeld_x
    nicht_sperren = c_no_sp_x
    if_database_update = c_data_1
    if_error_messages_send_0 = c_xfeld_x
    TABLES
    vbpok_tab = li_vbpok
    prot = li_prott.
    * Checking if any error in PGI
    READ TABLE li_prott WITH KEY MSGTY = c_e TRANSPORTING NO FIELDS.
    IF sy-subrc EQ 0.
    MESSAGE e046 WITH fp_l_delivery.
    ENDIF.
    READ TABLE li_prott WITH KEY MSGTY = c_a TRANSPORTING NO FIELDS.
    IF sy-subrc EQ 0.
    MESSAGE e046 WITH fp_l_delivery.
    ENDIF.

  • 相关阅读:
    算法---十大经典排序算法
    算法---待整理
    iOS面试题整理---[难度]***
    spring mvc(注解)上传文件的简单例子
    面试感悟:3年工作经验程序员应有的技能
    一个 IT 青年北漂四年的感悟
    成为更优秀程序员的关键:更多的阅读
    数组参数 有params 区别
    对C# 集合类的总结
    c#前缀
  • 原文地址:https://www.cnblogs.com/xiaomaohai/p/6157117.html
Copyright © 2011-2022 走看看