cancel
Showing results for 
Search instead for 
Did you mean: 

Update object in SBO 1

Former Member
0 Kudos

How would you modify a database field with a value you obtain from a form using the update object? I have tried:

dbItem.ItemCode = code;

dbItem.ItemName = reg;

dbItem.SWW = make;

dbItem.ForeignName = model;

int x;

x = dbItem.Update();

if (x == 0)

{

SBO_Application.MessageBox("Vehicle details updated!", 1, "Ok", "", "");

}

else

{

SBO_Application.MessageBox("Error, failed to update vehicle details!!", 1, "Ok", "", "");

}

where code, reg, make and model are string variables but it is not updating. Should i specify the actual row in the database that i want to update?

Accepted Solutions (1)

Accepted Solutions (1)

Nussi
Active Contributor
0 Kudos

Hi Duncan,

your code looks good, but you have to "fetch" the item before

dbItem.GetByKey(code);

also be aware that you can only change the itemcode if the item isn't used in a document before.

lg David

Former Member
0 Kudos

Hey thanx man the 'GetByKey' totaly solved the issue!! I have another unrelated question about activating the navigation buttons in sap so that i could use them with the form. This is how am trying to do it:

oForm.DataBrowser.BrowseBy = code;

where code is a string variable. Is this the way it is done?

Answers (0)