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: 

Convert field value based on domain settings

Roman71
Explorer
0 Kudos

Hello Abaper,

I have the following issue. A field is defined by a domain in ABAP dictionary without lower case. Via an Interface (any interface) I get data for this field and the data has some lower case characters.

I need the same behaviour like any ABAP Dynpro has at pressing enter, automatic conversion to upper case takes place if the domain is defined as upper case. I know I could program this myself with checks against DDIC and a translate to upper case but I think this is already solved in the system. Can anybody reveal the "function" SAP standard uses for make the conversion.

Many thanks for all tips.

Best regards


Roman

13 REPLIES 13

former_member220028
Active Contributor
0 Kudos

the problem is that even if a field is defined as upper case, you can enter values in lower case. they get converted to upper case, when an action is made on the dynpro. that is standard behavior. so just define the domain as upper case...

Or define/use  a conversion routine for the domain. both ways u have to edit the domain...

why would u need to prgoramm checks against ddic when you can set the flag upper case for domain in ddic?

regards

Stefan Seeburger?

0 Kudos

Maybe I didn´t write precise enough. I need to have the behaviour in an interface let say a Funtion Module or a webservice. The data is delivered by any application not caring about upper and lower case and let say I have a field like profit center. If I want to check the value I need to convert to upper case first and can then use the conversion exit alpha to get the internal represantation of the value.

So simple question again: How to convert values to upper case based on domain setting?

Thanks for help

Roman

BTW: You can set flag for lower case in DDIC, not for upper case but your program variable will not care about that as long as you don´t use the variable in a dynpro.

0 Kudos

The conversion is part of screen processing. I suspect it is part of the kernel, as I've never found where it happens.

DATA x TYPE element_with_no_lower_case.

X = 'fish'.

There's no way, except via programming, for X to automatically get the value 'FISH'.

You see, screens know about domains and data elements, but ABAP doesn't. All it has are types i,p,f etc.

0 Kudos

I was intrigued by this requirement so I did some additional research, there is an internal ABAP command DESCRIBE FIELD dobj INTO td. This one, as you mention, can only find out at runtime if it is numeric, character, or byte.

I also assume the conversion only takes place in screen processing when it is building the screen when executing a program.

former_member186746
Active Contributor
0 Kudos

Hi,

I initially thought that just using the write to command would translate it correctly to upper case if the domain is set that way, but I just checked with a small abap and it doesn't seem to work that way.

You might want to check exactly where SAP translates it in any screen by putting a break-point on the TRANSLATE statement.

Kind regards, Rob Dielemans

former_member220028
Active Contributor
0 Kudos

hi,

i still dont know the problem...

do you want to programm a framework so u can automatically translate fields by their domain definition?

Or do u just want to translate that field?

does this field got a conversion exit? if yes? can u just use the conversion exit?

do u prgoramm ur FM /Interfcae in ABAP? and do u have access to any ABAP Table/FM?

why not just using translate to upper case?

you can also use FM 2054_TRANSLATE_2_UPPERCASE (just searched it) which just have the translate-statment.

Regards

Stefan Seeburger

0 Kudos

I don´t know what is so difficult to understand at the requirement. I am looking for a function doing a convert to upper case based in the domain settings of a field. The function module you named is doing a conversion to upper case no matter what the domain setting is.

Regards

Roman

Roman71
Explorer
0 Kudos

Hello together,

nobody any idea? In between I found out there is no attribute lowercase in RTTI and the attribute can be found in table DD04L. The function modules from DDIF_* all have to much overhead to have a good performance.

Any idea welcome.

Best regards


Roman

0 Kudos


Hi,

There is no function module that I could find, the attribute is in table D001L-LOWERCASE.

This table only holds 100K entries so shouldnt be a performance issue at all.

Kind regards, Rob Dielemans

0 Kudos

Hi,

Thinking about the issue again I have come to the conclusion that this is way better solved at the delivery side of the interface.

Every time when an interface is created you will have discussions on what prerequisites there are for the correct execution of the interface. For instance Creation Date has to be in the following format

DD-MM-YYYY.

So in your case you can check every field of the interface and rewrite the prerequisites, or more specifically demand that field X is always supplied in capitals, otherwise the system will interpret the values as uniquely different i.e. AAA is different from aaa is different from Aaa, etc.

Kind regards, Rob Dielemans

former_member220028
Active Contributor
0 Kudos

Hi,

im Sry i dont know such a FM

i think you have to code it.

regards

Stefan Seeburger

Former Member
0 Kudos

Hi Roman

I don't think there's a solution to do it, I mean you should converti it to upper case by yourself, you need to check the domain characteristics in order to decide if you need or don't need to translate it (as you know)

I thinlk the problem is to understand why you have lowercase

Max

0 Kudos

Hi.

There is a FM, which does this conversion, but it is limited to fields, which are used for authority checks:  'SUSR_FIELD_CONVERT'. Maybe you can not use it directly, but you can see all the conversions made depending on the domain-attributes.

regards,

Peer Greussing