Application Development 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: 

Select - endselect

Former Member
0 Kudos

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

former_member598013
Active Contributor
0 Kudos

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

former_member188685
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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.

P561888
Active Contributor
0 Kudos

Hi ,

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

Check it out...

Regards,

bharani

Former Member
0 Kudos

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.

former_member598013
Active Contributor
0 Kudos

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