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

issue with create data

former_member203480
Participant
0 Likes
1,055

i want to create a table with table type

TYPES: BEGIN OF my_DATA,
COLUMN1 TYPE CHAR50,
COLUMN2 TYPE CHAR50,
COLUMN3 TYPE CHAR50,
COLUMN4 TYPE CHAR50,
COLUMN5 TYPE CHAR50,

end of my_data.

DATA: LR_DATAREF TYPE REF TO DATA,

LT_TABLE TYPE STANDARD TABLE OF my_DATA.

FIELD-SYMBOLS:
<LT_UPDTAB> TYPE STANDARD TABLE.

TRY.
CREATE DATA LR_DATAREF TYPE TABLE OF ('LT_TABLE').

ASSIGN LR_DATAREF->* TO <LT_UPDTAB>.

this is not working .it is unable to recognise internal table LT_TABLE..

CREATE DATA LR_DATAREF TYPE TABLE OF ('LT_TABLE').

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
986
CREATE DATA LR_DATAREF TYPE TABLE OF ('LT_TABLE').

tries to find LT_TABLE as a data type, but there's none (LT_TABLE is a variable).

What you want to do:

CREATE DATA LR_DATAREF LIKE LT_TABLE.
3 REPLIES 3
Read only

Sandra_Rossi
Active Contributor
0 Likes
986

Please use the CODE button to format your code so that it's shown in a more user-friendly format (colorized).

Read only

Sandra_Rossi
Active Contributor
987
CREATE DATA LR_DATAREF TYPE TABLE OF ('LT_TABLE').

tries to find LT_TABLE as a data type, but there's none (LT_TABLE is a variable).

What you want to do:

CREATE DATA LR_DATAREF LIKE LT_TABLE.
Read only

matt
Active Contributor
986

Or better define the internal table type as a type (I've removed the OP's prefixes as they're not in accordance with the SAP style guide or DSUG recommendations:

TYPES: BEGIN OF my_DATA,
COLUMN1 TYPE CHAR50,
COLUMN2 TYPE CHAR50,
COLUMN3 TYPE CHAR50,
COLUMN4 TYPE CHAR50,
COLUMN5 TYPE CHAR50,
end of my_data.
TYPES my_data_set type standard table of my_data with default key.
DATA DATAREF TYPE REF TO DATA,
MY_TABLE TYPE my_data_Set.
FIELD-SYMBOLS: <UPDTAB> TYPE STANDARD TABLE.
TRY.
CREATE DATA DATAREF TYPE my_data_set.
ASSIGN DATAREF->* TO <UPDTAB>.