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
1,403

Hi,

How to declare a internal table and work area for the internal table without using occurs n and using types.I have to select fields from differnet tables and put in an internal tables.

tables are mseg,mkpf

1 ACCEPTED SOLUTION
Read only

abdul_hakim
Active Contributor
0 Likes
1,332

*internal table declaration

data: itab_mseg like table of mseg,

itab_mkpf like table of mkpf.

*work area declaration

data: wa_mseg like mseg,

wa_mkpf like mkpf.

Cheers,

Abdul Hakim

13 REPLIES 13
Read only

abdul_hakim
Active Contributor
0 Likes
1,333

*internal table declaration

data: itab_mseg like table of mseg,

itab_mkpf like table of mkpf.

*work area declaration

data: wa_mseg like mseg,

wa_mkpf like mkpf.

Cheers,

Abdul Hakim

Read only

Former Member
0 Likes
1,332

ex----

types : begin of ty_tab,

matnr type matnr,

end of ty_tab.

data : it_tab type standard table of ty_tab,

wa_tab type ty_tab.

The above type declaration is better.Also try to use fieldsymbols which increase the perforamnce

Read only

Former Member
0 Likes
1,332

Hi,

data: it_mseg type table of mseg,
      it_mkpf type table of mkpf.

data: wa_mseg type mseg,
      wa_mkpf type mkpf.

or declare types

types: brgin of ty_itab,
        include your fields here....

       end of ty_itab.
data: itab type table of ty_itab,
      wa_itab type ty_itab.

Regards

vijay

Read only

Former Member
0 Likes
1,332

Hi ,

The syntax is:

TYPES : BEGIN OF t_table.

INCLUDE STRUCTURE mseg.

TYPES : END OF t_table .

data: i_table type standard table of t_table.

Regards,

Sumit.

Read only

Former Member
0 Likes
1,332

Amit,

1. DATA : WA_ITAB LIKE (Same TYPE as that of the internal table).

2. DATA : wa_itab like line of internal table.

loop at itab into wa_itab.

endloop.

Regards,

Ravi

Note : Please mark all the helpful answers

Read only

Former Member
0 Likes
1,332

hi

types : begin of t_itab,

matnr type matnr,

end of ty_tab.

data : t_itab type standard table of t_itab,

wa_tab type t_itab.

Naveen

Read only

Former Member
0 Likes
1,332

Hi Amit

TYPES: BEGIN OF LINE,

COLUMN1 TYPE I,

COLUMN2 TYPE I,

COLUMN3 TYPE I,

END OF LINE.

TYPES ITAB TYPE SORTED TABLE OF LINE WITH UNIQUE KEY COLUMN1

Reward point if helpful.

Regards

Abhishek

Read only

Former Member
0 Likes
1,332

HI Amit,

Define :


TYPES: BEGIN OF WA_MSEG_MKPF,
       field1 type mseg-field1,
       field2 type mseg-field2,

       field3 type mkpf-field3,
       field4 type mkpf-field4,
       END OF WA_MSEG_MKPF.

DATA: ITAB_MSEG_MKPF TYPE TABLE OF WA_MSEG_MKPF.

CHEERS,

Vijay Raheja

Read only

Former Member
0 Likes
1,332

Hi amit teja,

You can define your internal table as:

data: begin of itab,

matnr like mara-matner,

vbeln like mseg-vbeln,

....

...

end of itab.

or you can use type table of mara,

here you can use mara,mseg DDiC table and now you can select data with useig join(inner / outer ) fetch data or selecting fields from mara and mseg and move-corresponding fields mara to itab.

move-corresponding from mseg into itab.

regards.

Ankur garg.

Message was edited by: Ankur Garg

Read only

Former Member
0 Likes
1,332

hi,

TYPES: begin of w_tab,

vbeln type vbeln,

end of w_tab.

TYPES t_tab type standard table of w_tab.

Regards,

Subha.

Read only

Former Member
0 Likes
1,332

Hi,

Do like this.

data: begin of work_area,

field1 type tab1-field1,

field2 type tab2-field2,

end of work_area.

data: itab type table of work_area with header line.

Regards,

SP.

Read only

former_member184495
Active Contributor
0 Likes
1,332

hi amit,

u can use 'Innerjoin' or 'For all entries' and fill the internal table.

'Innerjoin': put all fields in a select and use 'into corresponding fields'

'For all entries': if u, using more than 1 internal table.

try it out,

cheers,

Aditya.

Read only

Former Member
0 Likes
1,332

hi amit,

u can declare like that-->

types: begin of wa_itab,

MBLNR like mseg-MBLNR,

MJAHR like mkpf-MJAHR,

end of wa_itab.

data: itab type table of wa_itab.

if it will help u than give reward points.

with regards

chetan vishnoi