Skip to Content
-8
Jul 15, 2019 at 07:26 AM

inner join error

140 Views

im tryin to connect two tables, error massage keep showing

Too few fields in INTO clause.

SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S31 { font-style: italic; color: #808080; } .L0S32 { color: #3399FF; } .L0S33 { color: #4DA619; } .L0S52 { color: #0000FF; } .L0S55 { color: #800080; } .L0S70 { color: #808080; }

REPORT ZSOIPQ.

TYPE-POOLS: slis.

TABLES: VBAK,
VBAP.


TYPES: BEGIN OF ty_vbak,
VBELN TYPE VBELN_VA, "Sales Document
AUART TYPE AUART, " Sales Document Type
END OF ty_vbak.

TYPES: BEGIN OF ty_vbap,
VBELN TYPE VBELN_VA, "Sales Document
POSNR TYPE POSNR_VA, " Sales Document Item
MATNR TYPE MATNR, "Material Number
END OF ty_vbap.


DATA : gt_vbak TYPE TABLE OF ty_vbak,
st_vbak TYPE ty_vbak.

DATA : gt_vbaP TYPE TABLE OF ty_vbaP,
st_vbaP TYPE ty_vbaP.

PARAMETERS: P_vbeln TYPE vbeln.


START-OF-SELECTION.



SELECT vbeln
posnr
matnr
FROM VBAP
INTO TABLE gt_vbap.

SELECT vbak~vbeln
VBAK~AUART
VBAP~vbeln
VBAP~posnr
VBAP~matnr
INTO TABLE gt_vbak
FROM VBAK
INNER JOIN VBAP
ON VBAK~vbeln = VBAP~vbeln
where auart eq 'ZQPC' AND VBAK~vbeln GE '0030000000'.


if sy-subrc = 0.
loop at gt_vbaK INTO st_vbaK.
APPEND st_vbaK to gt_vbak.


AT FIRST.
WRITE: /10'Sales Document',
35 'Sales Document Type',
65 'Sales Document Item',
100 'Material Number'.
ENDAT.

WRITE: /13 ST_VBAK-vbeln,
43 ST_VBAK-auart,
72 ST_VBAP-POSNR,
90 ST_VBAP-MATNR.

ENDLOOP.

SORT gt_vbap.
DELETE ADJACENT DUPLICATES FROM gt_vbap.
endif.

your help is highly appreciated.


thanks