Application Development and Automation 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: 
Read only

Checking a value against a domain (with no fixed values)

former_member828817
Discoverer
0 Likes
3,342

Hello Everyone,

I would like to validate a value against an existing domain (without fixed values).

Example:

     value          = '99'

     tabname     = 'MARA'

     fieldname    = 'SPART'

     domain       = 'SPART'

I want to check if the value '99' is a suitable entry for the field MARA-SPART with the domain SPART. The domain has no check table or value table. The domain has datatype char 2. So '99' would be valid, but 'ABC' would not be valid because it's too long.

I already found and tried several function modules, but they all seem to work for domains with fixed values only. For example 'FM_DOMAINVALUE_CHECK' works fine, but if I use it with a domain that has no fixed values, I always get an exception 'input error'.

So my question is: is there something similar for domains that have no fixed values? A function module where I can use tabname+fieldname or domain as input aswell as the value would be great.

Best regards,

Sebastian

4 REPLIES 4
Read only

niraj_sinha4
Explorer
0 Likes
1,975

Hi,

You can create a Check table. And assign values over-there. 

Regards,

Niraj Sinha

Read only

RaymondGiuseppi
Active Contributor
1,975

SPART as already a value table, it's TSPA. Did you try a generic FM like DDUT_INPUT_CHECK?

Regards,

Raymond

Read only

0 Likes
1,975

Hi Raymond,

thank you for that hint. Unfortunately, my example with MARA and SPART was not very good.

I tried FM DDUT_INPUT_CHECK. Like the other FMs that I tested, it only gives correct error messages for domains with check tables or value tables.

One problem with this FM is that it doesn't care about the length. When I have a domain like STFAK that has the data type INT2 (5 places) and I use value = '123456' it doesn't complain. I know how I can check if the length is ok, but I would like to avoid doing that seperately.

Another problem: it doesn't complain about value = 'ABD' either, although that is not even a number.

Best regards,

Sebastian

Read only

0 Likes
1,975

Then look at a FM like OIUREP_CHECK_STRUCT_WITH_DDIC or a method like CL_CA_FACTS_TOOLS->CHECK_FIELD to build your own logic.

Regards,

Raymond