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 read ad write tables in a method.

Former Member
0 Kudos
203

Hi,

I have defined two tables T1 and T2 in the catalog (se11). I am testing a method where I need to read records of the T1 table and write information into T2 table.

I find an error if I define in my method:

tables: T1

I do not know if it is necessary to export/pass the tables T1 and T2 through my method.

Any suggestion will be well appreciated.

Thanks in advance.

Regards,

Giovanni

1 ACCEPTED SOLUTION
Read only

Former Member
0 Kudos
155

Tables Statement cannot be used in Methods.

Create an internal table in the Method.

Data:Itab type table of T1.

Regards,

Gurpreet

3 REPLIES 3
Read only

Former Member
0 Kudos
156

Tables Statement cannot be used in Methods.

Create an internal table in the Method.

Data:Itab type table of T1.

Regards,

Gurpreet

Read only

matt
Active Contributor
0 Kudos
155

>

> Tables Statement cannot be used in Methods.

> Create an internal table in the Method.

>

>

Data:Itab type table of T1.

>

> Regards,

> Gurpreet

While that might solve the original posters problem,it is not correct. The replacement for

TABLES: t1.
SELECT * FROM t1...

is

DATA: ls_wa TYPE t1.
SELECT * INTO ls_wa FROM t1...

The TABLES statement declares a FLAT structure not an internal table.

matt

Read only

0 Kudos
155

I tried to replicate the same senario table statement it gave syntax error.Then i tried changing the tables statement.It worked.I know that tables statement creates work area with the same as table name give.

I agree with what you say is correct but it was just the answer that would resolve the problem for above question as he had two tables to work with.

Thanks for your inputs.The informations about the alterante usage of tables in class was good.Thanks sir

Regards,

Gurpreet