on 2017 Feb 28 9:33 PM
Dear Experts,
My goal is to create Purchase Orders in the external system using external Web Service launched from ABSL script. In order to test such functionality I downloaded WSDL from my own instance of ByDesign and on it's base I created External Web Service Integration. Additionally, I prepared Integration scenario and proper Communication Arrangement. I'm testing the solution by looping through my existing orders and based on them creating new ones through Web Service. Generally, it works fine but I have to refine the details. One of this detail is fulfilling Purchase Order Items nodes.
The code looks less or more like this:
var request: Library::ExternalWebServiceIntegration2.ManagePurchaseOrderInMaintainBundle.Request;
var params: Library::ExternalWebServiceIntegration2.ManagePurchaseOrderInMaintainBundle.Request.PurchaseOrderBundleMaintainRequest_sync.PurchaseOrderMaintainBundle;
var paramsItem: Library::ExternalWebServiceIntegration2.ManagePurchaseOrderInMaintainBundle.Request.PurchaseOrderBundleMaintainRequest_sync.PurchaseOrderMaintainBundle.Item;
var query = PurchaseOrder.QueryByElements; var selectionParams = query.CreateSelectionParams(); selectionParams.Add(query.ID.content,"I","GT","90");
var resultData = query.Execute(selectionParams);
foreach(var po in resultData)
{
params.actionCode = "01";
params.BusinessTransactionDocumentTypeCode.content = "001";
//.... other header fulfillments
foreach (var poitem in po.Item) // loop through order items
{
// for example the following two works fine:
paramsItem.Quantity.content = poitem.Quantity.content; paramsItem.Quantity.unitCode = poitem.Quantity.unitCode;
// ... other detail fulfillments
// and finally I'm getting to problematic node where following assignment is not possible: paramsItem.ItemAccountingCodingBlockDistribution.AccountingCodingBlockAssignment = poitem.ItemAccountingCodingBlockDistribution.AccountingCodingBlockAssignment;
// AccountingCodingBlockAssignment is kind of list so I tried something like this:
var acba : AccountingCodingBlockAssignment;
foreach (var lacba in poitem.ItemAccountingCodingBlockDistribution.AccountingCodingBlockAssignment)
{
acba.Percent = lacba.Percent; paramsItem.ItemAccountingCodingBlockDistribution.AccountingCodingBlockAssignment.Add(acba);
}
// unfortunatelly such assignment is also not possible
I have similar problem with itemtaxcalculation node.
Could you please help me to understand how to make the proper assignment for these problematic nodes and their subnodes?
Thank you in advance
Best Regards
Piotr Kowalski
Request clarification before answering.
Hi,
Finally, I have found the solution. Baybe it will be usefull for someone:
var acba: Library::ExternalWebServiceIntegration2.ManagePurchaseOrderInMaintainBundle.Request.PurchaseOrderBundleMaintainRequest_sync.PurchaseOrderMaintainBundle.Item.ItemAccountingCodingBlockDistribution.AccountingCodingBlockAssignment; foreach (var lacba in poitem.ItemAccountingCodingBlockDistribution.AccountingCodingBlockAssignment)
{
acba.Percent = lacba.Percent; acba.Amount.currencyCode = lacba.Amount.currencyCode;
acba.Amount.content = lacba.Amount.content;
acba.Quantity.unitCode = lacba.Quantity.unitCode;
acba.Quantity.content = lacba.Quantity.content;
acba.AccountingCodingBlockTypeCode.content = lacba.AccountingCodingBlockTypeCode.content;
acba.SalesOrderReference.ID.content = lacba.SalesOrderReference.ID.content;
paramsItem.ItemAccountingCodingBlockDistribution.AccountingCodingBlockAssignment.Add(acba);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
12 | |
10 | |
8 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.