cancel
Showing results for 
Search instead for 
Did you mean: 

Validate entered value on input field against context input help

alejandro_bindi
Active Contributor
0 Kudos

Hello,

Having an input field on the screen, and an attribute in the context which has a value list linked in some way (check table, search help, or other).

Pressing F4 will bring this value list for selection. But I can enter any value manually on the field, and it could not be on that list. How can that be enforced as in normal dynpros?

The method CL_WDR_CONTEXT_NODE_INFO->SET_ATTRIBUTE_VALUE_SET does what I want, but it receives an internal table. I'd like instead to have that behaviour based on the context attribute input help list alone (because that possible value set could be comprised of an entire table which obviously I won't select into an internal table to pass to the set_attribute_value_set method).

Can this be done? Or is the only option to check manually upon user action?

Many thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

first of all is that attribute in a structure?

if so, add the checktable to the structure on that attribute and the framework will

check the value against the list

you only need to define the context attribute as structure-attributename

grtz,

Koen

alejandro_bindi
Active Contributor
0 Kudos

You mean a dictionary structure? If so, the answer is: it may be, it may be not.

Let me give you an example:

Having this tables:

ZTABLE_A
  PKEYA		DataElement: Z_DE_PKEYA	<- Primary Key
  SOMEFIELD

ZTABLE_B
  PKEYB		DataElement: Z_DE_PKEYB <- Primary Key
  FKEYFIELD	DataElement: Z_DE_PKEYA <- Foreign Key to ZTABLE_A-PKEYA

Creating a context node based on ZTABLE_B, choosing the attribute ZTABLE_B-FKEYFIELD and selecting automatic input help, causes that on F4 press over an inputfield bound to this attribute, possible list displays all the values from ZTABLE_A. But if I enter some value manually, it doesn't check that value exists in ZTABLE_A. I want to enforce that check.

Many thanks Koen

thomas_szcs
Active Contributor
0 Kudos

Hello Alejandro,

The check functionality in Web Dynpro is similar to the one of the Dynpro. In both cases a value table is not taken into account. You need to put the field into a structure and define a foreign key relationship to the table. Then it works.

Best regards,

Thomas

alejandro_bindi
Active Contributor
0 Kudos

Hi Thomas,

You're right. I don't know why but I was sure that in normal module pools the check was automatically done. I did a test and confirmed there's no automatic existance check.

So basically, the idea would be to react on user action and manually check that the entered value is valid? (for example using a <i>is_valid_value()</i> method on an underlying "model" class, which would check for value existance on the check table).

Would this be the normal approach?

What I don't get is the structure / foreign key part. Why would I need a structure for this? As only tables can have foreign keys...

Thank you!

thomas_szcs
Active Contributor
0 Kudos

Hi Alejandro,

Yes, this is a good approach.

Structures can have foreign key relationships as well. In Dynpro, this is used for input validation and value help determination. In Web Dynpro, it used for value help determination.

Best regards,

Thomas

alejandro_bindi
Active Contributor
0 Kudos

Thanks for clarifying. I haven't had idea the structures could have foreign keys, but they can.

As always, you learn something more than that you were asking for initially

Regards

Answers (0)