cancel
Showing results for 
Search instead for 
Did you mean: 

How to deal with context dependant code lists?

ralf_baumann
Participant

Hi ByD studio forum,

recently one of the ByD solution partner raised an interesting questing regarding context dependant codelists. I create this thread to share the question and the answers (provided by Thomas Schneider) to it with the community.

Most of the ByD codelists are context independant and contain a list of unique values. Some of the codelists (i.e. WorkAgreementAdministrativeCategoryCode) are context dependant and the code value is only unique within a certain context, i.e. country, region.

Example - WorkAgreementAdministrativeCategoryCode:

List IDCode ValueDescription
AT1Hourly
AT2Salaried Employee
AT3Manager
AU1Hourly
AU2Salaried Employee
AU3Manager
BE1Hourly
BE2Salaried Employee
BE3Manager
BR1Salaried Employee

In a custom BO a element typed with an context dependant codelist is defined and should be placed on a custom UI.

import AP.Common.GDT as apCommonGDT;

businessobject CodeListMapping_Test {

             element CustomerWorkAgreementAdministrativeCategoryCode : WorkAgreementAdministrativeCategoryCode;

}


In UI-Designer however is the required ListID not available by default:

So how can a ByD studio developer deal with context dependant codelist?

Best regards,

Ralf

Accepted Solutions (1)

Accepted Solutions (1)

ThomasSchneider
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ralf,

you need the contxt of the GDT in the BO: 

import AP.Common.GDT as apCommonGDT;

businessobject CodeListMapping_Test { 

   element CountryCode : CountryCode;

   element CustomerWorkAgreementAdministrativeCategoryCode :
                WorkAgreementAdministrativeCategoryCode;

}

As a next step, go to the UI designer, select the data element CustomerWorkAgreementAdministrativeCategoryCode.content, and select "Codelist Context Mapping" from the context menu. You can maintain the context of the structured code as shown in the following figure:

Save and activate the UI model. The result is as follows:

If you set the CountryCode field (via UI or via coding) the Customer....Code code list is filterted by the country code. You can also set the Customer....Code.listID in ABSL code if the element is filled via code.

DavidRSG
Explorer
0 Kudos

Hi

I have a similar problem, but for units of measure (UoM). I don't know what and how to apply the context to the Quantity field so that it only shows me the sales units available for the product as shown in the sales order. Do you have any suggestions?

Greetings!

Answers (1)

Answers (1)

vinodkumar_kommineni
Active Contributor
0 Kudos

Hi Ralf,

We are trying to implement the similar scenario in this thread.

But System says Key is not unique. Specify a unique combination of key field values.

Comparing with the same example if we give the combination of AT 1 and AU 1 it is not accepting them as two different keys unfortunately. But AT 1 and AT 2 works fine.

Here the field taking AT/AU is defined as an attribute and the field taking 1/2 is the Key within BCO.

All are custom fields. Nothing standard is involved here. Any idea why system is behaving this way ? Our tenant is on 1311.

Regards

Vinod

former_member253394
Participant
0 Kudos

Hi Thomas,

I am not able to see the context property in the Data Model for the Code list as shown below:

Thanks & Regards,

Malkit Singh

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Malkit,

The "Codelist Context Mapping" is available via right-mouse-click in the left part of the display of the Data Model, not in the Properties.

HTH,

   Horst

former_member200567
Active Contributor
0 Kudos

Hi Horst,

I want to use Context Mapping for CashDiscountTermsCode for Supplier and Customer.

Here is the Model Codelist Context Mapping of content.

I tried some data types and binding. Still cannot get the required result.

Which Mapping Parameter should I used to get a dependent code list regarding Supplier and Customer.

Best Regards

Fred

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Fred,

This context structure is like a search structure of a query:

  • Based on the values of this context structure the value help (query) is restricted

As the BusinessPartnerRoleCode (which is used to differentiate between a Supplier and a Customer and other BuPa roles) is not part of this context structure, you can not restrict the value help on that kind of parameter.

Sorry,

     Horst

former_member200567
Active Contributor
0 Kudos

Hi Horst,

Thanks.

Is there any other way I can restrict the code list?

Best Regards,

Fred

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Fred,

I assume you want something dynamically because you know how to define a static code list.

Do you have an UI where the values are returned liek the ones you expect?

I wold take a glimpse there.

I don't know a more specific way.

Sorry,

   Horst

former_member200567
Active Contributor
0 Kudos

Hi Horst,

In Accounts and Suppliers, CashDiscountTermsCode (Payment Terms) is restricted automatically.

I am trying to get the similar behavior for my custom field with data type CashDiscountTermsCode.

As you said, there is no Mapping Parameter for my case.

So, I want to know how the system restrict the Payment Terms.

And whether I can follow the same or not.

Best Regards

Fred

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Fred,

Sorry for the delay. X-mas time, New Year, ...

The restrictions in Acccounts and Suppliers are made in the backend by modifying the result from the Code List Provider.

This is not possible with SDK means.

Sorry,

  Horst

Former Member
0 Kudos

Hi Horst,

I added two custom fields in Marketing->Lead i.e. Lead Type and Budget.

My Lead Type and Budget are not showing in data model for lead in Marketing.

As both are custom field I wanted to have dependency of Budget values on Lead Type values.

Please help

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Rachit,

I doubt that the Extensibility Explorer is capable of handling this.

Sorry,

   Horst

Former Member
0 Kudos

Dear Horst,

I had  created custom WorkCentre with multiple tabs.

I have added this WorkCentre to my business role so I am able to see the WorkCentre but not these tabs in WorkCentre.

Please help

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Rachit,

Did you "refresh" the user after adjusting the Business Role?

Sorry, I don't know the exact name of this action.

HTH,

   Horst

Former Member
0 Kudos

Dear Horst,

Please let me know the data type for range of value in C4C .For eg budget is from 1000 to 100000.

Thanks,

Rachit

former_member186648
Active Contributor
0 Kudos

Hi Rachit,

You could use Numeric.

You could also check other types in Repository explorer.

Thanks, Pradeep.

Former Member
0 Kudos

Hi Pradeep

Numeric gives me one value.

Thanks,

Rachit

former_member186648
Active Contributor
0 Kudos

In the ABSL you could assign number range: http://scn.sap.com/message/16571836

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Rachit,

As you observed a single element can keep ony a single value.

What about a "Lower Limit" and a "Upper Limit" element?

HTH,

    Horst

Former Member
0 Kudos

Dear Horst,

Appreciate your response.

Right.. So I can create two elements one for lower limit and one for upper limit but what is the data type for both and how do I attach both with one element.

Thanks,

Rachit

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Rachit,

If the values of your budget are always whole numbers you may use "IntegerValue" else "Numeric" or whatever suits.

What is the exact use case in the UI?

Bye,

   Horst

Former Member
0 Kudos

Dear Horst,

But how do I combine upper and lower limit into one field budget..

The use case is I have made a custom object Project so in that I have to add Lead so I have to give range of value for each unit or flat which the prospect requires.

Thanks,

Rachit

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Rachit,

Why must this be one field?

Bye,

  Horst

Former Member
0 Kudos

Dear Horst,

So as per my understanding we will have one budget field dependent on  two numeric  fields upper limit and lower limit.

Thanks,

Rachit

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Rachit,

That makes 3 fields .

Bye,

    Horst

PS: If this is a different topic from the original one "How to deal with context dependeant code list" you should open a new thread.