cancel
Showing results for 
Search instead for 
Did you mean: 

form

former_member193355
Contributor
0 Kudos

Dear All,

We would like to copy a certain layout for example form layout sales order from user 1 to user 2 but both are different database. The databases are located in the same server. Can we use an SQL script to do that ?

Pls give advice.

Steve

Accepted Solutions (1)

Accepted Solutions (1)

former_member193355
Contributor
0 Kudos

Hi All,

Pls share if you have similar script that can be used to copy the layout.

I appreciate it so much. TIA

Steve

Former Member
0 Kudos

Steve,

Running a SQL script to change the values in the database is forbidden and you will lose SAP support. So I advise u to use the DI objects provided to have the same form preferences for both the users in both the data bases.

The DI objects that u need to use are FormPreferencesService and ColumnsPreferences Collection.

Please check the following sample provided by SAP.

The following is a VB.NET sample that updates the width of all the visible items in the invoice form settings.

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
Next

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

In the same way u can modify the code to copy form one company to another company, for more information check the help file provided.

Vasu Natari.

Former Member
0 Kudos

Steve,

if is it one report only, the quickest way is open the layout in PLD, select all and copy it to clipboard. In the same SAP application change company, log to another db (but dont close SBO), create new blank layout and paste the clipboard there. Its easy and it works.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Yes u can doo that and at the same time ensure that u have taken a fresh backup before that. And did u try and use Copy Express Add on.

Vasu Natari.

former_member193355
Contributor
0 Kudos

Dear Vasu,

Thx for quick answer. What I mean is just copy layout e.g. SO layout from db A where the source user is manager and the target is the SO layout in db B where the target user is bill levine.

If I use CX, it will also copy the data. I just need to make the SO layout uniform to other users. If there are 5 fields/columns in the SO rows of user manager then in the other user e.g. bill levine will have the SO where its rows columns / fields 5 too. The column / fields name are also same for both.

I prefer to use SQL script. Could you pls give advice ? TIA

Steve

Former Member
0 Kudos

Hi,

Sorry for my late reply,

U need to copy the layout from 2 tables RITM and RDOC. From these 2 tables select only the records where AUTHOR field contains ur required user. After selecting these records Insert them to the target database.

Vasu Natari.

former_member193355
Contributor
0 Kudos

Dear Vasu,

No problem. Thanks for answer. What I mean here is not PLD form but UI form. For example: in row of sales order when user A is currently running SAP B1, there are only 6 fields/columns in the sales order row (RDR1 table). The db is live_db_A.

What I want is that the sales order row columns in live_db_A that is used by user A are copied to sales order row that will be used by user B in the live_db_B.

I only have this query script:

Declare @target as smallint

Declare @source as smallint

Declare @form as nvarchar(20)

Set @target = 5

Set @form = 132

Set @source = 65

if exists (select 1 from sysobjects where name = 'temp_settings')

Begin drop table temp_settings End

Select * into temp_settings from CPRF where usersign = @source and

FormID = @form Delete from CPRF where usersign = @target and FormID =

@form Update temp_settings Set usersign = @target Insert into CPRF

Select * from temp_settings Drop Table temp_settings

The above query is only useful to copy form layout from one user to other in the single live_db but not db to db.

Pls give adv. TIA

Rgd,

Steve

former_member193355
Contributor
0 Kudos

Dear Vasu,

No problem. Thanks for answer. What I mean here is not PLD form but UI form. For example: in row of sales order when user A is currently running SAP B1, there are only 6 fields/columns in the sales order row (RDR1 table). The db is live_db_A.

What I want is that the sales order row columns in live_db_A that is used by user A are copied to sales order row that will be used by user B in the live_db_B.

I only have this query script:

Declare @target as smallint

Declare @source as smallint

Declare @form as nvarchar(20)

Set @target = 5

Set @form = 132

Set @source = 65

if exists (select 1 from sysobjects where name = 'temp_settings')

Begin drop table temp_settings End

Select * into temp_settings from CPRF where usersign = @source and

FormID = @form Delete from CPRF where usersign = @target and FormID =

@form Update temp_settings Set usersign = @target Insert into CPRF

Select * from temp_settings Drop Table temp_settings

The above query is only useful to copy form layout from one user to other in the single live_db but not db to db.

Pls give adv. TIA

Rgd,

Steve