2023 Mar 02 10:45 AM
HI, currently this is my code and it works, however I want to add a filter using the internal table IT_LIPS. Specifically the LFIMG field of it. Can I do it without looping? The reason I don't want to loop because when it loops, it satisfies the conditions and some entries in IT_RECORDS were deleted when it shouldn't.
Current code:
LOOP AT it_vbap ASSIGNING FIELD-SYMBOL(<lfs_it_vbap>).
IF it_records IS NOT INITIAL.
CHECK line_exists( it_records[ vbeln = <lfs_it_vbap>-vbeln
posnr = <lfs_it_vbap>-posnr ] ).
DELETE it_records
WHERE vbeln = <lfs_it_vbap>-vbeln
AND posnr = <lfs_it_vbap>-posnr.
ENDIF.
ENDLOOP.
This is want I want to happen:
LOOP AT it_vbap ASSIGNING FIELD-SYMBOL(<lfs_it_vbap>).
IF it_records IS NOT INITIAL.
CHECK line_exists( it_records[ vbeln = <lfs_it_vbap>-vbeln
orqty = IT_LIPS-LFIMG <--------------Is it possible to insert this?
posnr = <lfs_it_vbap>-posnr ] ).
DELETE it_records
WHERE vbeln = <lfs_it_vbap>-vbeln
AND orqty = IT_LIPS-LFIMG <--------------Is it possible to insert this?
AND posnr = <lfs_it_vbap>-posnr.
ENDIF.
ENDLOOP.
2023 Mar 02 1:09 PM
Hi,
can you use something like this?
data: lt_records like it_records[].
loop at it_records assigning field-symbols(<wa_record>).
read table it_vbap transporting no fields with key " or with table
FIMG = <wa_record>-orqty
posnr = <wa_record>posnr.
check sy-subrc is not initial.
insert <wa_record> into table lt_records.
endloop.
2023 Mar 02 6:34 PM
You didn't explain how IT_LIPS is related to the internal tables IT_VBAP and IT_RECORDS.