2012 Jul 12 7:51 AM
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..
2012 Jul 12 8:22 AM
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.
2012 Jul 12 8:05 AM
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
2012 Jul 12 8:19 AM
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
2012 Jul 12 8:22 AM
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.
2012 Jul 12 8:55 AM