Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Get domain value range dynamically

_IvanFemia_
Active Contributor
0 Kudos

Hi all,

I need to create a dynamic method that retrieves the value range (key-value) of a domain.

It is pretty simple to get fixed values using FM DD_DOMVALUES_GET, but how do I manage a value table?

For example:

  • Field XFELD has fixed values so use DD_DOMVALUES_GET

  • Fields BUKRS and SPRAS have value tables.

I can get the value table name using FM DDIF_FIELDINFO_GET and retrieve the data from that table. Unfortunately, I can be sure to get the right key field, but I can't be sure to get the right value field, it depends on the value table definition.

BUKRS has T001 that stores the text in field BUTXT of the same instead SPRAS has T002 that stores the text in text table T002T in field SPTXT.

Is there any standard function module that does the trick?

In this thread managed it manually using a case statement, but I would avoid it, too many case statements...

Thanks

Ivan

1 ACCEPTED SOLUTION

bruno_esperanca
Contributor
0 Kudos

Hi Ivan,

I know did something similar! Maybe he can help.

Best regards and good luck,

Bruno

6 REPLIES 6

Former Member
0 Kudos

It should be possible since the system is using it for value helps, maybe you will find the answer there.

Former Member
0 Kudos

Hello Ivan,

Please try to fetch the domain value range by putting a selection query on DD07V table by passing the domain name as the key.

Hope this will work for you.

Regards.

Abhinav Goel.

bruno_esperanca
Contributor
0 Kudos

Hi Ivan,

I know did something similar! Maybe he can help.

Best regards and good luck,

Bruno

0 Kudos

What I am doing is not quite the same but similar - I am dynamically getting the text description when I have a data element and the value of the variable that references that data element.

I was pointed to CL_TEXT_IDENTIFIER which when you pass in the domain and the value magicaly brings back the text description, despite the fact that, as far as I can see, SAP has set up almost every text table slightly differently - sometimes in the main table like T001W or lFA1, sometimes which just the language and the value as a key, sometimes with extra key fields (e.g. MAKT) and sometimes with added organisational key fields e.g. the same GL account have different text descriptions in different chart of accounts.

I think at some stage CASE statements or subclasses are going to have to come into the equation, due to the utter lack of consistency in SAP table defintions.

Cheersy Cheers

Paul

Former Member
0 Kudos

Hi Ivan,

I am currently looking for exactly the same solution.It would be great if you could share the  approach have used  read dynamically key-value from a domain with value range table.

Thanks and Regards

Neeta

0 Kudos

Hi Neeta,

luckily it was a test case, not a real project. So in the meantime I managed it using a case statement.

It is not the solution that I like but I had no time to investigate further in a better solution.

Ivan