In this blog post, I will show you how I was able to add an extension field in a business object extension (XBO) with a value help (via OVS — Object Value Selector) with ID and description.

024 Result Qc 1 3672284

For this case, I applied this to a XBO for InstalledBase. The extension field refers to an Organisational Unit.

Step 1. Define the XBO

In the Solution Explorer, I right-clicked on the solution name, and selected Add > New Item…

The details of the XBO are filled in as follows:

Provide a file name, then click “Add”.

002 Define Xbo 8023819

Select the Namespace and Business Object, then press “OK”.

Step 2. Define the Extension Fields — one for ID, one for Description

Double-click on the XBO, and add the following code:

The ID field (in this case, element ZIB_OrganisationalUnitID) must be defined with an ID data type (in this case, the data type is OrganisationalCentreID). You also need to define the Relation so the ID-Field configuration in the UI Designer will recognize your ID field later.

The description field (ZIB_OrganisationalUnitText) must be defined with a text data type.

Activate the XBO (don’t forget this).

Step 3. Enhance the screen via the XBO

After the XBO has been activated from step 2, right-click on the XBO, and select “Enhance Screen”.

004 Enhance Screen 3600313

Select the floor plans to enhance, and click “OK”.

Step 4. Add the Custom Fields via the UI Designer

So open the floor plan (or screen) by double-clicking the XUI component generated from the previous step in Solution Explorer.

006 Select Floor Plans From Explorer 7638058

Once the UI designer has loaded the XUI component, at the Extensibility Explorer, pick the SectionGroup where the custom field will be stored (in this case, Header is selected). This will provide you with the available Operations.

Select “Add Extension Field to Section Group”, and add the fields you will use (including the description field, even if you will hide it later) by placing a check on the Add field.

008 Add Extension Field 3319419

Click on “Apply”.

Expect a prompt telling you that you will need to activate to see the changes. So, Save and Activate!

Next, under Operations, select “Adjust Properties”.

009 Operations Adjust Properties 8139204

In here, just hide the description field, and click “Apply”.

Step 5. Set the OVS and Description field

Under Operations, select “Change ID-Field Configuration”.

011 Change Id Field Config 5018508

Initially, you will have a compressed screen. Select the field:

…and the menu will expand. Select the OVS Component search.

013 Change Id Field Config 4444037

At the next screen, select “PublicOVS”.

Here, you will need to search the OVS you need. For my requirement, I selected the following, and pressed “OK”:

015 Select Ovs 6593883

The “Target OVS Inport” should populate. Click “Ok” to proceed.

The OVS Component field should be populated now. Next, we go to the Description Field selector:

017 Id Config 5385992

In here, we will pick the description field, and then press “Ok”.

Now that both the OVS Component and Description Field inputs are complete, hit “Apply”.

In case you will want the field to display either the ID or Description only, just adjust the “Presentation Mode” field.

019 Id Config 9928150

Save and Activate. You have to. Do not forget.

Repeat this for each floor plan.

Step 6. Code the value for the description field

Nope… this is not code-free.

So, back at the Solution Explorer, right-click on the XBO, and select “Create Script Files”.

021 Create Script 8071317

Make sure event AfterModify is created, and press “OK”.

Double-click on the AfterModify ABSL file, and add code that will populate the description field.

023 Create Script 9400005

Save. Activate. Test.

The Result

So below is the extension field “Org Unit”, with a value help. Note that both ID and description is provided in the field.

Hitting the value help will show this popup:

025 Result Qc 2473629

If I double-click on ID “F2002”, I return to my Quick Create screen:

And there we go. Happy coding!

New NetWeaver Information at SAP.com

Very Helpfull

 

 

User Rating: Be the first one !