‎2006 Oct 10 9:51 AM
Hi all,
I have a requirement that in a DB table there are some value like 10 50 95. If the user enter 5 then it should display 10.. If the user enters 30 then it should display 10 and also 50 . if the user enters the value greater than 50then it should return all the 3 values. Can any one help me out in solving this problem.
Thanx in advance.
Murthy
‎2006 Oct 10 9:59 AM
You can use the SPLIT command and split the entry into an internal table
data :
itab TYPE TABLE OF string
SPLIT <10 50 95> AT space INTO TABLE <itab>.
now itab contains 10,50,95 in separate rows
now check the user input
if <user input> = 5
read table itab index 1.
elseif <user input> = 30
loop at itab.
if itab = 10 or itab = 50
write : / itab.
endif.
endloop.
‎2006 Oct 10 9:59 AM
You can use the SPLIT command and split the entry into an internal table
data :
itab TYPE TABLE OF string
SPLIT <10 50 95> AT space INTO TABLE <itab>.
now itab contains 10,50,95 in separate rows
now check the user input
if <user input> = 5
read table itab index 1.
elseif <user input> = 30
loop at itab.
if itab = 10 or itab = 50
write : / itab.
endif.
endloop.
‎2006 Oct 10 10:05 AM
hi,
u can use offset values
like..
if <field> = 5. (depends on condition)
move <dbtablefield>+0(2) to <field1>.(declare other field)
elseif <field> = 30.
move <dbtablefield>+0(4) to <field1>.
else <feild> >= 50.
move <dbtablefield>+0(6) to <field1>.
endif.
try this.
regards,
‎2006 Oct 10 10:06 AM
One clarrification when you say the DB table has some value like 10 50 95. Are they in separate fields or in a single field with space as the separator ??
Lets say either u split the same into a internal table or if they are in separate fields you get in an internal table via select.
itab --> internal table with the values.
Loop at itab.
if itab-value > pval.
write : / itab-value.
exit.
else.
write : / itab-value.
endif.
endloop.
The above should give you the required values.