on 10-29-2018 4:29 PM
DATA: lo_dynamic_table TYPE REF TO data.
FIELD-SYMBOLS: <lt_table_structure> TYPE table,
<ls_table_structure> TYPE any.
CREATE DATA lo_dynamic_table TYPE TABLE OF (datatab).
ASSIGN lo_dynamic_table->* TO <lt_table_structure>.
// some code assigning the structure
I have a table DATATAB,type of which is generic!It can change depending from queries!
I have to create a dynamic internal table type datatab!
It throws a dump Short Text An exception has occurred that was not caught.
What happened? Exception 'CX_SY_STRUCT_ATTRIBUTES' was raised, but it was not caught anywhere along the call hierarchy.
Can sb help me?
Okay so I see in your attached short dump that datatab is a structured parameter, not a character variable containing the name of a type, so you can't use parentheses around datatab.
I guess that it's the syntax you need :
CREATE DATA lo_dynamic_table LIKE TABLE OF datatab.
Note that you must also use LIKE instead of TYPE (and don't use parentheses around datatab)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would do it the other way :
FIELD-SYMBOLS: <fs_tab> TYPE table.
ASSIGN LOCAL COPY OF datatab TO <fs_tab>.
LOOP AT <fs_tab> ASSIGNING FIELD-SYMBOL(<fs_str>).
"Do something with structure <fs_str>.
ENDLOOP.
"or, to append a new record :
APPEND INITIAL LINE TO <fs_tab> ASSIGNING <fs_str>.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<lt_table_structure> TYPE table - Try TYPE ANY TABLE
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please in the question I have already specified that datatab is a generic type and the error is thrown at this line>>>CREATEDATA lo_dynamic_table TYPE TABLE OF(datatab).there's no change from my code!I am refering to the datatab of this exit EXIT_RSAQEXCE_001 try creating a dynamic table of this table.
Your code looks fine. Make sure what you are passing in datatab is a correct structure or database table name, else it might give you errors.
Like everyone mentioned, it would be better if you share your short dump analysis.
Best Regards,
Mahesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please check the below code, which is working in my system, let me know if there is any deviation in your case
DATA: lo_dynamic_table TYPE REF TO data,
datatab TYPE string VALUE 'MARA'.
FIELD-SYMBOLS: <lt_table_structure> TYPE table,
<ls_table_structure> TYPE any.
CREATE DATA lo_dynamic_table TYPE TABLE OF (datatab).
ASSIGN lo_dynamic_table->* TO <lt_table_structure>.
SELECT *
FROM mara
INTO TABLE <lt_table_structure>
UP TO 10 ROWS.
LOOP AT <lt_table_structure> ASSIGNING <ls_table_structure>.
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <ls_table_structure> TO FIELD-SYMBOL(<fs_value>).
write <fs_value>.
ENDLOOP.
Please in the question I have already specified that datatab is a generic type and the error is thrown at this line>>>CREATEDATA lo_dynamic_table TYPE TABLE OF(datatab).there's no change from my code!I am refering to the datatab of this exit EXIT_RSAQEXCE_001 try creating a dynamic table of this table.
Can you attach the short dump for further analysis?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please check if the datatab is getting filled in. Also, a good practice to check if lo_dynamic_table is assigned before the assign statement.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.