Skip to Content
0
Former Member
May 10, 2010 at 09:13 AM

Updating rows in a master-detail udo form

341 Views

Dear Sirs,

I'm using a form connected to a UDO and I want to use standard services provided by SAP.

In a column I have a CFL button, and if I set a new rows data with the following code in the et_CHOOSE_FROM_LIST event:

oDetailDS.SetValue("U_ItemCode", pVal.Row - 1, code); // code and name are variables containing values returned by the CFL

oDetailDS.SetValue("U_ItemName", pVal.Row - 1, name);

oMatrix.SetLineData(pVal.Row);

this works fine until I add new rows in sequece, but if I attempt to modify an already inserted row, the sysstem gives the following error:

"This entry already exist in the following tables "(@MY_UDO_ROWS) (ODBC -2035) [Message 131-183]

Replacing the previous code with the following one:

oDetailDS.Clear();

oDetailDS.InsertRecord(0);

oDetailDS.SetValue("U_ItemCode", 0, code);

oDetailDS.SetValue("U_ItemName", 0, name);

oMatrix.SetLineData(pVal.Row);

oDetailDS.Clear();

oMatrix.FlushToDataSource();

the system let my update existing rows, but the both lineid and visorder fields are completely re-entered with new values and this make me loose all previous references and also change the order data are presente on the matrix.

Can anyone help me to find the right way to insert neew rows and update existing ones?

Thank you for the attention

Massimo Landi