on 10-02-2008 11:24 AM
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?
Ken
Hi Ken,
If you have register your UDO, it's not necessary to code Insert/Delete/update for it.
If you add in your form the button OK/Add (ID 1), SAP insert/update/delete automatically the data, you are no nothing to do with DI.
Regards
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
GAB
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
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.