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

Validation on select-options high is executing although input doesn't exist

Former Member
0 Likes
638

Hi all,

I want to validate the select options LOW and HIGH values and I am using the code like this.

SELECT iblnr FROM ikpf INTO TABLE gt_ikpf WHERE iblnr IN s_iblnr.

     IF sy-subrc = 0.

       MESSAGE s001.    " record(s) exist

     ELSE.

       MESSAGE e002.    " record(s) does not exist

     ENDIF.

Case 1 : When I enter values in both s_iblnr-low and s_iblnr-high, it gives correct message according to the input.

Case 2 : When I enter value only in s_iblnr-low and not in s_iblnr-high, it gives correct message according to the input.

Case 3 : BUT when I enter value only in s_iblnr-high and not in s_iblnr-low, it does not give me error message for the wrong input i.e. it gives STATUS message (s001 here) all the time.

This seems easy and a bit illogical but need to solve this. I could not find this on forums. How can I solve this?

Thanks..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
601

Hi,

If you don't provide s_iblnr-low and only provide values in s_iblnr-high then s_iblnr-option automatically changes to 'BT'. Hence the problem.

i.e. lets say you give value '0000000015' in s_iblnr-high and try to execute the program giving nothing in s_iblnr-low. Then the s_iblnr will be filled as below.

s_iblnr-sign = 'I'.

s_iblnr-option = 'BT'

s_iblnr-low = ' '.

s_iblnr-high = '0000000015'.

The above means to fetch all values between NULL to '0000000015', hence it tries to fetch all values.

Solution for the above problem is: if option is 'BT' then check the 's_iblnr-low' value in the 'at selection screen output' event.

Hope this solves your issue.

Regards,

Manjesh.

4 REPLIES 4
Read only

Former Member
0 Likes
601

Hi,

If you dont give any values in S_IBLNR, the SELECT query will fetch all the data from the table IKPF.

As a solution, please check whether S_IBLNR IS NOT INITIAL.

IF S_IBLNR IS NOT INITIAL.

SELECT iblnr FROM ikpf INTO TABLE gt_ikpf WHERE iblnr IN s_iblnr.

     IF sy-subrc = 0.

       MESSAGE s001.    " record(s) exist

     ELSE.

       MESSAGE e002.    " record(s) does not exist

     ENDIF.

ENDIF.

If needed, give a error message if S_IBLNR is initial.

Cheers

~Niranjan

Read only

Former Member
0 Likes
601

Hi,

If you enter value in S_IBLNR-HIGH and not in S_IBLNR-LOW the query will fetch all the data form the IKPF table till S_IBLNR-HIGH.

You can do this whenever the high value is filled check whether the low value is filled or not.

Regards,

Pavithra

Read only

Former Member
0 Likes
602

Hi,

If you don't provide s_iblnr-low and only provide values in s_iblnr-high then s_iblnr-option automatically changes to 'BT'. Hence the problem.

i.e. lets say you give value '0000000015' in s_iblnr-high and try to execute the program giving nothing in s_iblnr-low. Then the s_iblnr will be filled as below.

s_iblnr-sign = 'I'.

s_iblnr-option = 'BT'

s_iblnr-low = ' '.

s_iblnr-high = '0000000015'.

The above means to fetch all values between NULL to '0000000015', hence it tries to fetch all values.

Solution for the above problem is: if option is 'BT' then check the 's_iblnr-low' value in the 'at selection screen output' event.

Hope this solves your issue.

Regards,

Manjesh.

Read only

Former Member
0 Likes
601

Thanks to all for the solution..

Regards,

Nishit