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 to create structure from formal parameter TABLE TYPE ANY TABLE

MarcinPciak
Active Contributor
0 Likes
508

Hi,

I have a FM where TABLES data_tab TYPE ANY TABLE.

Inside the FM I would like to create structure typed as line of this table. I know that generic type can't be used to create other types but maybe there is other way to do this.

I tried this way:

FIELDS-SYMBOLS: <fs> type any.

Loop at data_tab.

assign data_tab to <fs>. "now <fs> contains line of data_tab...

exit.

Endloop.

"..but...

data: begin of ls_struct.

include structure <fs>. "...here I receive 'The included type has no type'

data: end of ls_struct.

Any ideas?

Thx in advance.

Hi,

I have a FM where TABLES data_tab TYPE ANY TABLE.

Inside the FM I would like to create structure typed as line of this table. I know that generic type can't be used to create other types but maybe there is other way to do this.

I tried this way:

FIELDS-SYMBOLS: <fs> type any.

Loop at data_tab.

assign data_tab to <fs>. "now <fs> contains line of data_tab...

exit.

Endloop.

"..but...

data: begin of ls_struct.

include structure <fs>. "...here I receive 'The included type has no type'

data: end of ls_struct.

Any ideas?

Thx in advance.

2 REPLIES 2
Read only

Former Member
0 Likes
452

Hi Marcin,

data: begin of ls_struct.

include structure <fs>.

data: end of ls_struct.

In this case <fs> has no structure at complie time.

anyways u have not assigned <fs> to any data type which has structure, hence the error.

regards,

Vaibhav Modi.

Read only

MarcinPciak
Active Contributor
0 Likes
452

So is there any other way to create such structure?