Skip to Content

How can I get Sales Unit of Employee Responsible by Code ?

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jun 06, 2019 at 09:13 AM

    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
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.