‎2006 Nov 30 7:40 AM
How to Create a Structure in Abap program ?
Tables: mara
What the meaning of above Statement ?
Thanks in Advance
kri...
‎2006 Nov 30 7:54 AM
Hi Krish
1)<b> Tables: mara
What the meaning of above Statement ?</b>
What it does is it will create a table at runtime of the type MARA.
<b>Note that the TABLES statement is obsolete and is not supposed to be used.</b>
2)<b>How to Create a Structure in Abap program? </b>
The best approach is through TYPES,
TYPES: BEGIN OF t_order,
aufnr LIKE aufk-aufnr,
auart LIKE aufk-auart,
ktext LIKE aufk-ktext,
kostv LIKE aufk-kostv,
objnr LIKE aufk-objnr,
adrnra LIKE aufk-adrnra,
pronr LIKE afko-pronr,
iphas LIKE afih-iphas,
ilart LIKE afih-ilart.
TYPES: END OF t_order.
DATA: i_order TYPE STANDARD TABLE OF t_order, "Internal Table
w_order TYPE t_order. "Work Area
If you want to create a something similar to a data base table / structure
DATA: i_table TYPE STANDARD TABLE OF <Table/Structure Name>, "Internal Table
w_area TYPE <Table/Structure Name>. "Work Area
Regards
Kathirvel
‎2006 Nov 30 7:44 AM
‎2006 Nov 30 7:44 AM
Hi Krish,
to create structure
date begin of structure1,
.. fields here
end of structure1.
check F1 documentation for begin
tables : mara..
here mara will act as a internal table of type mara
Creates an structure - the table work area - in a program, for the database table , view , or structure dbtab with the same name. The structure of the table work area corresponds exactly to the line structure of the database table dbtab. dbtab must be declared in the ABAP Dictionary. ABAP Dictionary.
‎2006 Nov 30 7:44 AM
Hi,
you can create a structure using se11..Data types..select structure radio button...
to create structure having fields from different tables...
data : begin of struct_name,
fieldname type ...,
end of struct_name.
tables : Mara ..means a structure of type mara is created automatically....
Rgds,
Ajith
‎2006 Nov 30 7:45 AM
Hi Krish, You can create structures in ABAP Program for this first u need to create a type declaration ie. type: begin of ty_mara, all the fields ....end of ty_mara
after that u have to create a data structure with this type.
Table: Mara will create a work area of type mara structure.
Thanks and Regards,
Swaroop
‎2006 Nov 30 7:46 AM
Hi,
Check this link.
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/tables.htm
To create structure in database , use tcode SE11.
To create structure in program,
types : begin of ty,
matnr type mara-matnr,
end of ty.
Difference:First one for global access,second one for program's usage.
Reward points if it helps.
‎2006 Nov 30 7:54 AM
Hi Krish
1)<b> Tables: mara
What the meaning of above Statement ?</b>
What it does is it will create a table at runtime of the type MARA.
<b>Note that the TABLES statement is obsolete and is not supposed to be used.</b>
2)<b>How to Create a Structure in Abap program? </b>
The best approach is through TYPES,
TYPES: BEGIN OF t_order,
aufnr LIKE aufk-aufnr,
auart LIKE aufk-auart,
ktext LIKE aufk-ktext,
kostv LIKE aufk-kostv,
objnr LIKE aufk-objnr,
adrnra LIKE aufk-adrnra,
pronr LIKE afko-pronr,
iphas LIKE afih-iphas,
ilart LIKE afih-ilart.
TYPES: END OF t_order.
DATA: i_order TYPE STANDARD TABLE OF t_order, "Internal Table
w_order TYPE t_order. "Work Area
If you want to create a something similar to a data base table / structure
DATA: i_table TYPE STANDARD TABLE OF <Table/Structure Name>, "Internal Table
w_area TYPE <Table/Structure Name>. "Work Area
Regards
Kathirvel
‎2006 Nov 30 8:19 AM
Krish,
Tables:mara.
in the runtime it will behave as work area with all the MARA fields. but it is obsolete.you can access mara structure. but it will occupy lot of memory.
so don't use tables statement in your program.
in program you can create in many ways.
you can create using types,
types: begin of t_mara,
matnr type mara-matnr,
end of t_mara.
or
data: x_mara type mara.
Regards
Vijay