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 statement problem?

Former Member
0 Likes
631

hi,

may i know if the select statement can work if can satisfy in the where? i check the tablex entry for where clause and it is correct but i do not know why no data collected.

any reason?

thanks

internal table it_tab with fields below

fielda

fieldb

fieldc

fieldd

fielde

select fieldb fieldc fieldd into corresponding fields of wa_tab

from tablex

where ......

if sy-subrc = 0

select single aa bb into (wa_tab-fieldd , wa_tab-fielde) where ....

concatenate wa_tab-fieldb wa_tab-fieldc to wa_tab-fielda.

collect wa_tab to it_tab.

endif.

endselect.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
614

internal table it_tab with fields below

fielda

fieldb

fieldc

fieldd

fielde

select fieldb fieldc fieldd into corresponding fields of wa_tab

from tablex

where ......

if sy-subrc = 0

select single aa bb into (wa_tab-fieldd , wa_tab-fielde) where ....

concatenate wa_tab-fieldb wa_tab-fieldc to wa_tab-fielda.

<b>append wa_tab to it_tab.</b>

endif.

endselect.

u need to append data to internal table....

sort it_tab by fielda fieldb fieldc fieldd.

loop at it_tab.

collect it_tab.

endloop.

5 REPLIES 5
Read only

Former Member
0 Likes
614

could u paste your where clause code here !!!

regards,

sai ramesh

Read only

Former Member
0 Likes
614

Use Like That

Select A B C from XYZ into wa_xyz where xxxxxxxxxx.

endselect.

if sy-subrc eq 0.

endif.

if you are fetching one value then use single

declare fields according to the table sequence

Read only

Former Member
0 Likes
614

Hi El,

In the code u have written here :

select fieldb fieldc fieldd into corresponding fields of <b>wa_tab</b>

from tablex

where ......

if sy-subrc = 0.

In this code, instead of using the i<b>nternal table it_tab</b> u have used <b>workarea wa_tab.</b>

Only when we use <b>select single </b>, we will be using <b>work area</b>.

Hope this helps you fetch the data.

Regards,

Thasneem

Read only

Former Member
0 Likes
615

internal table it_tab with fields below

fielda

fieldb

fieldc

fieldd

fielde

select fieldb fieldc fieldd into corresponding fields of wa_tab

from tablex

where ......

if sy-subrc = 0

select single aa bb into (wa_tab-fieldd , wa_tab-fielde) where ....

concatenate wa_tab-fieldb wa_tab-fieldc to wa_tab-fielda.

<b>append wa_tab to it_tab.</b>

endif.

endselect.

u need to append data to internal table....

sort it_tab by fielda fieldb fieldc fieldd.

loop at it_tab.

collect it_tab.

endloop.

Read only

0 Likes
614

hi ramesh,

thanks.

why cannot directly collect?

points awarded