on 05-10-2010 10:13 AM
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
Hi try using this code for inserting
DBDataSource matrixDataSource = form.DataSources.DBDataSources.Item(itemUid);
matrixDataSource.Clear();
matrix.AddRow();
int nextRowNumber = row;
matrix.GetLineData(nextRowNumber);
UserDataSource userDataSource = form.DataSources.UserDataSources.Item("RowNumDS");
userDataSource.ValueEx = nextRowNumber.ToString("D");
matrix.SetLineData(nextRowNumber);
matrix.FlushToDataSource();
You have to add RowNumDS userdatasource to your form add bind first column in matrix to this UDS.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Plz go this way..
1. Create Data Browser object of that form.
2. Go find mode and choose ur id in CFL then system will support u update data (Only this way u can update)
3. If u want this automatically plz u can achieve this procedure by writing code also
By
Firos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Whenever you make changes to the existing record and want to update the record, you need to delete all the records from the child table pertaining to that entry. use the below code in BeforeAction=true.
If pVal.BeforeAction = True Then
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED Then
oForm = oSBOApplication.Forms.ActiveForm
If pVal.ItemUID = "1" And pVal.FormMode = 2 Then
oEdit = oForm.Items.Item("txtOpnCode").Specific 'you master document number/code
oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oRecordSet.DoQuery("delete from [@MY_UDO_ROWS ] where [Code/DocNum]='" & oEdit.Value & "'")
End If
End If
End If
Regards,
Noor
Edited by: noor_023 on May 10, 2010 4:41 PM
Edited by: noor_023 on May 10, 2010 4:42 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.