hi,
i am create a query for delete data from database table by using an internal table i am delete data from DB table but a problem are come as in output display
i am showing the
NUMBER OF ENTRIES ARE DELETE FROM TABLE: 2
NUMBER OF ENTRIES ARE REMAIN IN TABLE AFTER DELETEION:
seletion screen contains
SELECT-OPTIONS: s_ordid FOR zapolp22-ordid, "APO order id
s_matnr FOR zapolp22-matnr, "Material Number
s_locto FOR zapolp22-locto. "APO Destination location
PARAMETERS: p_days TYPE i. "Number of days
the problem are as:
if i am given only P-days parameter value 3
than it works as fine
showing output right as 2 rows are deleted
and 8 rows are remains in table
if i given all fields fill up in selection screen
as s_ordid----->4516 to 4517
s_matnr---->85503 to 85505
s_locto------> m100 to m101
p_days----> 2
then i get output display as
number of entries are deleted 2
number of entries are remain in table 0.
but the 2 rows are deleted from DB table and 8 rows are remain in table but it not show the 8 rows on display screen it shows zero.
my code is as:
DATA: lv_count TYPE i,
lv_count1 TYPE i.
DATA: lv_date TYPE sy-datum.
SELECT mandt
ordid
schedid
matnr
locto
lfmng
lfdat
locfr
rqmng
rqdat AS lv_date
prckz
blkstk
oppdelqty
zzapologmod
zzflagurgent
zzapottype
zzndays_l_time
FROM zapolp22 INTO TABLE lt_output
WHERE ordid IN s_ordid AND
matnr IN s_matnr AND
locto IN s_locto.
SORT lt_output[] BY rqdat.
*----
>Number OF Days to be Counted
lv_date = sy-datum - p_days.
LOOP AT lt_output.
IF lt_output-rqdat LT lv_date.
MOVE-CORRESPONDING lt_output TO lt_delete.
APPEND lt_delete.
lv_count = lv_count + 1.
ELSE.
lv_count1 = lv_count1 + 1.
ENDIF.
endloop.
DELETE FROM zapolp22 WHERE rqdat LT lv_date AND
ordid IN s_ordid AND
matnr IN s_matnr AND
locto IN s_locto.
IF sy-subrc = 0.
WRITE:/25 'Number of entries deleted :', lv_count.
WRITE:/25 'Number of entries remaining :', lv_count1.
ELSEIF sy-subrc NE 0.
WRITE:/ 'No data are selected for delete'.
ENDIF.
Tell me where in this code i do mistake.
Thanks jayant.