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

Structure

Former Member
0 Likes
847

How to Create a Structure in Abap program ?

Tables: mara

What the meaning of above Statement ?

Thanks in Advance

kri...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
822

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

7 REPLIES 7
Read only

Former Member
0 Likes
822

hi Krish,

       Data : v_struct like mara.

Regards,

Sanrtosh

Read only

Former Member
0 Likes
822

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.

Read only

Former Member
0 Likes
822

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

Read only

Former Member
0 Likes
822

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

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
822

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.

Read only

Former Member
0 Likes
823

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

Read only

Former Member
0 Likes
822

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