Hello all,
I want to combine two internal tables, which don’t have a key. I would have used another JOIN but there are conditions that use the same field. Any ideas would be greatly appreciated. Also, the parts which have a ‘*’ don’t work somehow.
SELECT vbak~bstnk, vbfa~vbelv, vbap~posnr, vbfa~vbeln
FROM vbfa AS vbfa
INNER JOIN vbak AS vbak
ON vbfa~vbelv = vbak~vbeln
INNER JOIN vbap AS vbap
ON vbak~vbeln = vbap~vbeln
INNER JOIN likp AS likp
ON likp~vbeln = vbfa~vbeln
INNER JOIN vbkd AS vbkd
ON vbfa~vbelv = vbkd~vbeln
INNER JOIN vbuk AS vbuk
ON vbuk~vbeln = vbfa~vbelv
WHERE vbfa~vbtyp_n = ‘J’ AND
* vbkd~podkz = ‘X’ AND
* vbuk~wbstk = ‘C’ AND
vbak~vkorg IN @s_vkorg AND
vbak~vtweg IN @s_vtweg AND
vbap~vstel IN @s_vstel AND
vbak~kunnr IN @s_kunde AND
vbak~bstnk IN @s_bstnnr AND
vbak~auart IN @s_auart AND
vbap~pstyv IN @s_pos AND
vbak~vbeln IN @s_vbeln AND
vbak~erdat IN @s_audat AND
likp~vbeln IN @s_liefnr AND
likp~erdat IN @s_lidat
INTO TABLE @DATA(it_bel).
SELECT vbfa~vbelv, vbfa~vbeln
FROM vbrk AS vbrk
INNER JOIN vbfa AS vbfa
ON vbrk~vbeln = vbfa~vbeln
INNER JOIN likp AS likp
ON likp~vbeln = vbfa~vbelv
WHERE vbfa~vbtyp_n = ‘U’ AND
likp~vbeln IN @s_liefnr AND
likp~erdat IN @s_lidat
INTO TABLE @DATA(it_pro).