UDO services are available in DI API/DI Server since SAP Business One 2007A PL46. You can refer to the blog about Simple Sample Blog. Nowadays, the questions are frequently asked about accessing UDO in DI Server.
Q1: Can we access UDO via DI Server?
Answer: Yes. Typically, there is a new feature exposed in DI API, and it is also available in DI Server. So do UDO services.
Q2: How can we use UDO service in DI Server?
Answer: Let's take a movie rental document UDO as example.
Prerequistes:
1). Make sure first to upgrade your B1 Server and client to version 2007 Patch Level 46 or higher.
2). UDO registration as below:
UDO Code: SAP_ORNTMOV (Used as service code)
UDO Name: SAP_ORNTMOVName
(
Note: UDO Name is used as xml element name in DI Server, thus it shouldn't contain any space or special charactors.)
UDO Type:
Document
Main Table: @SAP_ORNTMOV (Movie Rental Document)
Fieds: DocEntry, DocNum, U_CardCode, U_CardName, U_RentDate, U_TotalAmt ...
Child Table: @SAP_RNTMOV1 (Movie Rental Details)
Fields: DocEntry, LindId, U_ItemCode, U_ItemDesc, U_Price (Note: Childe table will be used as collection element in xml. Child table @SAP_RNTMOV1 is used as <SAP_RNTMOV1Collection> )
SOAP Requests:
1).GetByParams:
<?xml version="1.0"?>
<env:Envelope xmlns:env="
http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
<SessionID>Your_Session_ID</SessionID>
</env:Header>
<env:Body>
<dis:GetByParams xmlns:dis="
http://www.sap.com/SBO/DIS">
<Service>SAP_ORNTMOV</Service>
<SAP_ORNTMOVParams>
<DocEntry>1</DocEntry>
</SAP_ORNTMOVParams>
</dis:GetByParams>
</env:Body>
</env:Envelope>
2). Add a movie rental document with 2 lines.
<?xml version="1.0"?>
<env:Envelope xmlns:env="
http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
<SessionID>Your_Session_ID</SessionID>
</env:Header>
<env:Body>
<dis:Add xmlns:dis="
http://www.sap.com/SBO/DIS">
<Service>SAP_ORNTMOV</Service>
<SAP_ORNTMOVName>
<U_CardCode>C00001</U_CardCode>
<U_CardName>Yatsea</U_CardName>
<U_RentDate>2010-02-01</U_RentDate>
<U_TotalAmt>25</U_TotalAmt>
<SAP_RNTMOV1Collection>
<SAP_RNTMOV1>
<U_ItemCode>M00001</U_ItemCode>
<U_ItemDesc>2012</U_ItemDesc>
<U_Price>10</U_Price>
</SAP_RNTMOV1>
<SAP_RNTMOV1>
<U_ItemCode>M00002</U_ItemCode>
<U_ItemDesc>Avatar</U_ItemDesc>
<U_Price>15</U_Price>
</SAP_RNTMOV1>
</SAP_RNTMOV1Collection>
<SAP_ORNTMOVName>
</dis:Add>
</env:Body>
</env:Envelope>
3).Update the price in movie rental document
<?xml version="1.0"?>
<env:Envelope
xmlns:env="
http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
<SessionID>Your_Session_ID</SessionID>
</env:Header>
<env:Body>
<dis:Update
xmlns:dis="
http://www.sap.com/SBO/DIS">
<Service>SAP_ORNTMOV</Service>
<SAP_ORNTMOVName>
<DocEntry>1</DocEntry>
<UpdateDate>20010-02-01</UpdateDate>
<UpdateTime>1118</UpdateTime>
<U_TotalAmt>35</U_TotalAmt>
<SAP_RNTMOV1Collection>
<SAP_RNTMOV1>
<DocEntry>1</DocEntry>
<LineId>1</LineId>
<U_ItemCode>M00001</U_ItemCode>
<U_ItemDesc>2012</U_ItemDesc>
<U_Price>15</U_Price>
</SAP_RNTMOV1>
<SAP_RNTMOV1>
<DocEntry>1</DocEntry>
<LineId>2</LineId>
<U_ItemCode>M00002</U_ItemCode>
<U_ItemDesc>Avatar</U_ItemDesc>
<U_Price>20</U_Price>
</SAP_RNTMOV1>
</SAP_RNTMOV1Collection>
<SAP_ORNTMOVName>
</dis:Update>
</env:Body>
</env:Envelope>
4).Remove the document:
<?xml version="1.0"?>
<env:Envelope xmlns:env="
http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
<SessionID>Your_Session_ID</SessionID>
</env:Header>
<env:Body>
<dis:Remove xmlns:dis="
http://www.sap.com/SBO/DIS">
<Service>SAP_ORNTMOV</Service>
<SAP_ORNTMOVName>
<DocEntry>2</DocEntry>
</SAP_ORNTMOVName>
</dis:Remove>
</env:Body>
</env:Envelope>
5).Cancel the document
<?xml version="1.0"?>
<env:Envelope
xmlns:env="
http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
<SessionID>Your_Session_ID</SessionID>
</env:Header>
<env:Body>
<dis:Cancel
xmlns:dis="
http://www.sap.com/SBO/DIS">
<Service>SAP_ORNTMOV</Service>
<SAP_ORNTMOVName>
<DocEntry>3</DocEntry>
</SAP_ORNTMOVName>
</dis:Cancel>
</env:Body>
</env:Envelope>
6).Close the document:
<?xml version="1.0"?>
<env:Envelope
xmlns:env="
http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
<SessionID>Your_Session_ID</SessionID>
</env:Header>
<env:Body>
<dis:Close
xmlns:dis="
http://www.sap.com/SBO/DIS">
<Service>SAP_ORNTMOV</Service>
<SAP_ORNTMOVName>
<DocEntry>4</DocEntry>
</SAP_ORNTMOVName>
</dis:Close>
</env:Body>
</env:Envelope>