• 创建外向交货单BAPI_OUTB_DELIVERY…


    REPORT  zlm_test_024.

    PARAMETERS: vbeln LIKE vbak-vbeln OBLIGATORY MEMORY ID aun.


    DATA: lf_vbeln     TYPE vbeln_vl,
          lf_num       TYPE vbnum,
          ls_deli      TYPE bapishpdelivnumb,
          lt_deli      TYPE TABLE OF bapishpdelivnumb,
          lt_order     TYPE TABLE OF bapidlvreftosalesorder,
          ls_order     TYPE bapidlvreftosalesorder,
          ls_itm       TYPE bapidlvitemcreated,
          lt_itm       TYPE TABLE OF bapidlvitemcreated,
          ls_ext       TYPE bapiparex,
          lt_extin     TYPE TABLE OF bapiparex,
          lt_extout    TYPE TABLE OF bapiparex,
          ls_ret       TYPE bapiret2,
          lt_return    TYPE TABLE OF bapiret2.

    TYPES:BEGIN OF ty_vbap,
          vbeln  LIKE vbap-vbeln,
          posnr  LIKE vbap-posnr,
          kwmeng LIKE vbap-kwmeng,
          meins  LIKE vbap-meins,
          END OF ty_vbap.

    DATA:it_vbap TYPE TABLE OF ty_vbap.
    DATA:ws_vbap TYPE ty_vbap.

    * SalesOrderItems (here: complete sales order)

    SELECT vbeln posnr kwmeng meins INTO TABLE it_vbap
      FROM vbap WHERE vbeln = vbeln.

    LOOP AT it_vbap INTO ws_vbap.
      ls_order-ref_doc    = ws_vbap-vbeln.
      ls_order-ref_item   = ws_vbap-posnr.
      ls_order-dlv_qty    = ws_vbap-kwmeng.
      ls_order-sales_unit = ws_vbap-meins.
      APPEND ls_order TO lt_order.
    ENDLOOP.

    *ls_order-ref_doc = vbeln.
    *append ls_order to lt_order.

    * ExtensionIn
    ls_ext = 'My additional input'.
    APPEND ls_ext TO lt_extin.

    * Synchronous RFC
    CALL FUNCTION 'BAPI_OUTB_DELIVERY_CREATE_SLS'
    *   DESTINATION logsys
    *   EXPORTING
    *     SHIP_POINT              =
    *     DUE_DATE                =
    *     DEBUG_FLG               =
      IMPORTING
        delivery                = lf_vbeln
        num_deliveries          = lf_num
      TABLES
        sales_order_items       = lt_order
        extension_in            = lt_extin
        deliveries              = lt_deli
        created_items           = lt_itm
        extension_out           = lt_extout
        return                  = lt_return
              .


    WRITE: / 'Delivery:', lf_vbeln,
           / 'NumDeliveries:', lf_num,
           / 'Deliveries:'.
    LOOP AT lt_deli INTO ls_deli.
      WRITE ls_deli-deliv_numb.
    ENDLOOP.

    IF NOT lt_itm[] IS INITIAL.
      WRITE: / 'CreatedItems:'.
      LOOP AT lt_itm INTO ls_itm.
        WRITE: / ls_itm-ref_doc,
                 ls_itm-ref_item,
                 ls_itm-deliv_numb,
                 ls_itm-deliv_item,
                 ls_itm-material,
                 ls_itm-dlv_qty,
                 ls_itm-sales_unit,
                 ls_itm-sales_unit_iso.
      ENDLOOP.
    ENDIF.

    IF NOT lt_return[] IS INITIAL.
      WRITE: / 'Return:'.
      LOOP AT lt_return INTO ls_ret.
        WRITE: / ls_ret-type, ls_ret-id, ls_ret-number,
                 ls_ret-message,
               /.
      ENDLOOP.
    ENDIF.

    IF NOT lt_extout[] IS INITIAL.
      WRITE: / 'ExtensionOut:'.
      LOOP AT lt_extout INTO ls_ext.
        WRITE: / ls_ext.
      ENDLOOP.
    ENDIF.

    * COMMIT WORK
    IF NOT lf_vbeln IS INITIAL.
      COMMIT WORK.
    ENDIF.

    http://blog.sina.com.cn/sapliumeng
  • 相关阅读:
    JDK介绍
    选择器——过滤选择器——内容过滤器
    选择器——过滤选择器——基本过滤器
    选择器——层次选择器
    选择器——基本选择器
    jQuery 对象转成 DOM 对象
    dom转换成jquery对象
    Android-bindService本地服务-初步-Service返回对象
    Android-bindService本地服务-初步
    Android-Service生命周期
  • 原文地址:https://www.cnblogs.com/senlinmu110/p/3802154.html
Copyright © 2020-2023  润新知