Create a production order function bapi_prodord_create

Source: Internet
Author: User

Create a production order, create an order long text, order release

   LOOP  atGt_zstybcp intoGw_zstybcpWHERESEL ='X'  andAUFNR ="'."ADD by 20150716-LY for batch creation     CLEAR: Gs_return,gw_return,gt_order_return[],gt_bapi_order_key[],gs_bapi_order_key. Gs_bapi_pp_order_create-material = Gw_zstybcp-matnr."Order Item NumberGs_bapi_pp_order_create-plant = Gw_zstybcp-werks."Order FactoryGs_bapi_pp_order_create-planning_plant = Gw_zstybcp-werks."Planning PlantGs_bapi_pp_order_create-basic_start_date = Gw_zstybcp-gstrp."Base Start DateGs_bapi_pp_order_create-basic_end_date = Gw_zstybcp-gstrp."Baseline Interpretation DateGs_bapi_pp_order_create-quantity = gw_zstybcp-bdmng."Order Quantity     Pager FUNCTION 'Conversion_exit_cunit_input' "Unit       Exportinginput= gw_zstybcp-Meins*LANGUAGE = Sy-langu       ImportingOutput= gs_bapi_pp_order_create-Quantity_uomEXCEPTIONSUnit_not_found=1OTHERS=2. IFSY-SUBRC <>0. ENDIF.*Gs_bapi_pp_order_create-quantity_uom = gw_zstybcp-meins. " UnitGs_bapi_pp_order_create-goods_recipient = Gw_zstybcp-wempf."Receiving Party*gs_bapi_pp_order_create-goods_recipient = gw_zstybcp-meins.Gs_bapi_pp_order_create-order_type ='DL02'. "Call the order creation function to create a production order for oil-adjusted semifinished products     Pager FUNCTION 'bapi_prodord_create'       ExportingOrderdata=gs_bapi_pp_order_createImportingreturn=Gs_return order_number=Gv_order_number. IFGs_return-type is  not INITIAL."Message FillingGw_return-msgid = gs_return-ID. Gw_return-msgty = gs_return-type. Gw_return-msgno = gs_return-Number . Gw_return-MSGV1 = gs_return-MESSAGE_V1. Gw_return-msgv2 = gs_return-Message_v2. Gw_return-msgv3 = gs_return-Message_v3. Gw_return-MSGV4 = gs_return-message_v4. APPENDGw_return toGt_return. ENDIF.*APPEND Gs_return to Gt_return. " Message Filling     IFGs_return-type ='E' ORGs_return ='A'. Pager FUNCTION 'Bapi_transaction_rollback'. GW_ZSTYBCP-icon ='@[email protected]'. GW_ZSTYBCP-message = gs_return-message. ELSE. Pager FUNCTION 'Bapi_transaction_commit'         Exportingwait='X'. GW_ZSTYBCP-icon ='@[email protected]'. GW_ZSTYBCP-message ='successfully created order for oil-blending semi-finished production'. GW_ZSTYBCP-AUFNR =Gv_order_number. GW_ZSTYBCP-PSMNG = gw_zstybcp-bdmng. GW_ZSTYBCP-amein = gw_zstybcp-Meins. concatenateSy-mandt Gv_order_number intoG_fname. Gw_tline-tdformat =1. Gw_tline-tdline = gw_zstybcp-Ztiay. APPENDGw_tline toGt_tline. Pager FUNCTION 'Create_text'         ExportingFID='Kopf'Flanguage= sy-Langu fname=g_fname Fobject='AUFK'         TABLESFlines=Gt_tlineEXCEPTIONSNo_init=1No_save=2OTHERS=3. IFSY-SUBRC <>0. ENDIF. IFSY-SUBRC =0. Pager FUNCTION 'Bapi_transaction_commit'           Exportingwait='X'. ELSE. Pager FUNCTION 'Bapi_transaction_rollback'. ENDIF. WAITUp to 1SECONDS. UPDATEAufkSETLtext ='1' WHEREAUFNR =Gv_order_number. COMMIT  Work. Gs_bapi_order_key-order_number =Gv_order_number. APPENDGs_bapi_order_key toGt_bapi_order_key. "ADD by LY 20150610 Order release       Pager FUNCTION 'Bapi_prodord_release'*Exporting*Release_control = ' 1 '*work_process_group = ' Cowork_bapi '*Work_process_max =*Importing*RETURN =         TABLESorders=Gt_bapi_order_key Detail_return=Gt_order_return. READ TABLEGt_order_return withKEY type ='E'. IFSY-SUBRC <>0. Pager FUNCTION 'Bapi_transaction_commit'           Exportingwait='X'. ELSE. Pager FUNCTION 'Bapi_transaction_rollback'. concatenate 'Order'Gv_order_number'release failed, please release manually! '  intogw_return-msgv1. MESSAGEGw_return-msgv1TYPE 'S'DISPLAY like 'E'. ENDIF. ENDIF. MODIFYGt_zstybcp fromgw_zstybcp. Endloop.

Create a production order function bapi_prodord_create

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.