Skip to Content
Author's profile photo Anderson Balieiro

Create a dynamic codelist from BCO and BCC

Hello folks,

Hope you are doing great.

I’m blogging here because I saw no material centralizing how to create a field with dynamic dropdown being completed and determined from existing values in other fields.


So, first of all you need to create a new object

Define the follow field like below:

I fill with the follow values (for only example):

The data create above will be our reference field with the reference data.

So now, we need to create the second codelist. We will repeat the above step for the follow data:

Now we need to create the extended field in the BO.

For this example we will use the Customer Extended Object like below:

import AP.Common.GDT;

import AP.FO.BusinessPartner.Global;

[Extension] businessobject AP.FO.BusinessPartner.Global:Customer {

        // You must activate this business object before you can access the extension fields

        // or messages in script files, forms, and screens.

           

             node AddressInformation {

           }

  

             node Common {

                    [Label(“Estado”)] element Estado:DEVESTADOCode;

                    [Label(“Cidade”)] element Cidade:DEVCIDADECode;

           }

  

             node CurrentEmployeeResponsible {

           }  

}

Note that element type is the codelist create from BCO.

Save and actvate all objects.

In the final step we will create a Embedded Component to insert these fields.

So, go in the Create new item and select the follow option

After create then in your Solution use the double click and open then.

First of all, you will select in the “BO Browser” and field created in the Extended Business Object like below:

Drag and drop to the screen in the Design tab

Add the field

Drag and Drop the fields from Select Elements and your Data Model will be stay like below:

Now go to the Controller tab

In the Inport folder create a new Inport like below

Add new parameter and configure then like below:

So, with the Inport selected go to the “Properties” tab

Set the “RequestFireOnInicialization” to value “True”

And create a new event in the “OnFire” events

In the event “Inicialize” configure something like that:

For your referente to create one EC follow the video:

Cloud Application Studio: Add Facet (Embedded Component) based on BO Extensions – YouTube

In the last step, back to the “Data Model” tab and click with the right button in the “Cidade” field (the field that will be used from referenced field).

Select the option “Codelist Context Mapping”

Select the field used in the BCO referenced with the field Extended Bussines Object

Click “OK”.

Now Save and Activate your EC (Embedded Component).

The process is done.

In your test the field “Cidade” will bee populate from data selected in the “Estado” field like below:

Regards

Assigned tags

      19 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Great tutorial! Thank you! 🙂

      Author's profile photo Former Member
      Former Member

      Hi Anderson Balieiro,

      Great documentation .......Thanks for sharing ...........

      Author's profile photo Bin Huang
      Bin Huang

      Hi Anderson,

           I can not follow this step, I can not get the ,thanks.

          

      Author's profile photo Anderson Balieiro
      Anderson Balieiro
      Blog Post Author

      Bin, whats appears for you ?

      Author's profile photo Bin Huang
      Bin Huang

      Hi Anderson,

           After create Embedded Component, my screen is below, I can't "select in the "BO Browser" and field created in the Extended Business Object", and I can't "drag and drop to the screen in the Design tab".

           How can I do? Thanks.

      Best Regards.

          

          

      Author's profile photo Saurabh Kabra
      Saurabh Kabra

      Hi BIn,

      It will be on Right Hand Side of your UI Designer. And still if you are not able to see "BO Browser/Data Model" choose it from designer's menu bar as follow:

      Pic.PNG

      Thanks

      Saurabh

      Author's profile photo Anderson Balieiro
      Anderson Balieiro
      Blog Post Author

      As suggested by Saurabh the view is need to selected in the menu "View" to display like I explained.

      Try do what Saurabh suggested and if you have more any issues, back to us

      Author's profile photo Andres Gutierrez
      Andres Gutierrez

      Hi Anderson,

      Quicl Question: I tried the same excersice as described here, but both codelist are always empty. Any idea what I'm doing wrong?

      kind regards,

      Andres

      Author's profile photo Bin Huang
      Bin Huang

      Hi Andres,

      Me too, it is empty in both codelist, what is the problem?

      Have you solved it? Could you share me your experience?

      Thanks a lot.

      Benny

      Author's profile photo Bin Huang
      Bin Huang

      Hi experts & Andres,

      I get the reason, the project need to create a bacelement, change the question for reviewed it, and deploy it.

      Thanks a lot.

      Benny

      Author's profile photo Ashish Sharma
      Ashish Sharma

      Hi Experts ,

      Its not working for me as well.

      @ Anderson - Hi , If possible please provide some more screen shots or pdf docs if you have.

      or give your skype ID So that I can ping you there for checking this.

      Thanks
      Ashish Sharma
       

      Author's profile photo Ashish Sharma
      Ashish Sharma

      My Requirement is , I need a drop down list ONLY without an EC and in which whenever required

      I can add the values.

      Can I do this using this ?

      Please help.

      Author's profile photo Bin Huang
      Bin Huang

      Hi experts,

      It need the step:

      Best Regards,

      Benny

       

      Author's profile photo Bin Huang
      Bin Huang

      Hi Anderson & experts,

      Now I do the code list with Embedded Component, as the picture:

      But the UI is just running when I edit the parentID record.

      The problem:

      If I add a new parentID record, before save the parentID record, it can't add the child record.

      What can I adjust the UI?

      Thanks a lot.

      Best Regards,

      Benny

      Author's profile photo Bin Huang
      Bin Huang

      Hi Anderson & experts,

      I using the UUID as the parameter, it is OK.

      Now I using the CustomBO as:

      If using the "shadow" BO, which step I need to do?

      Thanks a lot.

      Benny

      Author's profile photo Bin Huang
      Bin Huang

      Hi Anderson & experts,

      I using the “shadow” BO, the list cann't add row, but I don't know what is the problem, could you help me? Thanks a lot.

      The result, add row is disabled

      the init eventhandler as

      the inport as

      the datamodel as

      Benny

      Author's profile photo Bin Huang
      Bin Huang

      Hi Anderson & experts,

      It is OK, view the Stefan's blog: https://blogs.sap.com/2014/04/02/sap-application-studio-1402-add-ec-with-custom-bo-to-standard-screen/

      Thanks a lot.

      Benny

      Author's profile photo Sampath Kumar Narayanan
      Sampath Kumar Narayanan

       

      Hi Anderson,

       

      Nice Blog. Thanks for sharing. We have a situation to maintain the Code List for the Custom BC.

      But, trying to find the Patch in Fine-tuning to maintain Code List for the custom BCC/BCO (though “Values can be added or Deleted in Fine-Tuning” option is selected in BCC.

      Where do you maintain BCC value in fine-tuning please? I could not find the patch solution name listed or any suitable option for maintaining Code List listed in Fine-Tuning.

      Appreciate your help and early response.

      Thanks

      Sampath

      Author's profile photo Sampath Kumar Narayanan
      Sampath Kumar Narayanan

       

      Hi Anderson,

       

      Any inputs for my earlier query please?

      Since maintaining values via fine-tuning not possible (or seems to me as of now), I have maintained these values manually.

      What I am noticing is the dependent dropdown is working perfectly - filtering based on the parent dropdown value selection.

      Only issue is dependent dropdown only shows Code values in the drop down (in both columns) - though in "CodePresentationMode" property for the EC field, have selected "CodeandValue".

       

      Can you please advice. Appreciate your early response.

       

      Thanks

      Sampath Kumar N