DI + UDO
I created two table for Purchase Requisition @OPRE and @PRE1, and I register them to an object.
Can I use DI to insert / delete / update these table? Just like doing it in system table?
Gabriel Vasquez replied
What you need to do is this:
If using UI API:
Add a button to your form (not id 1 or 2)...
Or if you are using any other application...
From this button (or application) call a routine that reads your text file into a DataSet or RecordSet, then you have to go through this data making inserts for each line... something like this
Dim strQuery as String = "" Dim intLastEntry as Integer = 0 Dim intLastLine as Integer = 0 Dim rs as RecordSet as SapBobsCOM.RecordSet rs = CompanyObject.GetBusinessObject(SapBobsCOM.oRecordSet) strQuery = "SELECT MAX(DocEntry) as Last FROM [@OPRE]" rs.DoQuery(strQuery) If rs.RecordCount > 0 Then intLastEntry = CInt(rs.Fields.Item("Last").Value) + 1 Else intLastEntry = 1 End If For i as integer = 0 to DataSet.Table("@OPRE").Rows.Count - 1 strQuery = " INSERT INTO @OPRE (DocEntry, Columns) " + _ " VALUES (" + intLastEntry.ToString() + ", " + _ DataSet.Table("@OPRE").Rows(i).Colums + ")" '//This next line Make the insert in the master table. rs.DoQuery(strQuery) intLastEntry += 1 For j as integer = 0 to DataSet.Table("@PRE1").Rows.Count - 1 intLastLine = j + 1 strQuery = " INSERT INTO @OPRE (DocEntry, LineNum, Columns) " " VALUES (" + intLastEntry.ToString() + ", " + _ intLastLine.ToString() + ", " + _ DataSet.Table("@PRE1").Rows(j).Colums + ")" '//This next line Make the insert in the detail table. rs.DoQuery(strQuery) Next j Next i
Hope it helps