Skip to Content

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.

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”.

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”.

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.

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.

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”.

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”.

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

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

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”:

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:

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.

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”.

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.

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:

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

And there we go. Happy coding!

To report this post you need to login first.

5 Comments

You must be Logged on to comment or reply to a post.

  1. Krishnendu Laha

    Hi John,

    Thanks for your gigantic effort to explain in detail.

    But I am scared, because of so much effort only to add a Value Help for a custom defined field! which can be done in ease in ABAP (ERP and CRM) environment. Is not any other way to minimize the effort?

    Regards,
    Krish

    (0) 
  2. Jens Mechelhoff

    Hi John,

    many thanks for your tutorial. I followed all your steps and have one issue because I observed some “confusing states”.

    For example, I have an entry (“19999 Best Sales Department”) in the field, which I created by following your steps. As a business user, I want to edit this entry now. By using the OVS, I select an other Sales Organisation but then only the ID updates immediately, while the description stays wrong (like “20000 Best Sales Department”). The After-Modify-Event is triggered only by clicking save. Then, the displayed text becomes correct (to “20000 Greatest Sales Department”).

    So there is this one state, where a business user sees the new ID with an old description, which leads to misunderstandings.

    Did you detect the same issue? A solution might be to trigger the update script for the description field directly after leaving the OVS. Do you have any ideas how to implement that functionality?

    Kind regards,

    Jens

    (0) 
    1. John Benedict Reynoso Post author

      Hi, Jens.

      Apologies for the late reply.

      Here is what I observed:

      • When the OVS is used, when a new ID is selected, the new description is immediately displayed.
      • When an ID is directly inputted on the field, the new description will only appear after pressing Enter (to trigger the AfterModify event).
      • When I type a new ID, and click on another field, the field will refresh with the new description after a few seconds.

      Maybe there is a way to trigger AfterModify after leaving the field.

      Kind regards,

      John

      (0) 

Leave a Reply