Online Tutorials & Training Materials | STechies.com
Register Login

Merging Two Internal Tables for Showing Data

|| || 0

Merging Two Internal Tables for Showing Data
Stechies

Following is the ABAP Program of merging two tables for showing data:

TABLES: mara, makt.

DATA: BEGIN OF itab OCCURS 0,

matnr LIKE mara-matnr,
mbrsh LIKE mara-mbrsh,
mtart LIKE mara-mtart,
maktx LIKE makt-maktx,
END OF itab.

DATA: BEGIN OF itab2 OCCURS 0,

matnr LIKE makt-matnr,
maktx LIKE makt-maktx,
END OF itab2.

SELECT matnr

mbrsh
mtart
FROM mara
INTO TABLE itab UP TO 10 ROWS .

SELECT matnr

maktx FROM makt
INTO TABLE itab2
FOR ALL ENTRIES IN itab
where matnr = itab-matnr
and spras = 'EN'.

READ TABLE itab2 WITH KEY matnr = itab-matnr.
IF sy-subrc = 0.
ITAB-MAKTX = ITAB2-MAKTX.

MODIFY itab.

ENDIF.
endloop .
loop at itab.
write:/ itab-matnr,
itab-mbrsh,
itab-maktx,
itab-mtart.
endloop.

Read Here at SAP ABAP Forum to Get Answers for Queries Related to this Program.


Related Articles