09-07-2007 7:08 PM
I want to delete items that have flag as X. So in this case all records would be deleted from i_vbep.
VBELN POSNR FLAG ETENR MBDAT
0000000001 000010 X 0001 09/06/2007
0000000001 000020 0001 09/06/2007
0000000001 000020 X 0002 09/07/2007
0000000002 000020 0001 09/06/2007
0000000002 000020 X 0002 09/08/2007
0000000002 000030 0001 09/06/2007
0000000002 000030 X 0002 09/10/2007
Message was edited by:
Megan Flores
09-07-2007 7:19 PM
This will only delete those records with flag as X but I need the item removed.
So if you look at the data: 3rd record has flag X item 0002. So that item should be deleted which means 2nd & 3rd row and not just the 3rd row.
Message was edited by:
Megan Flores
09-07-2007 7:10 PM
09-07-2007 7:13 PM
Hi,
Please try this.
DELETE I_VBEP WHERE FLAG = 'X'.
Regards,
Ferry Lianto
09-07-2007 7:14 PM
09-07-2007 7:19 PM
This will only delete those records with flag as X but I need the item removed.
So if you look at the data: 3rd record has flag X item 0002. So that item should be deleted which means 2nd & 3rd row and not just the 3rd row.
Message was edited by:
Megan Flores
09-07-2007 7:25 PM
Some psuedo code.
loop at itab where flag = 'X'.
move vbep, posnr to temp_tab.
collect temp_tab.
endloop.
sort both tables by vbep and posnr.
loop at itab.
read temp tab with key ...
binary search.
if sy-subrc = 0.
delete itab.
endif.
endloop.
(Is VBEP the field name??)
Rob
09-07-2007 7:26 PM
Hi,
i_vbep_1[] = i_vbep[].
delete i_vbep_1 where flag Ne 'X'.
Loop at i_vbep_1.
delete i_vbep where vbeln eq i_vbep_1-vbeln
and posnr eq i_vbep_1-posnr.
endloop.
aRs
09-07-2007 7:34 PM
Rob
(Is VBEP the field name??)
That was a typo, i edited the original msg.
09-07-2007 7:41 PM
SORT I_VBEP BY VBELN POSNR.
JTAB[] = I_VBEP[].
LOOP AT JTAB WHERE FLAG = 'X'.
DELETE I_VBEP WHERE VBELN = JTAB-VBELN
POSNR = JTAB-POSNR.
ENDLOOP.
09-07-2007 8:04 PM
Megan, find the logic below.
*--Types Declaration
TYPES :
BEGIN OF typ_itab,
vbep(10) TYPE c ,
posnr(6) TYPE c ,
flag(1) TYPE c ,
etenr(4) TYPE c ,
mbdat(10) TYPE c ,
END OF typ_itab,
typ_itab_tab TYPE STANDARD TABLE OF typ_itab.
*--Int table Declaration
DATA : it_itab_temp TYPE typ_itab_tab WITH HEADER LINE, "To hold the Initial data
it_itab_final TYPE typ_itab_tab WITH HEADER LINE, "To hold the final results
it_itab_final[] = it_itab_temp[] .
LOOP AT it_itab_temp WHERE flag EQ 'X'.
*--Delete based on Item number & Order
LOOP AT it_itab_final WHERE vbep EQ it_itab_temp-vbep AND
posnr EQ it_itab_temp-posnr.
DELETE it_itab_final.
ENDLOOP..
ENDLOOP.
*--it_itab_final will have the final set of records
BREAK-POINT.
<b>AS</b>