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

Tables statement inside classes methods

former_member302630
Participant
0 Likes
4,014

Dear All,

I am building a method in a class. I am using a select statement where I extract data from table1 into itab2 for all entries in itab1.

It is giving error, "table1" is not defined in the ABAP Dictionary as a table, projection view, or database view. But when I try to use tables : table1, it again refuses to accept that statement inside the method. Any workaround?

Regards,

Cleo

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
2,154

The TABLES statement is obsolete and should not be used. ALWAYS use a seperately defined work area.

4 REPLIES 4
Read only

Sandra_Rossi
Active Contributor
2,154

You should read the documentation -> first sentence: "This statement is not allowed in classes" (cf http://help.sap.com/abapdocu_702/en/?url=ABAPTABLES.htm)

To declare a variable, use DATA (cf http://help.sap.com/abapdocu_702/en/?url=ABAPDATA.htm).
Read only

former_member302630
Participant
0 Likes
2,154

I made a structure and using that to extract data and used that in a FM.

Read only

0 Likes
2,154

Post your problem code here (method and table declaration).

Read only

matt
Active Contributor
2,155

The TABLES statement is obsolete and should not be used. ALWAYS use a seperately defined work area.