cancel
Showing results for 
Search instead for 
Did you mean: 

Add a new field in an existing Form and corresponding business object

rajesh_khater
Active Participant
0 Kudos
633

Hi,

I have seen examples of adding new forms and creating User Defined Objects. Is there a detailed example on adding a field in an existing Form and its corresponding business object, and persisting the same to the database, including user input validations?

Example, I want to programmatically add a new field in the detail section (grid / matrix) of a Marketing Document, and save it to database and read it back when the document is opened.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Rajesh,

This can be achieved by adding a UDF to the Rows of the Marketing Documents.

This will add the UDF to the Row level of all Marketing documents, the values will be saved and shown every time the document is opened.

There are other ways of doing this, but this is the simplest and quickest.

Regards,

Daniel

rajesh_khater
Active Participant
0 Kudos

Thanks, but I am not looking at the simplest and quickest

I want to understand how to do it programmatically. I already know who to programmatically create a new form and a new table, but I am not very clear how to programmatically add a new field in an existing form and an existing object and existing table.

For example, if I add a new field in an existing Form, should I add the corresponding database field in the same existing database table, or we have to create a User Defined Table, or we can take any of the approaches.

Another issue is: From the SBO menus, when we add a UDF to the header of a marketing document, such UDFs are shown in a separate form adjacent to the main form. But I want to add it in the main form directly using the SDK.

I need an example showing how to add a new field in an existing form, save it to a new field in the same database table and read it back from the database table.

edy_simon
Active Contributor
0 Kudos

Hi Rajesh,

For a start here is some rule :

1. You can add an item to any place on the form in the header.

2. You can not add an Extra column to a System Matrix. - your only option is what   show you.

If you need to add a field in an existing system form(in header) and you want this to save into the same system table then :

1. You need to add a UDF in SBO.

2. Using SDK, on the form load event, add an item to this form.

3. Bind this Item to the DBDataSource. (existing UDF value. No need to create a new datasource)

4. Loading/Saving is handled automatically by SAP.

If you need to add a field in an existing system form(in header) and the source is from your UDT :

1. On form load event, add the item + add the DBDatasource/DataTable to this form.

2. Bind the Item to the DBDataSource/DataTable

3. On form data load event, query up your DBDatasource/Datatable  to load the correct record.

4. On After form data add/Update event, write your value to your DBDataSource/DataTable manually.

Hope it gives you some idea.

Regards

Edy

rajesh_khater
Active Participant
0 Kudos

Thanks. That helps.

A few clarifications:

1. You said we cannot add an extra column in a System Matrix. However, I remember seeing some examples where using the SBO menus, we can a UDF to the repeating section in a Marketing Document, which will render as a new column in the matrix or grid on the form.

2. If I add a UDF using SBO menus, it will show in the List of UDFs. If I add it programmatically, will it still show in the List of UDFs and Form Settings?

rajesh_khater
Active Participant
0 Kudos

Hi Edy, Can you also give your valuable suggestions on this thread: http://scn.sap.com/thread/3453172

edy_simon
Active Contributor
0 Kudos

Hi Rajesh,

1. As I mentioned, You can only add the columns by Daniel's suggestion. You cannot use coding to add a column in a matrix - without a UDF. BTW, you can add a UDF either from Coding/SBO Application. When I refer to you cannot add a column in the matrix, is adding the column without the UDF.

2. Yes they will.

Regards

Edy

Former Member
0 Kudos

Hi,

I have adding new & existing forms and creating User Defined Field in row. example on adding a field in an existing Form and its corresponding to the database, including user input validations?

I want to add a new field in the detail section ( row area ) of a Production Document, and save it to database and read it back when the document is opened.

Thanks.

Syed Waqar Khurshid

Answers (0)