Code: Alles auswählen.
SELECT MAX( es~eindt )
INTO e_eindt
FROM ekes AS es INNER JOIN vbfa AS fa
ON es~ebeln = fa~vbeln AND
es~ebelp = fa~posnn
WHERE fa~vbelv = e_vbeln AND
fa~posnv = tmp_posnr AND
fa~vbtyp_n = 'V'.
Code: Alles auswählen.
DATA: tmp_posnn TYPE vbfa-posnn,
tmp_vbeln TYPE vbfa-vbeln.
SELECT SINGLE vbeln posnn
INTO (tmp_vbeln,tmp_posnn)
FROM vbfa
WHERE vbelv = e_vbeln
AND posnv = tmp_posnr
AND vbtyp_n = 'V'.
IF sy-subrc = 0.
SELECT SINGLE max( eindt ) INTO e_eindt FROM ekes
WHERE ebeln = tmp_vbeln
AND ebelp = tmp_posnn.
ENDIF.