Hi expert ,
I am using Web-services to create SO.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:glob="http://sap.com/xi/SAPGlobal20/Global" xmlns:yaq="http://0006386294-one-off.sap.com/YAQOD7Y8Y_" xmlns:yhc="http://0006386294-one-off.sap.com/YHC7SX0HY_" xmlns:glob1="http://sap.com/xi/AP/Globalization" xmlns:yks="http://0006386294-one-off.sap.com/YKS7VB4RY_" xmlns:y52="http://0006386294-one-off.sap.com/Y52UN3G7Y_" xmlns:a2r="http://sap.com/xi/AP/CustomerExtension/BYD/A2RYM" xmlns:ykp="http://0006386294-one-off.sap.com/YKPVTGE2Y_"> <soapenv:Body> <glob:SalesOrderBundleMaintainRequest_sync> <SalesOrder> <BuyerID>VV01_20190425</BuyerID> <DataOriginTypeCode>2</DataOriginTypeCode> <AccountParty> <PartyID>171</PartyID> </AccountParty> <SalesUnitParty> <PartyID>10-2003</PartyID> </SalesUnitParty> <TextCollection> <Text> <TypeCode>10024</TypeCode> <ContentText>.</ContentText> </Text> </TextCollection> <Item actionCode="01"> <ID>1</ID> <ItemProduct> <ProductInternalID>4002127</ProductInternalID> <UnitOfMeasure>EA</UnitOfMeasure> </ItemProduct> <ItemScheduleLine actionCode="01"> <Quantity>50</Quantity> </ItemScheduleLine> <PriceAndTaxCalculationItem> <ItemMainPrice> <Rate> <DecimalValue>121.1</DecimalValue> <CurrencyCode>USD</CurrencyCode> <BaseDecimalValue>1.0</BaseDecimalValue> <BaseMeasureUnitCode>EA</BaseMeasureUnitCode> </Rate> </ItemMainPrice> </PriceAndTaxCalculationItem> </Item> </SalesOrder> </glob:SalesOrderBundleMaintainRequest_sync> </soapenv:Body> </soapenv:Envelope>
But the Sales Unit is not correct, I need to get the sales Unit from Employee Responsible.
if (this.EmployeeResponsibleParty.IsSet()) { var em = this.EmployeeResponsibleParty.Party.Employee.EmployeeSalesResponsibility.GetFirst().SalesOrganisationID; } // return null
How can I query the sales Unit of Employee Responsible ?
Thanks
Quyen
Hi Quyen,
Please try this path to get correct sales unit. Then set to your sales unit in logic.
if (this.EmployeeResponsibleParty.IsSet()) { foreach(var emp in this.EmployeeResponsibleParty.Party.Employee.Position) { if(emp.CurrentSuperordinateReportingLineUnit.IsSet()) { var salesUnit = emp.CurrentSuperordinateReportingLineUnit.ID; } } }
Add a comment