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

Field symbol using for select query

Former Member
0 Likes
1,329

Dear frens,

This is a case where i m trying to select from a db table for all the entries maintained in a internal table which was declared as field symbol.

Look at the below stmt.

SELECT * FROM adcp INTO CORRESPONDING FIELDS OF TABLE lt_adcp FOR ALL ENTRIES IN <lt_adr_comm>

WHERE addrnumber = <lt_adr_comm>-addrnumber

and persnumber = <lt_adr_comm>-persnumber.

I m getting error: The specified type has no structure and therefore no component called "ADDRNUMBER". component called "ADDRNUMBER".

Hence then I tried like below

assign component 'ADDRNUMBER' of structure

<ls_adr_comm> to <lv_addrnumber>.

assign component 'PERSNUMBER' of structure

<ls_adr_comm> to <lv_persnumber>.

SELECT * FROM adcp INTO CORRESPONDING FIELDS OF TABLE lt_adcp FOR

ALL ENTRIES IN <lt_adr_comm>

WHERE addrnumber = <lv_addrnumber>

and persnumber = <lv_addrnumber>.

this time error is : The WHERE condition does not refer to the FOR ALL ENTRIES table.

Please help asap.

Thanks, Satish

Dear frens,

This is a case where i m trying to select from a db table for all the entries maintained in a internal table which was declared as field symbol.

Look at the below stmt.

SELECT * FROM adcp INTO CORRESPONDING FIELDS OF TABLE lt_adcp FOR ALL ENTRIES IN <lt_adr_comm>

WHERE addrnumber = <lt_adr_comm>-addrnumber

and persnumber = <lt_adr_comm>-persnumber.

I m getting error: The specified type has no structure and therefore no component called "ADDRNUMBER". component called "ADDRNUMBER".

Hence then I tried like below

assign component 'ADDRNUMBER' of structure

<ls_adr_comm> to <lv_addrnumber>.

assign component 'PERSNUMBER' of structure

<ls_adr_comm> to <lv_persnumber>.

SELECT * FROM adcp INTO CORRESPONDING FIELDS OF TABLE lt_adcp FOR

ALL ENTRIES IN <lt_adr_comm>

WHERE addrnumber = <lv_addrnumber>

and persnumber = <lv_addrnumber>.

this time error is : The WHERE condition does not refer to the FOR ALL ENTRIES table.

Please help asap.

Thanks, Satish

4 REPLIES 4
Read only

Sm1tje
Active Contributor
0 Likes
760

if you declared <lt_adr_comm> generically then indeed it has no structure.

Please post the declaration of the <lt_adr_comm> field-symbol and tell exactly what you are trying to do / achieve.

and the <lv_addr> parameter does not refer to your internal table from FOR ALL ENTRIES..

Edited by: Micky Oestreich on Apr 15, 2008 12:02 PM

Read only

Former Member
0 Likes
760

sample example

field-symbols: <fs>.

data: begin of it_vbrp,

vbeln like vbrp-vbeln,

posnr like vbrp-posnr,

brgew like vbrp-brgew,

ntgew like vbrp-ntgew,

end of it_vbrp.

data: begin of it_vbrp2,

vbeln like vbrp-vbeln,

posnr like vbrp-posnr,

brgew like vbrp-brgew,

  • ntgew like vbrp-ntgew,

end of it_vbrp2.

select vbeln

posnr

brgew

ntgew

from vbrp

into corresponding fields of it_vbrp

where vbeln between '0090059462' and '0090060327'.

assign it_vbrp to <fs>.

write:/ <fs>.

move <fs> to it_vbrp2.

clear <fs>.

endselect.

Read only

Former Member
0 Likes
760

Hi

u can't use the field-symbols for FOR ALL ENTRIES option because when u define a table as field-symbol u can't indicate any structure.

Max

Read only

0 Likes
760

Hi max bianchi,

It is possible to do so,

I have used the following code to achieve the same.

*+ amvaidya 15.04.2008

FIELD-SYMBOLS: <l_i_ref> TYPE STANDARD TABLE.

DATA: l_i_ref_tab TYPE tt_ref_tab,

l_matnr TYPE string VALUE ' ccode EQ p_ccode AND omatnr EQ <l_i_ref>-matnr and ACTVITM eq ''''X'''' '.

IF i_temp_a970 IS NOT INITIAL.

ASSIGN i_temp_a970 TO <l_i_ref>.

  • <l_i_ref> = i_temp_a970[].

ENDIF.

IF i_temp_a004 IS NOT INITIAL.

  • <l_i_ref> = i_temp_a004[].

ASSIGN i_temp_a004 TO <l_i_ref>.

ENDIF.

SELECT omatnr

nmatnr

FROM ztm_ref_table

INTO TABLE l_i_ref_tab

FOR ALL ENTRIES IN <l_i_ref>

WHERE (l_matnr).

Hope this solve the problem.