Skip to Content
0
Former Member
Jun 25, 2008 at 09:38 AM

Delete data from table

23 Views

hi gurus,

i am new to abap.

i am create a report using

select-options: apoid,

material,

location to.

parameters: days .

user want to delete entries from the DB table

from system date to behind 5 days left entries

for ex. as today is 25.06.2008 he wants data in DB table

of only 20.06.2008 to 25.06.2008

if other data from left these dates are deleted.

and also in output shows the

2. Report output should contain :

a) Number of entries selected for deleting from table

b) Number of entries deleted from the table table

c) Number of entries remaining in the table table

i am do some coding

plz help me in this case

TABLES: zapolp22.

************************************************************************

  • INTERNAL TABLE *

************************************************************************

TYPES: BEGIN OF it_output,

ordid TYPE ZAPOLP22-ordid, "APO order id

schedid TYPE zapolp22-schedid, "APO schedule line id

matnr TYPE zapolp22-matnr, "Material Number

locto TYPE zapolp22-locto, "APO Destination location

lfmng TYPE zapolp22-lfmng, "Delivery quantity

lfdat TYPE zapolp22-lfdat, "Shipping date

locfr TYPE zapolp22-locfr, "APO Supplying location

rqmng TYPE zapolp22-rqmng, "Required quantity

rqdat TYPE zapolp22-rqdat, "Delivery date

prckz TYPE zapolp22-prckz, "Data element processing

blkstk TYPE zapolp22-blkstk, "Blocked Quantity

oppdelqty TYPE zapolp22-oppdelqty, "Cumulative order qty

zzapologmod TYPE zapolp22-zzapologmod, "Logistic Model

zzflagurgent TYPE zapolp22-zzflagurgent, "APO Urgency Flag

zzapottype TYPE zapolp22-zzapottype, "APO Transport Means

zzndays_l_time TYPE zapolp22-zzndays_l_time,"Lead Time Transport

END OF it_output.

DATA : itab1 TYPE STANDARD TABLE OF it_output." WITH HEADER LINE.

DATA : itab LIKE LINE OF itab1.

************************************************************************

  • SELECTION SCREEN / PARAMETERS *

************************************************************************

SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME.

SELECT-OPTIONS: s_ordid FOR zapolp22-ordid,

s_matnr FOR zapolp22-matnr,

s_locto FOR zapolp22-locto.

SELECTION-SCREEN END OF BLOCK a1.

PARAMETERS: p_days LIKE sy-datum.

************************************************************************

  • DATA

************************************************************************

DATA: days TYPE i.

************************************************************************

  • START OF SELECTION *

************************************************************************

SELECT mandt

ordid

schedid

matnr

locto

lfmng

lfdat

locfr

rqmng

rqdat

prckz

blkstk

oppdelqty

zzapologmod

zzflagurgent

zzapottype

zzndays_l_time

FROM zapolp22 INTO itab

WHERE ordid IN s_ordid AND

matnr IN s_matnr AND

locto IN s_locto.

ENDSELECT.

p_days = sy-datum - days.

DELETE zapolp22 FROM itab.

IF sy-subrc = 0.

WRITE:/ 'DEleted'.

ENDIF.

gururs plz help me its urgent.

thanks

jayant