直接上代码
代码语言: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 .