实现过程和笔记
完整程序
*&---------------------------------------------------------------------*
*& 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'EXPORTINGorderdata = orderdata
* FSH_PRODORD_SEASON = FSH_PRODORD_SEASONIMPORTINGreturn = returnorder_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-numberWITH return-message_v1return-message_v2return-message_v3return-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.