从我的 WCF 服务中,我需要在 SAP 系统中创建一个采购订单并且它正在创建。但是当我尝试提交事务时,它在 SAP 系统中没有影响。
我从 SAP 获得 PONumber 并且它没有提交。
任何人都可以在这个问题上帮助我。
这是我的代码:
NFCLMasters.ZMASTERDATA zmobj = new NFCLMasters.ZMASTERDATA();
NFCLMasters.ZMASTERDATAResponse zmresponse = new NFCLMasters.ZMASTERDATAResponse();
NFCLMasters.ZSM_WH_MST[] zmwarehousemaster = new NFCLMasters.ZSM_WH_MST[10];
NFCLMasters.zws_mst mst = new NFCLMasters.zws_mst();
zmobj.IWHMST = "X";
zmobj.WHMST_LINES = zmwarehousemaster;
zmresponse = mst.ZMASTERDATA(zmobj);
NFCLTransactions.BAPI_PO_CREATE1 Zpo = new NFCLTransactions.BAPI_PO_CREATE1();
NFCLTransactions.BAPI_PO_CREATE1Response Zporesponse = new NFCLTransactions.BAPI_PO_CREATE1Response();
NFCLTransactions.zws_lo SapTrasactions = new NFCLTransactions.zws_lo ();
// Data objects
NFCLTransactions.BAPIMEPOHEADER poheader = new NFCLTransactions.BAPIMEPOHEADER();
NFCLTransactions.BAPIMEPOHEADERX poheaderx = new NFCLTransactions.BAPIMEPOHEADERX();
NFCLTransactions.BAPIMEPOITEM[] poitem = new NFCLTransactions.BAPIMEPOITEM[1];
NFCLTransactions.BAPIMEPOITEMX[] poitemx = new NFCLTransactions.BAPIMEPOITEMX[1];
NFCLTransactions.BAPIMEPOSCHEDULE[] poschedule = new NFCLTransactions.BAPIMEPOSCHEDULE[1];
NFCLTransactions.BAPIMEPOSCHEDULX[] poschedulex = new NFCLTransactions.BAPIMEPOSCHEDULX[1];
NFCLTransactions.BAPIITEMSHIP[] poitemship = new NFCLTransactions.BAPIITEMSHIP[1];
NFCLTransactions.BAPIITEMSHIPX[] poitemshipx = new NFCLTransactions.BAPIITEMSHIPX[1];
NFCLTransactions.BAPIRET2[] Bapireturn = new NFCLTransactions.BAPIRET2[100];
// ASSIGNING VALUES TO EACH OBJECT AND ADDING MAIN BAPI
poheader.COMP_CODE = "NFCL"; poheader.DOC_TYPE = "ZPPS"; poheader.PURCH_ORG = "MKTG"; poheader.PUR_GROUP = "M13"; poheader.DOC_DATE = "2015-02-06";
poheader.SUPPL_PLNT = "1311"; poheader.OUR_REF = "R006";
Zpo.POHEADER = poheader;
poheaderx.COMP_CODE = "X"; poheaderx.DOC_TYPE = "X"; poheaderx.PMNTTRMS = "X"; poheaderx.PURCH_ORG = "X"; poheaderx.PUR_GROUP = "X";
poheaderx.SUPPL_PLNT = "X"; poheaderx.OUR_REF = "X";
Zpo.POHEADERX = poheaderx;
poitem[0] = new NFCLTransactions.BAPIMEPOITEM();
poitem[0].PO_ITEM = "00001"; poitem[0].MATERIAL = "U01016501F"; poitem[0].PLANT = "1311"; poitem[0].STGE_LOC = "K038"; poitem[0].QUANTITY = 10;
poitem[0].PERIOD_IND_EXPIRATION_DATE = "D";
Zpo.POITEM = poitem;
poitemx[0] = new NFCLTransactions.BAPIMEPOITEMX();
poitemx[0].PO_ITEM = "00001"; poitemx[0].MATERIAL = "X"; poitemx[0].PLANT = "X"; poitemx[0].STGE_LOC = "X"; poitemx[0].QUANTITY = "X";
poitemx[0].VAL_TYPE = "X"; poitemx[0].BATCH = "X";
Zpo.POITEMX = poitemx;
poschedule[0] = new NFCLTransactions.BAPIMEPOSCHEDULE();
poschedule[0].PO_ITEM = "00001"; poschedule[0].DELIVERY_DATE = "06.02.2015"; poschedule[0].QUANTITY = 10;
//poschedule[0].DELIV_TIME = 'X';
// poschedule[0].GR_END_TIME
Zpo.POSCHEDULE = poschedule;
poschedulex[0] = new NFCLTransactions.BAPIMEPOSCHEDULX();
poschedulex[0].PO_ITEM = "00001"; poschedulex[0].PO_ITEMX = "X"; poschedulex[0].DELIVERY_DATE = "X"; poschedulex[0].QUANTITY = "X";
Zpo.POSCHEDULEX = poschedulex;
poitemship[0] = new NFCLTransactions.BAPIITEMSHIP();
poitemship[0].PO_ITEM = "00001"; poitemship[0].SHIP_POINT = "R006";
Zpo.POSHIPPING = poitemship;
poitemshipx[0] = new NFCLTransactions.BAPIITEMSHIPX();
poitemshipx[0].PO_ITEM = "00001"; poitemshipx[0].SHIP_POINT = "X";
Zpo.POSHIPPINGX = poitemshipx;
Zpo.RETURN = Bapireturn;
NFCLTransactions.BAPI_TRANSACTION_COMMIT transcommit = new NFCLTransactions.BAPI_TRANSACTION_COMMIT();
transcommit.WAIT = "X";
Zporesponse = SapTrasactions.BAPI_PO_CREATE1(Zpo);
response = Zporesponse.EXPPURCHASEORDER;
NFCLTransactions.BAPI_TRANSACTION_COMMITResponse resp = SapTrasactions.BAPI_TRANSACTION_COMMIT(transcommit);