Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Get contents of 2 internal tables into third internal table.

Hi all,

I'm new to SAP / ABAP.

I've got an issue.

How do i get data in 2 fields of itab1 and anoter field of itab2 into itab3 ?

TABLES : KNA1, VBAK.

DATA :

BEGIN OF ITAB1 OCCURS 5,

KUNNR LIKE KNA1-KUNNR,

NAME1 LIKE KNA1-NAME1,

LAND1 LIKE KNA1-LAND1,

END OF ITAB1,

BEGIN OF ITAB2 OCCURS 5,

VBELN LIKE VBAK-VBELN,

NETWR LIKE VBAK-NETWR,

END OF ITAB2,

BEGIN OF ITAB3 OCCURS 5,

KUNNR LIKE KNA1-KUNNR,

NAME1 LIKE KNA1-NAME1,

NETWR LIKE VBAK-NETWR,

END OF ITAB3.

SELECT KUNNR NAME1 LAND1

FROM KNA1 INTO TABLE ITAB1

WHERE ... (some CONDITION)

.

SELECT VBELN NETWR

FROM VBAK INTO TABLE ITAB2

WHERE ... (some CONDITION)

.

  • THE FOLLOWING WILL GET ONLY 1 CUSTOMER'S NAME IN ITAB3

LOOP AT ITAB1.

ITAB3-KUNNR = ITAB1-KUNNR.

ITAB3-NAME1 = ITAB1-NAME1.

APPEND ITAB3.

ENDLOOP.

LOOP AT ITAB2.

ITAB3-NETWR = ITAB2-NETWR.

APPEND ITAB3.

ENDLOOP.

  • IN DEBUGGING IT'S FINE TILL 1st LOOP, AFTER 2nd LOOP ITAB3 HAS ONLY ONE CUSTOMER'S NAME & NUMBER.

  • Please Help me in resolving this !!

Tags:
Not what you were looking for? View more on this topic or Ask a question