cancel
Showing results for 
Search instead for 
Did you mean: 

UDO/MasterData/DetailData/Custom Form/Matrix

Former Member
0 Kudos

Hi guys,

looking for topics about a custom form which uses "UDO", "MasterData/DeatilsData" and Matrix (for row's detail data) I wasn't able to find a complete solution!

I think that many developers needs something like the following:

1. By Sap B1 create an User Defined Object (UDO)

2. By Screen Painter Create a custom form and link it with UDO created before.

3. By Screen Painter put on it some Edit Fields to handle MasterData and link them to Master Table's fields.

4. By Screen Painter put on it a Matrix to handle DetailsData and link each coumn to Details Table's fields.

OK....

Now we should do some operations ( Add/Update/Delete).

<b>1. Add operation</b>

-


Filling the Edit fields (which are linked with MasterData table) and adding a few rows into Matrix (the quantity of rows is not a problem) which is linked with DetailsData Table.

Now we can click on "Add" button and all the data are saved into database. Perfect!

<b>2. Update operation (just trying to change data)</b>

-


I search the last record added (one in Master Table and a few in Details Table) by sap b1 and all data are ok!

Now I try to change some data in Edit Fileds and/or in Matrix and then click on "Update" button. All works fine! All the data are updated in databases. Perfect!

<b>3. Update operation (trying to delete a row from Matrix)</b>

-


Now, catching an event, I try to delete (by code) a Matrix's row.

In this case (<i>and here is the PROBLEM N.1</i>) the default button (with UniqueId=1) not change itself to "Update" and so I can't save the changes.

Anyway to work around this problem I make a fake change on any of the others fields in the form (and so the default button change itself to "Update").

Now I can click on Update button and the changes I made are saved into database.

<b>4. Update operation (trying to add a row into Matrix)</b>

-


Now, using a button (or an event, is the same), I add a row (or more then one, is the same) into Matrix and I fill all its columns.

The default button change itself to "Update" but clicking on it (<i>here is the PROBLEM N.2</i>) the data are not saved into database (the new rows inserted in Matrix was not saved).

<b>5. Delete operation</b>

-


Trying to delete all data (Master record and Details record) all works fine. Perfect!

I spent so much time to write this post describing step-by-step where the problems are. And so I hope to get suggestions from you (all) in order to solve these "hard" issues.

I hope this post will become the final solution for everybody!!!

Regards,

Piero Cannizzaro

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Piero,

We have the reverse problem. Hopefully we can help each other for this problem

For your problem no 2, I don't have any problem with adding new row and save to database.

When you click on Add row menu, write the code to handle the menu event as below(@LINEDATA is the table name):

<b>oDBDatasource = oForm.DataSources.DBDataSources.Item("@LINEDATA")

oDBDatasource.Clear()

oMatrix.AddRow()</b>

With this code, when i add a new row, and update, it will save to my database.

The problem i encountered is the Delete Row. Let say, I have 3 rows of data in my matrix. When i delete a row and click update, It will delete from my screen (matrix). But when i look into my table, the row data is STILL EXIST!!!, but system set all my columns to NULL value except Code, LineID, and Object Column. The row is still 3.

How about your data? Did you check your table whether it REALLY delete from it??? OR it just a fake deletion (on matrix only)??? Any suggestion on this??

I also spend a lot of time on this. Hopefully somebody can help me on this.

Thanks & Rgds,

Harianto Ng

Former Member
0 Kudos

Hi Harianto,

it would be nice to help each other for this problem

The code you have suggested to me (below) work fine, thanks!


oDBDatasource = oForm.DataSources.DBDataSources.Item("@LINEDATA")
oDBDatasource.Clear()
oMatrix.AddRow()

Now I'm trying to do the following:

In my custom form I've a matrix which contains the details of my data.

I would like to add (into a column) a progressive number for each row in my matrix when the user add a new row in the matrix.

How can I handle it?

Former Member
0 Kudos

Hi, I'm having this same problem (the second one) and can't make the code suggested to work:

oDBDatasource = oForm.DataSources.DBDataSources.Item("@LINEDATA")

oDBDatasource.Clear()

oMatrix.AddRow()

that doesn't work because when I click on the Update button, it gives me an error that says DocEntry cannot be NULL, and this is happening because the form should have been in ADD_MODE. But neither i can change the mode to ADD, because if I do this, the matrix would try to add all the previous (existing) UDOs back...

How did you configure your form to use that code?

Former Member
0 Kudos

Hi Piero!

At your first problem it seems that the form is has the value "AffectsFormMode" set to false, so it does not throw a validate event so the button isn't changed...

The second problem I'm not sure, maybe someone else could help you...

Grtz, Rowdy

Former Member
0 Kudos

Hi Rowdy,

by Screen Painter I had set the Matrix's property "SelectionMode=ms_Single" in order to allow the user to select one row per time. Once the row is selected I remove the row from the matrix by the following code:


int selectedRowIndex = mx.GetNextSelectedRow(0, SAPbouiCOM.BoOrderType.ot_RowOrder);
if (selectedRowIndex > -1)
{
    mx.DeleteRow(selectedRowIndex);
}

where <b>mx</b> is my Matrix.

And even if the property AffectsFormMode is set to <b>true</b> the default button not change itself to "Update".

P.s. You have a nice web site

Former Member
0 Kudos

One more useful info:

I click on a row of my Matrix.

I go to "Data" menu (on menu bar) and I've seen the menu item "delete row Ctrl+K" is turned off.

p.s. I traslate the menu item's name from Italian so I hope you understand.

Former Member
0 Kudos

up!

Former Member
0 Kudos

Hi! R. Schwachofer

I try do things that the from is the "value"AffectsFormMode" set true ,but the button isn't changed "update".

when i delete a row ,i write code ( from.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE) ,the button changed "update",i cann't delete data from database.

can you help me .