‎2006 Oct 11 11:14 AM
i sow here exmple of working with dynamic table
but i didnt find any example of modify .
most of the example is like :
select * into table <dyn_table>
from (p_table).
but i need to do like (example):
SELECT SINGLE BUDAT USNAM FROM MKPF
INTO (<dyn_table>-BUDAT , <dyn_table>-USNAM )
WHERE MBLNR = IT_YMM_ST_TNUOT_MLY-MBLNR
AND MJAHR = IT_YMM_ST_TNUOT_MLY-MJAHR
AND BUDAT IN SL_BUDAT .
i get message that i cant do it .
how can i do it ?
‎2006 Oct 11 11:21 AM
u cant do like that,
u have to do it by using assign component.
declare
tables: mkpf.
field-symbols: <fs> type any, <fs1> type any.
select single budat usnam from mkpf where mjahr = ....
and budat in sl_budat.
assign component budat of structure <dyn_table> to <fs>.
<fs> = mkpf-budat.
assign component usnam of structure <dyn_table> to <fs1>.
<fs1> = mkpf-usnam.
‎2006 Oct 11 11:19 AM
Hi,
You cannot do this because the fields of the dynamic table varies.You are trying to specify fields along with a dynamic table which is not possible.
Regards
Sunil.M
‎2006 Oct 11 11:27 AM
so what i can do ?
i want to pull unknown number of kostl from ekkn
into dynamic table and to alv list .
thanks any way
‎2006 Oct 11 1:54 PM
Hi,
As you only need 1 record (SELECT SINGLE), I would suggest the following syntax
FIELD-SYMBOLS: <fs_data> TYPE ANY.
SELECT SINGLE ... INTO CORRESPONDING FIELDS OF <fs_data> ...Look at this example:
DATA: w_ref_data TYPE REF TO data.
FIELD-SYMBOLS: <fs_data> TYPE ANY.
CREATE DATA w_ref_data TYPE usr02.
ASSIGN w_ref_data->* TO <fs_data>.
SELECT SINGLE bname FROM usr02 INTO CORRESPONDING FIELDS OF <fs_data>.Best regards,
Guillaume
Message was edited by: Guillaume Garcia
‎2006 Oct 16 10:19 AM
Hi,
Is your problem solved ?
Is yes, please reward points and close the thread.
Best regards,
Guillaume
‎2006 Oct 11 11:21 AM
u cant do like that,
u have to do it by using assign component.
declare
tables: mkpf.
field-symbols: <fs> type any, <fs1> type any.
select single budat usnam from mkpf where mjahr = ....
and budat in sl_budat.
assign component budat of structure <dyn_table> to <fs>.
<fs> = mkpf-budat.
assign component usnam of structure <dyn_table> to <fs1>.
<fs1> = mkpf-usnam.