Application Development 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: 

regarding internal tables

Former Member
0 Kudos

hi all,

can u explain me how to write data,types definitionss and how to write intenal table and how to populate it with the example.

thanks in advance

shekar

4 REPLIES 4

Former Member
0 Kudos

Hi,

Refer this e.g.

REPORT demo_int_tables_move .

* move

DATA: BEGIN OF line,
        col1(1) TYPE c,
        col2(1) TYPE c,
      END OF line.

DATA: etab LIKE TABLE OF line WITH HEADER LINE,
      ftab1 LIKE TABLE OF line.

line-col1 = 'A'. line-col2 = 'B'.

APPEND line TO etab.

MOVE etab[] TO ftab1.

LOOP AT ftab1 INTO line.
  WRITE: / line-col1, line-col2.
ENDLOOP.

SKIP.
ULINE.

* =

DATA: ftab2 TYPE SORTED TABLE OF f
            WITH NON-UNIQUE KEY table_line,
      itab1 TYPE HASHED TABLE OF i
            WITH UNIQUE KEY table_line,
      fl    TYPE f.

DO 3 TIMES.
  INSERT sy-index INTO TABLE itab1.
ENDDO.

ftab2 = itab1.

LOOP AT ftab2 INTO fl.
  WRITE: / fl.
ENDLOOP.

SKIP.
ULINE.

former_member588853
Active Contributor
0 Kudos

*Type declaration

Types : begin of ty_mara,

matnr type matnr,

werks type werks_d,

end of ty_mara.

*internal table

data: it_mara type standard table of ty_mara.

*work area

data: wa_mara type ty_mara.

select matnr werks from mara

into table it_mara

where matnr = <your selection screen parameter name of matnr>.

you can use ALV grid Function madule for display or can just write

loop at it_mara into wa_mara.

write: / wa_mara-matnr, wa_mara-werks.

endloop.

top-of-page.

write: 'MATERIAL', "PLANT'.

rewards if useful

regards,

nazeer

Former Member
0 Kudos

Hi

see the following code......

REPORT YTEST.

"----


  • Type Declaration *

"----


TYPES:

BEGIN OF FLIGHT, " Field string for flight..

CARRID(2) TYPE C, " Carrier Id.

CONNID(4) TYPE N, " Connection Id.

END OF FLIGHT. " BEGIN OF FS_FLIGHT

DATA FS_FLIGHT TYPE FLIGHT.

"----


  • Internal table to store flight details *

"----


DATA:

T_FLIGHT TYPE STANDARD TABLE OF FLIGHT WITH HEADER LINE.

T_FLIGHT-CARRID = 'AA'.

T_FLIGHT-CONNID = '0017'.

APPEND T_FLIGHT.

T_FLIGHT-CARRID = 'AI'.

T_FLIGHT-CONNID = '0021'.

APPEND T_FLIGHT.

FS_FLIGHT-CARRID = 'DL'.

FS_FLIGHT-CONNID = '1984'.

APPEND T_FLIGHT.

T_FLIGHT-CARRID = 'UA'.

T_FLIGHT-CONNID = '1941'.

APPEND T_FLIGHT.

T_FLIGHT-CARRID = 'LH'.

T_FLIGHT-CONNID = '1699'.

APPEND T_FLIGHT.

WRITE / 'the data in the internal table is :'.

LOOP AT T_FLIGHT.

WRITE:

/10 T_FLIGHT-CARRID,

T_FLIGHT-CONNID.

ENDLOOP.

Regards,

Suresh.....

Former Member
0 Kudos

hi,

check below coding.

report zsr_rept_inttable.

tables : lfa1.

select-options : s_lifnr for lfa1-lifnr.

*types

types : begin of ty_lfa1,

lifnr like lfa1-lifnr,

name1 like lfa1-name1,

land1 like lfa1-land1,

end of ty_lfa1." structure declaration

*internal table declaration

data : i_lfa1 type standard table of ty_lfa1 with header line, "internal table declaration

start-of-selection.

select lifnr name1 land1 from lfa1 into table i_lfa1 where lifnr in s_lifnr.

end-of-selection.

loop at i_lfa1.

write 😕 i_lfa1-lifnr,i_lfa1-name1,i_lfa1-land1.

endloop.