cancel
Showing results for 
Search instead for 
Did you mean: 

Adding and Updating Batch record for oOrders with DISERVER-DI SERVER BATCH

Former Member
0 Kudos

Hi,

Can you please share a valid XML call to DIServer for creating and updating a batch for oOrders?

The only example I was able to find is in the docs, which is for oDeliveryNotes:


<?xml version="1.0" encoding="UTF-16"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
 <env:Header>
  <SessionID>F46EDCE6-3F79-1F9F-1D1E-DC6226D04FA7</SessionID>
 </env:Header>
 <env:Body>
  <dis:AddObject xmlns:dis="http://www.sap.com/SBO/DIS">
  <BOM>
   <BO>
    <AdmInfo>
     <Object>oDeliveryNotes</Object>
    </AdmInfo>
    <Documents>
     <row>
      <CardCode>BPForBatch</CardCode>
     </row>
    </Documents>
   <Document_Lines>
    <row>
     <ItemCode>ItemToBatch1</ItemCode>
     <Quantity>10</Quantity>
     <Price>10</Price>
     <TaxCode>My Tax</TaxCode>
    </row>
    <row>
     <ItemCode>ItemToBatch2</ItemCode>
     <Quantity>8</Quantity>
     <Price>10</Price>
     <TaxCode>My Tax</TaxCode>
    </row>
   </Document_Lines>
   <BatchNumbers>
     <row>
     <BatchNumber>AA</BatchNumber>
     <Quantity>5</Quantity>
     <BaseLineNumber>0</BaseLineNumber>
    </row>
    <row>
     <BatchNumber>AA</BatchNumber>
     <Quantity>5</Quantity>
     <BaseLineNumber>0</BaseLineNumber>
    </row>
    <row>
     <BatchNumber>AB</BatchNumber>
     <Quantity>5</Quantity>
     <BaseLineNumber>1</BaseLineNumber>
    </row>
    <row>
     <BatchNumber>AB</BatchNumber>
     <Quantity>3</Quantity>
     <BaseLineNumber>1</BaseLineNumber>
    </row>
   </BatchNumbers>
   </BO>
  </BOM>
  </dis:AddObject>
 </env:Body>
</env:Envelope>

Thank you very much,

Mike

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank you very much for your help.

If it is not possible to add or update batches with DIServer, then we can't use it.

Looks like we have to write our own DIServer.

If any news comes about batch processing, please let me know.

Cheers,

Mike

Cygnusoft

Former Member
0 Kudos

Hi,

We have updated the SAP B1 installation to 2007A, and it seems that updating batches is supposed to work in this version.

Can you please share sample code on how batches can be updated, and how the XML can be worked with and tranversed?

Thank you very much,

Mike

Former Member
0 Kudos

Hi,

I am trying this XML code which isn't working. Do you have any thoughts about how we can make this work?


<?xml version="1.0" encoding="UTF-16"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
 <env:Header>
  <SessionID>1CC7DCFD-5A22-4211-8B6C-906E8A36170F</SessionID>
 </env:Header>
 <env:Body>
  <dis:AddObject xmlns:dis="http://www.sap.com/SBO/DIS">
  <BOM>
   <BO>
    <AdmInfo>
     <Object>oOrders</Object>
    </AdmInfo>
    <Documents>
     <row>
      <CardCode>PAG</CardCode>
     </row>
    </Documents>
   <BatchNumbers>
     <row>
     <BatchNumber>28286</BatchNumber>
     <Quantity>1</Quantity>
     <BaseLineNumber>0</BaseLineNumber>
    </row>
   </BatchNumbers>
   </BO>
  </BOM>
  </dis:AddObject>
 </env:Body>
</env:Envelope>

And DIServer returns this error code:


<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body>
<env:Fault>
<env:Code>
<env:Value>env:Receiver</env:Value>
<env:Subcode>
<env:Value>-1</env:Value>
</env:Subcode>
</env:Code>
<env:Reason>
<env:Text xml:lang="en">General Error</env:Text>
</env:Reason>
<env:Detail>
<Command>AddObject</Command>
<SessionID>1CC7DCFD-5A22-4211-8B6C906E8A36170F</SessionID>
</env:Detail>
</env:Fault>
</env:Body>
</env:Envelope>

Thank you,

Mike

Edited by: Michael Gurevich on Sep 12, 2008 9:05 AM

Former Member
0 Kudos

Hi Michael,

The following example is adding an order with the DI server with batch numbers:

In your file, you had no "DocumentLines" section - these are the rows of the document and where you enter the items.

Additionally, in the "Rows" section of the serial numbers, you were using "BaseLineNumbers" which are only relevant when basing one document on another.

Before adding this document I created a batch called batch1 in the application.

<?xml version="1.0" encoding="utf-16"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Header>
    <SessionID>B9904156-051A-4EFB-8462-97C42FF4F342</SessionID>
  </env:Header>
  <env:Body>
    <dis:AddObject xmlns:dis="http://www.sap.com/SBO/DIS" CommandID="Add Item">
      <BOM>
        <BO>
          <AdmInfo>
           	 <Object>oOrders</Object>	    
          </AdmInfo>
	 <Documents>
		<row>
		<CardCode>C1000</CardCode>
		<DocDate>20070808</DocDate>
		<DocDueDate>20070909</DocDueDate>
		</row>		
	 </Documents>
	 <Document_Lines>
		<row>
		<ItemCode>diserver</ItemCode>
		</row>
	 </Document_Lines>
	<BatchNumbers>
     		<row>
     		<BatchNumber>batch1</BatchNumber>
     		<Quantity>1</Quantity>
    		</row>
	</BatchNumbers>
 	</BO>
      </BOM>
    </dis:AddObject>
  </env:Body>
</env:Envelope>

I hope this helps,

Regards,

NIall

SAP Business One Forums

Former Member
0 Kudos

Hi Niall,

Thank you very much for helping, and unfortunately this XML:


<?xml version="1.0" encoding="utf-16"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Header>
    <SessionID>DD54C201-4A8C-4CE0-A6A2-F33F0C0D4604</SessionID>
  </env:Header>
  <env:Body>
    <dis:AddObject xmlns:dis="http://www.sap.com/SBO/DIS" CommandID="Add Item">
      <BOM>
        <BO>
          <AdmInfo>
           	 <Object>oOrders</Object>	    
          </AdmInfo>
	 <Documents>
		<row>
		<CardCode>PAG</CardCode>
		<DocDate>20080808</DocDate>
		<DocDueDate>20080909</DocDueDate>
		</row>		
	 </Documents>
	 <Document_Lines>
		<row>
		<ItemCode>diserver</ItemCode>
		</row>
	 </Document_Lines>
	<BatchNumbers>
     		<row>
     		<BatchNumber>27718</BatchNumber>
     		<Quantity>1</Quantity>
    		</row>
	</BatchNumbers>
 	</BO>
      </BOM>
    </dis:AddObject>
  </env:Body>
</env:Envelope>

causes this error:


<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
	<env:Body>
		<env:Fault>
			<env:Code>
				<env:Value>env:Receiver</env:Value>
				<env:Subcode>
					<env:Value>-5009</env:Value>
				</env:Subcode>
			</env:Code>
			<env:Reason>
				<env:Text xml:lang="en">Item no. is missing</env:Text>
			</env:Reason>
			<env:Detail>
				<Object>17</Object>
				<ObjectIndex>1</ObjectIndex>
				<Command>AddObject</Command>
				<CommandID>Add Item</CommandID>
				<SessionID>DD54C201-4A8C-4CE0-A6A2-F33F0C0D4604</SessionID>
			</env:Detail>
		</env:Fault>
	</env:Body>
</env:Envelope>

I'm not sure what "Item no. is missing" is missing means. I don't seen an "ItemNo" in the database as a field, or in the XML template SAP gives me. Can you please help me better understand this?

Also, do you happen to know how we can add, update and remove just the batch information, without having to add an order?

I appreciate your help, thank you!

Cheers,

Mike

Nussi
Active Contributor
0 Kudos

Hi,

the ItemNo usually means that field:

<ItemCode>diserver</ItemCode>

but when the item "diserver" exist i can't tell you why you get this error...

i have only a sbo 2005 at the moment and there's a update of batch not possible -> no DIAPI object.

mabye i can have a look at 2007 later.

lg David

Former Member
0 Kudos

HI Michael,

The error message ItemNo missing would point towards there being no item in you database called "diserver". I had created a test item in my system for this example. Although it says Item No. it means item code. If you change it to the Item Code of an item in you database it should work.

As far as I understand, it is not possible to add, update or remove batch or serial numbers without doing so through a document using the DI API in the way you described.

Kind Regards,

Niall