cancel
Showing results for 
Search instead for 
Did you mean: 

Data browser

Former Member
0 Kudos

Hi, i am implementing an addon, with additional data. how can i manage to use the browser arrows for my new form?

thank you, philipp

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

If ur talking abt the Brouse buttons on the tool bar then u can use the menu event and write ur code to brouse the data, In case if ur dealing with a UDO then it will be much easier to use the browse fucntionality with a single line of code. Plz see the following code

objForm.DataBrowser.BrowseBy = "txtDocNo"

If u write the above code for a UDO form browsing will be taken care of.

Hope it helps,

Vasu Natari.

Former Member
0 Kudos

well, i am creating a new form.

but i want that the form is bound to a user defined table. and i want that i can browse trough the data of this table with the arrows in the toolbar.

so how is this possible, because when i debug the program the arrows are not enabled.

and the second question is, how can i bind my data of this table to the items of the table?

Former Member
0 Kudos

Once u load ur form execute the following code to enable the browse buttons.

objForm.EnableMenu("1288", True)
objForm.EnableMenu("1289", True)
objForm.EnableMenu("1290", True)
objForm.EnableMenu("1291", True)

And u can bind the data to the fields directly in the screen painter.

Hope it helps,

Vasu Natari.

Former Member
0 Kudos

what do i write in the menu event then?

how can i navigate to the next recordset?

Former Member
0 Kudos

Just try with this check if its working.

objForm.DataBrowser.BrowseBy = "txtDocNo"

In place of Doc no use a valid item in ur form. and make sure all the items are data bound. I generally use it with UDO, just trry if it works for u too without a UDO.

Else in the menu event u need to get the Existing code or any required value and u need to get the next value from the data base and fill up the form with the values from the data base.

Hope it helps,

Vasu Natari.

Former Member
0 Kudos

Hi,

1)Enable the navigation menus and

2)set databrowser property(of textbox item)

then the navigation will be automatic.

Sandeep.

Former Member
0 Kudos

hi, i have it like this:

      oCreationPackage = (SAPbouiCOM.FormCreationParams)SBO_Application.CreateObject  (SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams);
                oCreationPackage.XmlData = xmlForm.InnerXml;
                oCreationPackage.FormType = "frmStammdaten";
                oCreationPackage.UniqueID = "frmStammdaten";
                oForm = SBO_Application.Forms.AddEx(oCreationPackage);

                oDBDataSource = oForm.DataSources.DBDataSources.Add("@ABC_FUHRPARK");

                oForm.EnableMenu("1288", true);
                oForm.EnableMenu("1289", true);
                oForm.EnableMenu("1290", true);
                oForm.EnableMenu("1291", true);
                                
                oForm.DataBrowser.BrowseBy = "txtKZ";

shouldn't then the auto managed button also be changed if i click on "Find" or "Add"?

When i click on "Find" the editboxes are changed to yellow. but the caption of the button remains the same.

Former Member
0 Kudos

Hi,

U need to bind each and every control to the corresponding field in the DB Table.

Check the below sample for that.

oEdit = oForm.Items.Item("txtTemp1").Specific
oEdit.DataBind.SetBound(True, "@BBBB", "Temp1")

And for the button problem try,

oForm.DefButton = "1" 'Use the UID of the Add update button

Hope this helps u..

Vasu Natari.

Former Member
0 Kudos

hi, thank you the problem first that the binding for the databrowser item wasn't saved.

for the button, shall i give the button a caption? because the caption doesn't change when i click on 'Find' or 'Add'

Former Member
0 Kudos

For the button have the UID as 1 and the mode changes without any issues.

Vasu Natari.

Former Member
0 Kudos

thank you, now it works!

sorry, i have another question. is there a possibility in 2005 to add an entry to the table without using DIAPI??

Former Member
0 Kudos

Well we can use direct SQL Insert statement but its not recommended. But y would u want to do that, cause DI API simplifies everything for u rite..??

Vasu Natari.

Former Member
0 Kudos

so what would you suggest how i should add or update the data to the table?

Former Member
0 Kudos

As per the best practices frm SAP we have to use DI objetcs which are provided. I suggest u use the DI objects.

Just check the below code snippet for adding the values to the data base using the DI objects

Private Function AddMovieToDatabase(ByVal Code As String, ByVal Name As String, ByVal Shelf As Integer, ByVal Space As Integer) As Boolean
        Dim oUsrTbl As SAPbobsCOM.UserTable
        Dim Res As Integer

        AddMovieToDatabase = False

        oUsrTbl = oCompany.UserTables.Item("VIDS")

        oUsrTbl.Code = CInt(Code)
        oUsrTbl.Name = Name
        oUsrTbl.UserFields.Fields.Item("U_SHELF").Value = Shelf
        oUsrTbl.UserFields.Fields.Item("U_SPACE").Value = Space
        Res = oUsrTbl.Add()


        If Res = 0 Then
            AddMovieToDatabase = True
        Else
            SBO_Application.MessageBox("Error, failed to add movie")
        End If
    End Function

U can find the full project in the SDK samples in the following path, C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI DI\VB.NET\UIDIBasicApp\VIDS

Hope it helps u,

Vasu Natari.

Former Member
0 Kudos

Thank you very much!

I only have one problem left, i can't find the user tables i added with the addUDO.

i want to link the object to the table with:

SAPbobsCOM.UserTable oUserTable = oCompany.UserTables.Item("ABC_Fuhrpark");

but unfortunately the table can't be found. in SBO i can only see the tables in the User-Fields dialog, but not in the user tables list.

what can that be? i added the tables as MasterData and Document

Former Member
0 Kudos

I dont know y but i face the same problems i cannot find my tables there... but dont worry.. ur tables are there.. just check directly in SQL.

Vasu Natari.

Former Member
0 Kudos

i know they are there, but how can i insert data then?

Former Member
0 Kudos

Just check the sample code that i have posted thats how u instert data, or u can even use the record set object and execute an SQL Insert statement.

Dim oRec as SAPBOBSCOM.Recordset

oRec = oCompany.GetBusinessObject()

oRec.DoQuery("INSERT INTO.... ")

Vasu Natari.

Former Member
0 Kudos

yeah thank you, but how can i reload the data in the form?

i can see that the data is in the table, but i cannot see the data in sbo.

Former Member
0 Kudos

For reloading the data u need to query the data base and load the values to ur form..... Just check the samples priovided.. I have posted the path of the samples, Check that sample it will asnwer most of ur questions, Run it and check it....

Vasu Natari.

Answers (0)