BAPI_PRODORD_CREATE-创建生产订单BAPI测试

目录

  • 实现过程和笔记
  • 完整程序

实现过程和笔记

完整程序

*&---------------------------------------------------------------------*
*& Report z_test_bapi_prodord_create_lhy
*&---------------------------------------------------------------------*
*& Creator:LiuHongyu
*& Create On:2024.2.1
*& Type:Report
*& Description:测试BAPI_PRODORD_CREATE的使用
*&---------------------------------------------------------------------*
*                         Changed History
*--------------  -----------------  ------------------   --------------*
* Version         Changed By         Changed Date         Description
*--------------  -----------------  ------------------   --------------*
*   N              LiuHongyu         2024.2.1             创建程序
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
REPORT z_test_bapi_prodord_create_lhy.

DATA orderdata          TYPE bapi_pp_order_create.
*DATA FSH_PRODORD_SEASON TYPE FSH_S_BAPI_PRODORD_SEASON.
DATA return             TYPE bapiret2.
DATA order_number       TYPE bapi_order_key-order_number.
*DATA ORDER_TYPE         TYPE BAPI_ORDER_COPY-ORDER_TYPE.

orderdata-material = |{ '2155' ALPHA = IN }|. "物料号
"orderdata-material = '2155'. "物料号
orderdata-plant = '1710'. "工厂
orderdata-order_type = 'PP01'. "订单类型
orderdata-quantity = 1390. "订单数量
orderdata-basic_start_date = sy-datum. "订单开始日期,当前日期
orderdata-basic_end_date = sy-datum. "订单开始日期,当前日期
CALL FUNCTION 'BAPI_PRODORD_CREATE'
  EXPORTING
    orderdata                = orderdata
*   FSH_PRODORD_SEASON       = FSH_PRODORD_SEASON
 IMPORTING
   return                   = return
   order_number             = order_number
   "order_type               = order_type
          .
   IF return-type = 'E'.
    CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
    MESSAGE ID return-id TYPE return-type NUMBER return-number
        WITH return-message_v1
        return-message_v2
        return-message_v3
        return-message_v4 .
   ENDIF.
   IF return-type <> 'E'.
    "MESSAGE order_number TYPE 'S'.
    cl_demo_output=>write( '订单创建成功!!!' ).
    cl_demo_output=>write( order_number ).
    cl_demo_output=>display(  ).
   ENDIF.

你可能感兴趣的:(SAP,ABAP,其他,笔记)