Skip to Content

After several years of working with the SDK I fully understand the added value of a

good and simple sample.

Therefore, I’ve decided to open a new blog where I’ll publish SDK samples.

The name of the blog would be “Simple Sample Blog” and I promise to provide only simple samples.

In my blog I’ll try to publish sample to new features or to existing features that are a bit confusing.

Please send me requests for samples you’d like to get, Your feedback would be highly appreciated.

My first sample would demonstrate how to work with the new “DI General Service”.

Download the sample from the following link:

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d04b34b5-68cf-2b10-bc98-806feb4299ba

Before running the samples please read the tips for running the General Service samples below:

The zip file contains 2 samples:

“DI_MasterDataUDO.zip” – demonstrates General Service working with Master Data UDO type

“DI_DocumentUDO.zip” – demonstrates General Service working with Master Data UDO type

1)       Make sure first to upgrade your B1 Server and client to version 2007 Patch Level 46 or higher.

2)       Make sure to update the connection properties to suit your environment in the

“MD_UDO_Form_Load” method (lines 43-49):

oCompany.Server = ".";
oCompany.DbUserName = "sa";
oCompany.DbPassword = "B1Admin";
oCompany.CompanyDB = "US2";
oCompany.UserName = "manager";
oCompany.Password = "manager";
oCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2005;
3)   In the first time you run the sample the DB will change, the following User tables,
User fields and UDO will be added, This will happen automatically
(you don’t need to do anything)
a.      For DocumentUDOSample:
     (1)       New table: “SAP_DOCH” (Document Header table type)
                In the “SAP_DOCH” table the following user fields will be added:

Field Title

Description Type and Size
U_CustCode Customer Code db_Alpha, 20
U_CustName Customer Name db_Alpha, 50
U_DocTotal Document Total db_Numeric, 10 Price
      (2)       New table: “SAP_DOCL” (Document Lines table type)
                    In the “SAP_DOCL” table the following user fields will be added:

Field Title

Description Type and Size
U_ ItemCode Item Code db_Alpha, 20
U_ Quantity Quantity db_Numeric, 5 Quantity
U_ UPrice Unit Price db_Numeric, 7 Price
U_ LTotal Line Total db_Numeric, 10 Price
 b.      For MasterDataUDOSample:
     (1)       New table: “SAP_MDH” (Master Data Header table type)
                In the “SAP_MDH” table the following user field will be added:

Field Title

Description Type and Size
U_ Remarks Remarks db_Alpha, 100
      (2)       New table: “SAP_MDL1” (Master Data Lines table type)
                In the “SAP_MDL1” table the following user field will be added:

Field Title

Description Type and Size
U_ Name Subject Name db_Alpha, 30
      (3)       New table: “SAP_MDL2” (Master Data Lines table type)
                In the “SAP_MDL2” table the following user field will be added:

Field Title

Description Type and Size
U_ Name Subject Name db_Alpha, 30
 4)       Due to the fact that the tables are just generated and empty,
in order to have the update method work you must first generate a record therefore:
It is recommended to click on the buttons in the following order:
a.      For DocumentUDOSample
     1.       “Add Doc UDO Header”
     2.       “Add Doc UDO Header and Lines”
     3.       “Update Doc UDO Header”
     4.       “Add Doc UDO Lines”
     5.       “Update Doc UDO Lines”
     6.       “Delete Doc UDO Lines”
     7.       “Delete Doc UDO” – First click on “Add Doc UDO Header” and than click on the “Delete Doc UDO”
     8.       “Cancel Doc UDO” - First click on “Add Doc UDO Header” and than click on the “Cancel Doc UDO”
     9.       “Get List Doc UDO”
     10.   “Close Line Doc UDO” - First click on “Add Doc UDO Header and Lines” and than click on the “Close Line Doc UDO” 
b.      For MasterDataUDOSample
     1.       “Add MD UDO Header”
     2.       “Add MD UDO Header and Lines”
     3.       “Update MD UDO Header”
     4.       “Add MD UDO Lines”
     5.       “Update MD UDO Lines”
     6.       “Get List MD UDO”
     7.       “Delete MD UDO Lines”
     8.       “Cancel MD UDO”
I hope you'll find the sample easy to understand.
Have a great day :-)
Miki
To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Simone Pastorin

    I have a question: is it possible to create a UDO object, given an XML (in some format) describing the table and its fields (and if needed its children tables)? Many thanks!

    (0) 

Leave a Reply