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.
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!!!