cancel
Showing results for 
Search instead for 
Did you mean: 

Property 'WhsCode' is invalid

former_member673858
Discoverer
0 Kudos

I've been working developing a Web Page to make Sales Orders in SAP using B1IF version 1 as my API to send the data to SAP. For the API I followed this tutorial to create a Scenario package for the API, there are a few steps for the Package to use, the one I'm using is the Root Tag method as shown in the tutorial. It works okay, I can add fields which are part of Sales Order as we can see in the tables ORDR and RDR1.

All the fields were working properly, until I tried to use "WhsCode" to select a Warehouse for the products, giving me an error:

Exception : Invoke of: GetBusinessObjectFromXML
Source:
Description: Property 'WhsCode' of 'DocumentLine' is invalid
-The di call #1 did fail.

This is the XML format I use to send the information to SAP:

<SalesOrder>
<Documents> <Row> <CardCode>LAL0012</CardCode>
<DocDueDate>20200615</DocDueDate>
<Comments>Some comments</Comments>
<NumAtCard>A RFC</NumAtCard>
<ShipToCode>Ship</ShipToCode>
<Series>222</Series> </Row>
</Documents>
<Document_Line> <Row> <WhsCode>A01-TAL</WhsCode>
<ItemCode>A00001</ItemCode>
<Quantity>1</Quantity>
<UnitPrice>100</UnitPrice>
</Row>
<Row>
<WhsCode>A01-TAL</WhsCode>
<ItemCode>A00002</ItemCode>
<Quantity>2</Quantity>
<UnitPrice>200</UnitPrice>
</Row> </Document_Line> </SalesOrder>

¿Can somebody help to resolve this problem?
Thanks

Accepted Solutions (1)

Accepted Solutions (1)

former_member673858
Discoverer

I found a way to resolve it
It seems that the API doesn't recognize "WhsCode", but instead it uses "WarehouseCode" to do the same property. So now the XML is like this:

<SalesOrder>
 <Documents>
  <Row>
   <CardCode>LAL0012</CardCode>
   <DocDueDate>20200615</DocDueDate>
   <Comments>Some comments</Comments>
   <NumAtCard>A RFC</NumAtCard>
   <ShipToCode>Ship</ShipToCode>
   <Series>222</Series>
  </Row>
 </Documents>
 <Document_Line>
  <Row>
   <WarehouseCode>A01-TAL</WarehouseCode>
   <ItemCode>A00001</ItemCode>
   <Quantity>1</Quantity>
   <UnitPrice>100</UnitPrice>
  </Row>
  <Row>
   <WarehouseCode>A01-TAL</WarehouseCode>
   <ItemCode>A00002</ItemCode>
   <Quantity>2</Quantity>
   <UnitPrice>200</UnitPrice>
  </Row>
 </Document_Line>
</SalesOrder>
mgregur
Active Contributor

Hi Maria,

for future reference, you can always go in your Integration framework to Help => B1 DI-API Object, there open Object List and find the Object you need. Click on Object Template and you will get the complete xml structure with all possible fields.

BR,

Matija

Answers (0)