I have done a selection of the table VBFA
, that has selected various SD documents based on the code below, and another selection of the table VBRK
that has selected the documents that do not have a NETWR = 0
. What I want to achieve is to select only those SD documents that are NETWR NE 0
.
The code for the selection of the table VBFA
is as follows:
SELECT * FROM vbfa AS v INTO TABLE gt_vbfa_inv
FOR ALL ENTRIES IN gt_vbak
WHERE vbelv = gt_vbak-vbeln
AND vbtyp_n IN ('M', 'O', 'P', '5', '6')
AND stufe = '00'
AND NOT EXISTS ( SELECT * FROM vbfa
WHERE vbelv = v~vbeln
AND posnv = v~posnn
AND vbtyp_n IN ('N', 'S')
AND stufe = '00' ) .
And the code for the selection of the VBRK
table is as follows:
IF sy-subrc = 0.
SELECT DISTINCT * FROM vbrk
INTO TABLE gt_vbrk
FOR ALL ENTRIES IN gt_vbfa_inv
WHERE vbeln EQ gt_vbfa_inv-vbeln
AND netwr NE 0.
ENDIF.
Is there any way to merge these to two selection via a new Select or a Loop condition, that will select the documents of the table VBFA
, where the documents will not have a NETWR = 0
(or NETWR NE 0
)?
Thank you all in advance!