Skip to Content
0
Feb 23, 2010 at 12:15 PM

itab filtering

24 Views

Hi Guys,

Have a situation as follows:

Have an internal table as below.Have filled the itab with a select statement.

DATA: BEGIN OF t2 OCCURS 0,	
	mdocnr TYPE rkwa-mblnr,
        mjahr TYPE rkwa-mjahr,
        zeile TYPE rkwa-zeile,
        budat TYPE rkwa-budat,
        matnr TYPE rkwa-matnr,
        belnr TYPE rkwa-belnr,
        bwart TYPE mseg-bwart,
        sobkz TYPE mseg-sobkz,
        lifnr TYPE mseg-lifnr,
        kdauf TYPE mseg-kdauf,	
	posnn TYPE vbfa-posnn,
        posnr TYPE ser01-posnr,
        obknr TYPE ser01-obknr,
        sernr TYPE equi-sernr,
        matn2 TYPE objk-matnr,
        mtart TYPE mara-mtart,

	END OF t2.

When looping through the itab:

When the itab contains for example, 3 rows(It could be more than 3 as well) with the same meaterial document number(mdocnr) and when t2-posnr > t2-posnn for all the 3 rows,I want to delete all the rows(In our example - 2 rows) except 1 and modify this row so that I want to make the posnr and posnn value TO empty strings and update or write it back to the itab.

When the hit is only one.Ie: where only 1 row is found where t2-posnr > t2-posnn ,I want to make the posnr and posnn value of this single row TO empty strings and update or write it back to the itab.

How could it be done....

Would appreciate if someone could post a sample code.

Thanks

P