Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting CMFK and CMFP data

Former Member
0 Kudos

Dear All,

I want to delete data from tables CMFK and CMFP tables .

our CMFP table contains around 2 billion entries occupying 0.5 TB of database space.

I m writing small abap program to delete these entries.

will it affect any other tables or processes in SAP?

Below is my small Code

SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S32 { color: #3399FF; } .L0S33 { color: #4DA619; } .L0S52 { color: #0000FF; } .L0S55 { color: #800080; } .L0S70 { color: #808080; }

REPORT zdel_cmfk_cmfp.

TABLES : cmfk , cmfp.

DATA : it_cmfk LIKE cmfk OCCURS 0 WITH HEADER LINE.
DATA : it_cmfp LIKE cmfp OCCURS 0 WITH HEADER LINE.


SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS : aplid TYPE cmfk-aplid.
SELECT-OPTIONS : datum FOR cmfk-datum.
SELECTION-SCREEN : END OF BLOCK b1.

START-OF-SELECTION.

SELECT * FROM cmfk INTO TABLE it_cmfk WHERE aplid = aplid and datum IN datum.

IF it_cmfk[] IS NOT INITIAL.

SELECT * FROM cmfp INTO TABLE it_cmfp
FOR ALL ENTRIES IN it_cmfk
WHERE aplid = it_cmfk-aplid
AND nr = it_cmfk-nr.

ENDIF.


DELETE cmfk FROM TABLE it_cmfk.
DELETE cmfp FROM TABLE it_cmfp.

IF sy-subrc = 0.
WRITE : / 'Table data deleted Sucesfully'.
ENDIF.

Thanks & Regards

Gaurav Joshi

4 REPLIES 4

raymond_giuseppi
Active Contributor
0 Kudos

It depends on applications (CMFK-APLID) but you should use SARA, so identify archive objects which purge this table

Nevertheless, you could

0 Kudos

Dear Raymond,

Thanks for reply,

We already checked table CMFPAR table, it has zero entries in our case.

and we are deleting old data which is more than 10 years old for aplid = 'CK'

Regards

Gaurav

So archive object should be CO_COPC.

0 Kudos

Dear Raymond

Thanks for reply

SAP note you share contains same program in correction instructions

Regards

Gaurav