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

DIFF: Field string ,Structure and Internal table declaration

Former Member
0 Likes
636

Hai,

what is the diference between Field string ,Structure in ABAP program and Internal table declaration and how it will work ?

Thank you

ASHOK KUMAR.

4 REPLIES 4
Read only

Former Member
0 Likes
548

Hi,

Structure:

Types : Begin of st,

<include fields wth data type>,

End of sr.

Internal table

Data : itab type standard table of st .

Thanks

Sandeep

Reward if helpful

Read only

Former Member
0 Likes
548

hi ashok,

internal tables: used for temporary storages.internal tables can be with or with out header lines.

structures: used to different fields together in a single unit. it doesnt occupy any memory. it doesnt hav any primary key. its just a template.

field symbols: using this field symbols we can store any type of data. i.e for internal tables we declare a table with respect to a table.and we cant store data of another table in that table where as a field symbol can be used for generic purpose.

i.e we can store any table data in it. it depends on runtime what kind of data that we r using that field symbol.

if helpful reward some points.

with regards,

suresh babu aluri.

Read only

0 Likes
548

Hi,

data : begin of itab occurs 0.

include sctruture mara.

end of itab.

now iTAB HAS THE STRUTURE OF MARA

OR

data : begin of itab occurs 0,

MATNR LIKE MARA-MATNR,

--- DECLARE ALL FIELDS INDIVIDUALLY

end of itab.

SO STRUCTURE HELPS TO DO IN A SINGLE STEP

Thanks

venki

Read only

Former Member
0 Likes
548

hi,

Look this u will get a good idea.

*&---------------------------------------------------------------------*
*& Report  ZTYPES                                                      *
*&                                                                     *
*&---------------------------------------------------------------------*
REPORT  ZTYPES                                                  .

* Table declaration (old method)
DATA: BEGIN OF tab_ekpo OCCURS 0,             "itab with header line
  ebeln TYPE ekpo-ebeln,
  ebelp TYPE ekpo-ebelp,
 END OF tab_ekpo.

*Table declaration (new method)     "USE THIS WAY!!!
TYPES: BEGIN OF t_ekpo,
  ebeln TYPE ekpo-ebeln,
  ebelp TYPE ekpo-ebelp,
 END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,      "itab
      wa_ekpo TYPE t_ekpo.                    "work area (header line)

* Build internal table and work area from existing internal table
DATA: it_datatab LIKE tab_ekpo OCCURS 0,      "old method
      wa_datatab LIKE LINE OF tab_ekpo.

* Build internal table and work area from existing internal table,
* adding additional fields
TYPES: BEGIN OF t_repdata.
        INCLUDE STRUCTURE tab_ekpo.  "could include EKKO table itself!!
TYPES: bukrs  TYPE ekpo-werks,
       bstyp  TYPE ekpo-bukrs.
TYPES: END OF t_repdata.
DATA: it_repdata TYPE STANDARD TABLE OF t_repdata INITIAL SIZE 0,   "itab
      wa_repdata TYPE t_repdata.                 "work area (header line)

Regards

Reshma