Showing results for 
Search instead for 
Did you mean: 

Update Form Setting using SDK

Former Member
0 Kudos

Is there a way to update form settings of system form (e.g. PO) using SDK? I am using SAP 2004B.

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Clarence,

Lookup "FormPreferencesService" in the SDK Help Center, serach for it and you will see that it is for...

"This service enables to get and update the display preferences of a specified form for a specified user."

I hope this is what you looking for.

Active Contributor
0 Kudos

Hi... I can see you using SBO2004B... FormPreferencesService is only avaiable for SBO2005A at the moment...

Example for the SDK help

Dim oCmpSrv As SAPbobsCOM.CompanyService
Dim oFormPreferencesService As FormPreferencesService
Dim oColsPreferences As ColumnsPreferences
Dim oColPreferencesParams As ColumnsPreferencesParams
Dim i As Integer

'get company service
oCmpSrv = oCompany.GetCompanyService

'get Form Preferences Service
oFormPreferencesService = oCmpSrv.GetBusinessService(ServiceTypes.FormPreferencesService)

'get Columns Preferences Params
oColPreferencesParams = oFormPreferencesService.GetDataInterface(FormPreferencesServiceDataInterfaces.fpsdiColumnsPreferencesParams)

'set the form id (e.g. A/R invoice=133)
oColPreferencesParams.FormID = "133"

'set the user id (e.g manager= 1)
oColPreferencesParams.User = 1

'get the Columns Preferences according to the formId & user id
oColsPreferences = oFormPreferencesService.GetColumnsPreferences(oColPreferencesParams)

'change the width of all the visible items
For i = 0 To oColsPreferences.Count - 1
    'check if the item is visible
    If oColsPreferences.Item(i).VisibleInForm = BoYesNoEnum.tYES Then
        'set the width of the item
        oColsPreferences.Item(i).Width = 100
    End If

'update all changes
oFormPreferencesService.UpdateColumnsPreferences(oColPreferencesParams, oColsPreferences)

Answers (0)