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

ABAP 7.5 create inline table/structure with dynamic type

SimoneMilesi
Active Contributor
0 Likes
5,058

Hi all,

I'm scratching my head trying to achieve a little goal into inline declaration.

Using standard FMs I receive some tables into REF TO data variables, dynamically determined.

Using the following code, i can fill my internal table COND

TYPES: tty_conds TYPE STANDARD TABLE OF /vgm/ips1ybagce WITH DEFAULT KEY.
ASSIGN bckt_cond->* TO FIELD-SYMBOL(<tab>).
DATA(cond) = VALUE tty_conds( ).
cond = CORRESPONDING #( <tab> ).

My issue is: COND can have different structure than /VGM/IPS1YBAGCE, given by customizing settings.

I tried with

DATA: simo_tabname TYPE tablename_umg VALUE '/VGM/T_IPS1YBAGCE_DB'. "it's the table type for my prev structure
ASSIGN bckt_cond->* TO FIELD-SYMBOL(<tab>).
DATA(cond) = VALUE simo_tabname( ).
cond = CORRESPONDING #( <tab> ).

But, of course, SIMO_TABNAME doesn't exist.

So i tried with the ( )

DATA: simo_tabname TYPE tablename_umg VALUE '/VGM/T_IPS1YBAGCE_DB'. "it's the table type for my prev structure
ASSIGN bckt_cond->* TO FIELD-SYMBOL(<tab>).
DATA(cond) = VALUE (simo_tabname)( ).
cond = CORRESPONDING #( <tab> ).

But i got error anyway.


There is chance to achieve it?
Thanks!

Simone

EDIT

Yes, i can use

DATA cond type ref to data.

FIELD-SYMBOLS: <tab_new> type standard table

.CREATE DATA cond ('/VGM/T_IPS1YBAGCE_DB').

ASSIGN cond->* to <tab_new>.

but it wouldn't be inline 🙂

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
2,996

Constructor operators require static types so you'll have to stick to the old construct

CREATE DATA dref TYPE (dynamictype).
2 REPLIES 2
Read only

Sandra_Rossi
Active Contributor
2,997

Constructor operators require static types so you'll have to stick to the old construct

CREATE DATA dref TYPE (dynamictype).
Read only

SimoneMilesi
Active Contributor
0 Likes
2,996

sandra.rossi i feared it, but since i'm still struggling here and there with the new syntax, i hope i was missing something i wasn't able to find in the help.
Would you mind to convert the comment to Answer? So i close the question 🙂