‎2008 Jun 25 10:38 AM
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
‎2008 Jun 25 10:42 AM
I am starting to get annoyed at the use of the words 'gurus' and 'urgent'.
Does your employer realise that you are not competant enough to do your job.
‎2008 Jun 25 10:42 AM
His employer may be aware he's a newbie. He should of course be looking to his colleagues to help. But at least he's made an attempt. Martin is right though - this isn't a problem that requires a guru - it's a beginner task.
For starters try FROM zapolp22 INTO TABLE itab and remove the ENDSELECT.
Then LOOP AT itab...ENDLOOP.
READ the ABAP help for any keywords you don't understand. And DON'T use itab as a name for your internal table. Use a MEANINGFUL name. like t_apo_data.
matt
‎2008 Jun 25 10:50 AM
Hi,
Fetch the data what you do want to delete in an internal table and then use the delete database statement i.e.
DELETE (dbtabname) FROM TABLE itab.
I hope this will help you.
<REMOVED HORRIBLE STATEMENT, OTHER SUCH USE OF HORRIBLE STATEMENTS WILL RESULT IN A REMOVAL OF ACCOUNT>
Edited by: Craig Cmehil on Jun 25, 2008 4:25 PM