cancel
Showing results for 
Search instead for 
Did you mean: 

saving data in table

Former Member
0 Kudos

I have created a User defined form. I have created a document table and one document row table for that.

Now please can anyone tell me that how to save the data of that document in table on click of OK button.

Also I want to know the Unique ID of Update Button.

Please help me.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hai itsathish,

1) Set the ok button id as 1.

2)Using dbdatasource bind all the items.

3)Create UDo

4)Then u click the Add button.it will Automatically Add.

Answers (1)

Answers (1)

Former Member
0 Kudos

These are covered in the SDK help file and in numerous other posts on the forum, but to get you on the right track:

If you place a button on your form with ID = 1 it becomes the "OK/ADD/UPDATE" button.

Catch the event of the user clicking the button and then use this code (taken directly from SDK helpfile)

Private Sub Add_Data_Click()
    Dim oUserTable As SAPbobsCOM.UserTable
    Set oUserTable = oCompany.UserTables.Item("MyUDT")

   'Uncomment this line if updating a record
   'oUserTable.GetByKey ("1")

    'Set default, mandatory fields
    oUserTable.DocEntry= 1
    'Set user field
    oUserTable.UserFields.Fields.Item("U_AlbUDF").Value = "1"

    oUserTable.Add

    If ret <> 0 Then
        oCompany.GetLastError ret, Str
        MsgBox Str
    Else
        MsgBox "Value to field: '" & oUserTable.UserFields.Fields.Item("U_AlbUDF").Name & "' was updated successfuly to " & oUserTable.TableName & " Table"
    End If
End Sub

Search the forums and the SDK help file for more info as this type of question has been asked many times before.