cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Managing SAP objects. SDK tutorial example.

Former Member
0 Likes
913

Dear all,

I followed the SDK tutorial (SDKTutorial.chm) to understand how to manage SAP B1 objects (user tables) and forms.

When I press the "Add" button in the Blanket form, I see a new row is automatically added in the @SM_OBLK user table, but all my fields (U_BPCode, U_BPName, etc...) are empty.

How can also populate these fields with the values I selected and inserted in the form?

Can someone help me, please?

Are there other SAP B1 SDK Samples I can follow to understand how to manage objects using forms and UI DI API?

Regards

Emanuele

Edited by: Emanuele Croci on Jan 7, 2011 11:47 AM

View Entire Topic
Former Member
0 Likes

I've not had a look but my thought is that the fields on the form aren't bound to a datasource? For example, you need to bind your BPCode text field to the U_BPCode field of the @SM_OBLK table.

Sorry I don't have more time to go into details but if you are still stuck I'm sure someone will come along with a more detailed answer, this might point you in the right direction though!

Former Member
0 Likes

Dear njmog1,

thank you for your help.

I followed your suggestion, and now I can bind the fields of the header of the folder to the fields of the @SM_OBLK header table.

Now, I need to do the same thing for the matrix in the form. It should contain the rows and I need to bind them to the @SM_BLK1 details table.

In Scree Painter, for each matrix column, I tried to set the parameters:

Table: @SM_BLK1

Alias: @SM_BLK1 field name (i.e. U_itemCode)

DataBound: True

but when I press the Add button, the user fields in the table are empty.

Can someone help me, please?

Regards

Emanuele

Former Member
0 Likes

Dear all,

we are trying to understand step-to-step the basis of SAP B1 SDK UI DI API.

We are finding some issues, so weu2019d like to ask to you if you can give us some suggestions.

Here we describe our problem:

we started following u201CSDKTutorial.chmu201D tutorial, contained into SAP Business One SDK package.

We created a new MS VisualStudio 2010 project, implemented events management, and so onu2026

Following the u201CDeveloping a Blanket Agreement Solutionu201D example, we registered an u201CSM_BLKu201D object into SAP B1 connected to the SM_OBLK u201CBlanket Agreementu201D user table.

SM_OBLK table is connected to the SM_BLK1 u201CBlanket Agreement Linesu201D user sub-table.

Using SAP B1 Screen Painter addon, we created a new form:

in the header part of the form we inserted graphical objects (textboxes, combo-boxes, etc.) connected to the fields of @SM_OBLK user table.

For example, txtCode combo-box is connected to the U_BPCode field of this user table. In this way when we press the u201CAddu201D button (in the left-bottom corner), automatically in the @SM_OBLK user table a new row is added with the values contained in the graphical objects.

The problem is that we cannot do the same thing with the fields of the Grid contained in the form. The Grid is that with fields: Item Code, Item Name, Price, Quantity, eccu2026

We tried to connect every column of the Grid to a field of the @SM_BLK1 user table; for example, we connected the Item Code column to the U_ItemCode of sub-table.

Unfortunately when we press the u201CAddu201D button, automatically a new row is added in the @SM_BLK1 user table, but the fields are not populated (NULL value) and the values in the fields of the grid are not read.

Please, we ask to you if you could help us and give us some suggestions (documentation or examples).

How can we connect the columns of the Grid to the fields of a user sub-table?

We also noted that if we go in u201CSearchu201D mode and we select a BP code, the classical arrows we use to move on the previous/next element are disabled.

Do you know how we can enable these arrow to move from one record to the previous/next one?

We hope you can help us.

Best regards

Emanuele

former_member689126
Active Contributor
0 Likes

Hi

For the arrow keys to work you have to place a edittext in to you form and assign a unique id ( say txtDocEnt ) then bind it to the DocEntry filed ( table @SM_OBLK , alias DocEntry and databound true )

after loading the form through LoadFromXML("blanket.srf") use the following code

oForm = SBO_Application.Forms.Item("FBLK")
  oForm.DataBrowser.BrowseBy = "txtDocEnt"

for your first issue please re register your UDO and try

Hope this helps you

Regards

Arun

Former Member
0 Likes

Thank you Arun.

The second issue is solved.

Now, arrows work.

Unfortunately, the first issue is not solved re-registering my UDO.

When I press the Add button, automatically a new row is added in the @SM_OBLK user table, but no one row is added in the @SM_BLK1 user table.

In ScreenPainter, the LinkTo property of it_Matrix is empty? Do I have to set it?

Should I add the rows of my matrix into the @SM_BLK1 user table via source code? Should I implement SQL insert statement to populate the tables?

Can someone help me, please?

Regards

Emanuele

former_member689126
Active Contributor
0 Likes

Hi

can you post your code... or send me the code please see my business card for id ..

Regards

Arun

Eneveux
Product and Topic Expert
Product and Topic Expert
0 Likes

Emanuele,

You cannot directly access the Business One Db using stored procedures. You need to access the Business One Db using the API's provided, ie. the DI and UI API's.

With respect to your question in regards to your rows in your grid not being populated ... as stated you need to bind your data to a data source. The example SDK code has a sample for a grid that gives an example of binding data. You may want to review this. You can find the sample at ...

All Programs > SAP Business One > SDK > Samples > COM UI > VB.NET > 19. Grid.

Hope that helps,

Eddy

former_member689126
Active Contributor
0 Likes

Dear Emanuele

Sorry for the delay .The problem was in your DrawForm() function you are again binding the columns to user datasources , which are already binded to a dbdatasource in your srf . Please remove the bindings from the drawform function . I will send the files to you

Hope this will solve your problem

Regards

Arun

Former Member
0 Likes

You are GREAT, Arun.

You solved my issue. Thank you very much.

I hope in future, SAP B1 will create a new more complete tutorial.

I spend a lot of time to compile and run the project shown in the u201CSDKTutorial.chmu201D tutorial.

the actual tutorial misses several tricks and it has some compilation errors.

Regards

Emanuele