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

how can i modify dynamic table ?

Former Member
0 Likes
666

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 ?

1 ACCEPTED SOLUTION
Read only

hymavathi_oruganti
Active Contributor
0 Likes
622

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.

5 REPLIES 5
Read only

Former Member
0 Likes
622

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

Read only

0 Likes
622

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

Read only

0 Likes
622

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

Read only

0 Likes
622

Hi,

Is your problem solved ?

Is yes, please reward points and close the thread.

Best regards,

Guillaume

Read only

hymavathi_oruganti
Active Contributor
0 Likes
623

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.