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

Select - endselect

Former Member
0 Likes
829

I would like to create select -endselect construction and print every processed record

select HASH

from UPS_HASH

INTO table t2.

*

write t2-hash.

*

Endselect.

But the system generates the following error :

For the statement Endselect , there is no open structure introduced by select.

Can somebody help me

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
752

Hi Comandante,

You have not written the correct syntax. Please see the below correct syntax Table should not be used there.


select HASH
from UPS_HASH
INTO  t2.
*
write t2-hash.
*
Endselect.

Instead of this why dont you try with the internal table like below.


select HASH
from UPS_HASH
INTO table t2.
loop at t2.
write t2-hash.
  
endloop.

This will increase the performance aswell.

Thanks,

Chidanand

5 REPLIES 5
Read only

Former Member
0 Likes
752

my advise is avoid select and endselect. select all records and loop the table and write.

Below is what you want.

select HASH
from UPS_HASH
INTO t2.       "remove table
*
write t2-hash.
*
Endselect.

Read only

Former Member
0 Likes
752

select HASH

from UPS_HASH

INTO table t2.

*

write t2-hash.

*

Endselect.

--

remove your table statement from above, it is causing it to become an array fetch which doesnt need End Select.

On another note, array fetch is much better. if you use that, do a loop on your table T2, and write t2-hash within the loop.

Read only

BH2408
Active Contributor
0 Likes
752

Hi ,

i think there should be into table only into....

Check it out...

Regards,

bharani

Read only

Former Member
0 Likes
752

try something like this...

data: begin of ti_ups_hash occurs 0,
            hash like ups_hash-hash,
        end of ti_ups_hash.

select HASH
into corresponding fields of table ti_ups_hash
from UPS_HASH.

loop at ti_ups_hash.
write ti_ups_hash-hash

endloop.

Read only

Former Member
0 Likes
753

Hi Comandante,

You have not written the correct syntax. Please see the below correct syntax Table should not be used there.


select HASH
from UPS_HASH
INTO  t2.
*
write t2-hash.
*
Endselect.

Instead of this why dont you try with the internal table like below.


select HASH
from UPS_HASH
INTO table t2.
loop at t2.
write t2-hash.
  
endloop.

This will increase the performance aswell.

Thanks,

Chidanand