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
467

Hi Gurus,

I am having three internal tables which contains 9 different fields , and i would like to copy them to one internal table, and print them using ALV list, can somebody show me the procedure to do this.

TYPES : BEGIN OF tekbe,

matnr TYPE ekbe-matnr,

werks TYPE ekbe-werks,

eblen TYPE ekbe-ebeln,

ebelp TYPE ekbe-ebelp,

elikz TYPE ekbe-elikz,

END OF tekbe.

TYPES : BEGIN OF tmkpf,

mblnr TYPE mkpf-mblnr,

budat TYPE mkpf-budat,

END OF tmkpf.

TYPES : BEGIN OF tmseg,

pbamg TYPE mseg-pbamg,

bstmg TYPE mseg-bstmg,

lgort TYPE mseg-lgort,

END OF tmseg.

types : begin of tall,

matnr TYPE ekbe-matnr,

werks TYPE ekbe-werks,

eblen TYPE ekbe-ebeln,

ebelp TYPE ekbe-ebelp,

elikz TYPE ekbe-elikz,

mblnr TYPE mkpf-mblnr,

budat TYPE mkpf-budat,

pbamg TYPE mseg-pbamg,

bstmg TYPE mseg-bstmg,

lgort TYPE mseg-lgort,

end of tall.

DATA : wa_itab TYPE tekbe,

wa_itab1 TYPE tmkpf,

wa_itab2 TYPE tmseg,

wa_itall type tall.

DATA : itab TYPE tekbe OCCURS 0,

itab1 TYPE tmkpf OCCURS 0,

itab2 TYPE tmseg OCCURS 0,

itall type tall occurs 0.

START-OF-SELECTION.

SELECT matnr werks ebeln ebelp elikz FROM ekbe INTO wa_itab.

APPEND wa_itab TO itab.

ENDSELECT.

SELECT mblnr budat FROM mkpf INTO wa_itab2.

APPEND wa_itab1 TO itab1.

ENDSELECT.

SELECT pbamg bstmg lgort FROM mseg INTO wa_itab1.

APPEND wa_itab2 TO itab2.

ENDSELECT.

END-OF-SELECTION.

This is my code i would like to copy the contents of the other three internal tables to itall.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
429

try to use below logic.

loop at tekbe.

data:v_index type i.

v_index = sy-tabix.

read table tmkpf index v_index.

read table tmseg index v_index.

move-corresponding tekbe to all.

move-corresponding tmkpf to all.

move-corresponding tmseg to all.

append all.

endloop.

2 REPLIES 2
Read only

Former Member
0 Likes
430

try to use below logic.

loop at tekbe.

data:v_index type i.

v_index = sy-tabix.

read table tmkpf index v_index.

read table tmseg index v_index.

move-corresponding tekbe to all.

move-corresponding tmkpf to all.

move-corresponding tmseg to all.

append all.

endloop.

Read only

0 Likes
429

replace

tekbe = itab1

tmkpf = itab2

tmseg = itab3

all = itaball