cancel
Showing results for 
Search instead for 
Did you mean: 

Input field validation in a Table based on the value of other column

Former Member
0 Kudos

Hi all

I have a table with 2 columns. column1 is of text view and column2 is Input field.

The user should not be allowed to enter a value in the column2 ( input field) greater than the value populated in column1(textview).

So for Eg; if the column1 is populated with value 100, The user should not be able to enter a number greater than 100 in the column2 input field.

Please let me how this can be achieved.

I appreciate the help.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

baskaran00
Active Participant
0 Kudos

Hi,

Let me make sure u r working with table control.

First u have to create a event(VALIDATE) to do the validation.

Inside the event,

1. First get the current index where user has pointed the curson

2. Once u get the index read the internal table with index value.

3. Now u can compare the col1 and col2 values and populate the error message.

1. DATA : lo_elt TYPE REF TO if_wd_context_element,

l_index type i.

lo_elt = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).

CALL METHOD LO_ELT->GET_INDEX( RECEIVING MY_INDEX = l_index.

above code should be written inside the event.

Thanks,

Former Member
0 Kudos

Hello,

Take a look on this: [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/bf20e84f-0901-0010-fe9e-91d100013a59] at page 22.

And you can do validations on user inputs in the method WDDOBEFOREACTION. You can get more help on this in the following document [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/db22242d-0701-0010-28a2-aeaa1fefd706] at page 36.

Regards.