‎2007 Apr 02 5:14 AM
Hi All,
I'm working on OOPS and got a typical problem.I've created a class in class builder and created methods for the class.while coding for the method itried to ues the tables statement. like tables : abc,def.
but its giving the error
You cannot use the TABLES statement within a method.
How can i resolve this?
Rgds,
Prajith
‎2007 Apr 02 5:19 AM
Hi,
In ABAP object TABLES statement is not allowed. The statement TABLES does nothing but create a work ares. Intead use DATA statement to create work area explicitly.
See what SAP says about this:
***************************************
Creating table work areas with the TABLES statement
is forbiddenin ABAP Objects.
In ABAP Objects, an error message occurs on:
TABLES dbtab.
Correct syntax:
---------------
DATA wa TYPE dbtab.
Reason:
-------
The semantics of the TABLES statement is ambiguous.
Instead of table work areas, you should use explicit work
areas******************************************
Let me know if you have any question.
Regards,
RS
‎2007 Apr 02 5:19 AM
Hi,
In ABAP object TABLES statement is not allowed. The statement TABLES does nothing but create a work ares. Intead use DATA statement to create work area explicitly.
See what SAP says about this:
***************************************
Creating table work areas with the TABLES statement
is forbiddenin ABAP Objects.
In ABAP Objects, an error message occurs on:
TABLES dbtab.
Correct syntax:
---------------
DATA wa TYPE dbtab.
Reason:
-------
The semantics of the TABLES statement is ambiguous.
Instead of table work areas, you should use explicit work
areas******************************************
Let me know if you have any question.
Regards,
RS
‎2007 Apr 02 5:23 AM
Hi Prajith ,
I cannot understand why you want to use TABLES in a method , as my understanding is that we use tables generally to define elements in out selection screen.
So if would be great if you could tell why you want to use the tables statement in the method , as this will help us suggest some alternative
Regards
Arun
‎2007 Jun 01 10:02 AM
Hi Arun!
I have some similar problem like Prajith. The reason is (in my case) in a method I would like to add a new record to table <b>USR01</b>. If I don't define it with statement <b>TABLES</b> the system doesn't recognizes him and says <b>Field "USR01" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.</b>. So I think somewhere I have to define it with <b>TABLES: USR01</b>. But by this I get that errormessage like Prajith too.
Have you any idea dear Arun R?
‎2007 Jun 01 11:14 AM
Hi Janos,
Usage of tables statement is prohibited in object oriented abap.u can define a work area type table.
DATA WA_ITAB TYPE USR01.
now u can add new record to the workarea and then to the table.
Regards,
Prajith
‎2007 Jun 15 9:44 AM
Hi Prajith,
thanx to Your help, but I have resolved the problem by another way. I have just created a function element than I'm call that from the method. I'ts work perfectly now
Bye