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

Regarding Select

Former Member
0 Likes
490

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
470

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.

3 REPLIES 3
Read only

Former Member
0 Likes
471

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.

Read only

Former Member
0 Likes
470

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,

Read only

Former Member
0 Likes
470

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.