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

internal tables

Former Member
0 Likes
726

how to create inernal table ? plz help. and send 1 syntax for internal table.

7 REPLIES 7
Read only

Former Member
0 Likes
695
data : begin of itab occurs 0,
         matnr like mara-matnr,
        end of itab.

Regards,

Santosh

Read only

Former Member
0 Likes
695

hi,

You can also declare like this.

    TYPES : BEGIN OF ty_charg,
              charg TYPE charg,
            END OF ty_charg.
*Table
    DATA : it_charg TYPE STANDARD TABLE OF ty_charg.
*Structure
    DATA : x_charg TYPE ty_charg.

Regards,

Richa

Read only

0 Likes
695

thanx...for yr nice answer

Read only

former_member188827
Active Contributor
0 Likes
695

types: begin of it,

f1 type i ,

f2 type i,

end of it.

itab-f1 = 20.

itab-f2 = 30.

append itab.

data: itab type standard table of it with header line.

loop at it.

write:/it-f1, it-f2.

endloop.

u can also create sorted or hashed table based on ur requirement.

Read only

Former Member
0 Likes
695

Hi Rohan ,

There are two ways of creating an internal table

1. data : Begin of it_1 occurs 0 ,

matnr type matnr ,

werks type werks_d,

End of it_1.

2. This is the prefered way , first you define and type and then declare an internal table of that type

TYPES : Begin of ty_1 ,

matnr type matnr ,

werks type werks_d,

End of ty_1.

DATA : it_1 type table of ty_1.

there is also one more way to creat internal tables when the structure is already define in the data dictionary e.g. if we want to create a table having structure similar to table MARA

DATA : it_1 type table of mara.

Regards

Arun

  • Assign points if reply is helpful

Read only

Former Member
0 Likes
695

Hi Rohan,

*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)

An internal table is a run time instance. It get created when program starts execution.

*It get destroyed when program terminates. it has two different parts. HeaderLine(optional) & Body(Compulsory).

*Any value that comes to or goes from interanal table , that travels through headerline.\

header line is obselete now so we do not use with header line.

Read only

SantoshKallem
Active Contributor
0 Likes
695

http://www.sap-img.com/ab009.htm

Reward if useful.

cheers.

santhosh