matinal:SAP ABAP 如何用BAPI实现MD11计划订单创建

2023-10-14 15:28:12 浏览数 (2)

直接上代码

代码语言:javascript复制
DATA:ls_return     TYPE bapireturn1,
     ls_plaf       TYPE plaf,
     ls_headerdata TYPE bapiplaf_i1.

ls_headerdata-pldord_profile = ls_plaf-paart .
ls_headerdata-plan_plant = ls_plaf-plwrk .
ls_headerdata-prod_plant = ls_plaf-pwwrk .
ls_headerdata-material = ls_plaf-matnr .
ls_headerdata-order_start_date = ls_plaf-psttr .
ls_headerdata-order_fin_date = ls_plaf-pedtr .
ls_headerdata-base_uom = ls_plaf-meins .
ls_headerdata-version = ls_plaf-verid .
ls_headerdata-total_plord_qty = ls_plaf-bdmng.
ls_headerdata-firming_ind = 'X' .

CALL FUNCTION 'BAPI_PLANNEDORDER_CREATE'
  EXPORTING
    headerdata   = ls_headerdata
*   IS_SEASON_INFO              =
*   IV_ASSIGN_SEASON            =
  IMPORTING
    return       = ls_return
    plannedorder = ls_plaf-plnum
*   CREATEDHEADERDATA           =
*   CAPACITYHEADERDATA1         =
*   CAPACITYHEADERDATA2         =
*   CAPACITYHEADERDATA3         =
*     TABLES
*   COMPONENTSDATA              =
*   CREATEDCOMPONENTSDATA       =
*   CAPACITYDATA1               =
*   CAPACITYDATA2               =
*   CAPACITYDATA3               =
  .

IF ls_return-type = 'S' .

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait = 'X'.

ELSE .

  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

ENDIF .

0 人点赞