‎2008 May 27 11:10 AM
Hi all,
Having a field in the selection screen of type char, declared using select option.
If i give value for lower limit smaller than
higher limit i am getting error as
'Lower limit greater than higher limit'.
for eg: if give 8 and 20
1 and 20...etc.. i am getting that error.
but if i give the input as
08 and 20
01 and 20 i am not getting any error .
Is there any way to solve this.
Pls help regarding this.
‎2008 May 27 11:16 AM
Hi Jean,
You can try converting the lower and higher limit first to an integer type of variable, then u compare.
Hope this helps.
Benedict
‎2008 May 27 11:19 AM
Hi Jean,
It might be better to define the selection field as a number, and if you need it to be char in your program, then do the typecasting in the program itself. You should use the MOVE command (for example) to move the value to a character field.
Regards,
SD.
‎2008 May 27 11:17 AM
Hi,
Pls copy paste ur code in SDN so that we can identify exact problem in u r code.
‎2008 May 27 11:24 AM
Declare the variables of type n instead of c. It will solve your purpose. The same thing happened to me few days back when I was checking whether the value( defined in character) lies between 1 and 255. I got erroneous result. I changed the data type to type n that solved my problem.
Regards,
Mallick
‎2008 May 27 12:13 PM
Hi all,
Having a field in the selection screen of type char, declared using select option.
If i give value for lower limit smaller than
higher limit i am getting error as
'Lower limit greater than higher limit'.
for eg: if give
8 and 20
1 and 20...etc.. i am getting that error.
but if i give the input as
08 and 20
01 and 20 i am not getting any error .
Is there any way to solve this.
If i use data type n or i or p, then the default value for that variable will be 0 (zero) even if i didnt pass any value. But it should not happen, if i left blank the the variable should not have any value including zero.
Pls help regarding this.
‎2008 May 27 12:21 PM
Hi then wht u do is
first use type i in select options then
write llike this
if s_low is initial.
s_char_low = ' '.
else.
s_char_low = s_low.
endif.
do the same one for high also..
then u r problem gets solves..
do rerward if helpful..
for more details see my business card..
Regards
Sunil Kumar Mutyala
‎2008 May 27 1:09 PM
Hi sunil,
Thnks for the rply.
In ur code,
If we dont pass any value for s_low, the s_char_low wont have any value, that is fine.
but if we pass '0' (zero) to s_low then also s_char_low wont have any value. It should not be happen.
If i pass blank to s_low then s_char_low should be blank,
if i pass zero to s_low then s_char_low should have value as zero.
help reg this.
‎2008 May 27 11:26 AM
‎2008 May 27 1:19 PM
hi,
can you pls tell me how u declared your select-option??
i mean wat variable and its type.???
‎2008 May 27 1:53 PM
Data : lv_char(4) type c.
select-option : s_char type lv_char.
If i declared as char and if i give input as
(for eg.)
lower limit : s_char-low = 1.
upper limit : s_char-low = 20.
I will get the error message as 'Lower limit is greater than higher limit'.
Data : lv_int type int2.
select-option : s_int type lv_int.
if i declared as integer and if i pass zero or if i left blank its value will be,
s_int-low = 0
s_int-high = 0. but what i need is if we pass zero it should take zero or if i left blank it should not be equal to zero, it should be blank.
‎2008 Jun 03 3:35 PM
Hi there,
Here's another solution then:
Declare your field as a character type.
AT SELECTION-SCREEN OUTPUT event lets you evaluate the high and low portions of the variable, so here you should determine the length of the high portion, and then pad the low portion with zeroes - so if you have entered 3 and 200, using the function
hi_len = STRLEN (s_opt-high) - you will get 3 as a result.
Then do:
low_len = STRLEN(s_opt-low) and it will return 1.
From here you get the number of leading zeroes with which you need to pad the low portion, and that's 2.
(padding = hi_len - low_len)
Do a concatenate command in a loop, for instance:
DO padding TIMES.
CONCATENATE '0' s_opt-low INTO s_opt-low.
ENDDO.
At the end do a MODIFY SCREEN and finish the LOOP AT SCREEN.
Try to code this, and do get back with the results.
Regards,
SD.
‎2008 Jun 04 10:41 AM
Another idea...
Instead of SELECT-OPTIONS, use PARAMETERS and create two input fields. This way they will be separated from each other, and you can implement your own logic in the program, later on during the selection.. You will have to use PAI/PBO events to evaluate user input (i.e. check if the lower limit is really greater than higher limit). Use the logic from my previous answer in combination with this, and I'm sure you'll manage to solve the problem.
SD.