on 10-06-2008 10:10 AM
HI All
I created a UFT with no object Type. I want to insert muliple rows in tables with one code ,But bydefault fields (Code and Name) are act as Primary Key, so with these fields i am unable to insert data in UFT.
Is There any Idea to change the type of these Fields or any Other Solution.
Thaks In Advance
Hi
If your table is NO_OBJECT table when use this method:
- for Code column you can use function what read MAX(Code) and return the value MAX(Code + 1).
- set Name=Code.
Regards
Sierdna S.
Note: it may be "00000001", "00000002", "000000AA", "000000AB", "0000AAAZ",...
so you need some function what make convertion...
Public Function getStrNextCode(ByVal sTableName As String) As String
Dim oRecordset As SAPbobsCOM.Recordset
oRecordset = SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
Dim sRetValue As Long = -1
Dim code As String
Try
oRecordset.DoQuery("SELECT COALESCE(MAX(code), '00000000') AS code FROM " & _
sTableName & " WHERE LEN(Code) = 8 ")
If oRecordset.RecordCount > 0 Then
oRecordset.MoveFirst()
code = oRecordset.Fields.Item(0).Value
If code = "" Then code = "0"
sRetValue = code
End If
Catch ex As Exception
sRetValue = -1
Finally
oRecordset = Nothing
End Try
Return (sRetValue + 1).PadLeft(8, "0")
End Function
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
create userdefined objects - the master_data_lines or document_data_lines
will contain your line data than.
but you can't access them with DIAPI.
lg David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
use document type table and insert docentry along with them
regards,
varma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
6 | |
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.