cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot delete Cost Element in KA04

former_member287204
Participant
0 Kudos

Dear Experts,

My question is related to the following Forum -

http://scn.sap.com/thread/591031

Cannot delete the Cost Element with the following error -

Deletion is not possible (dependent records exist in table COEP)

Message no. KS133

Diagnosis

To maintain the consistency of existing data, you can only delete data if no transaction data exists in the change period. You are not allowed to post either plan data or actual data.

As transaction data already exists in table COEP, you cannot execute the deletion in time period.

The Cost Element's "Valid to" is 31.12.9999 which cannot be changed in KA02. Even if I had created another Validity Period and then deleted for this new Validity Period, it still could not be deleted with the above error.

Just found some records in table COEP which was incorrectly posted.

My question is that is it possible to change the "Valid to" of the Cost Element or delete / archieve the records in table COEP, so that I can delete this Cost Element and future postings of the related GL A/Cs will not require to assign any Cost Object (e.g. Cost Center) ? Actually we still need to use such GL A/C but didn't need to assign the Cost Object.

Tks,

KH Fong

Accepted Solutions (1)

Accepted Solutions (1)

miya_wang
Active Participant

Dear KH Fong,
Please use the following steps mentioned in KBA 1760985 as solution to delete the CO documents.

3.  Remove the previous CO documents.

3.1 Use note 175522 by deleting the postings with report ZKACOR21. Delete all the actual postings for the particular cost element/fiscal year combination so that there are no dependent entries in the CO tables. There are entries in the following tables: COEP, COSP, COSS and COKA.

3.2 Execute the correction program RKPLNC27 for the affected object numbers

3.3 Execute the correction program RKPLNC18 to delete records in COKA

Best regards,
Miya

former_member287204
Participant
0 Kudos

Dear Miya Wang,

Thanks for your advice. Could you let me know what is meant by the KBA 1760985 ?

Tks,

KH Fong

miya_wang
Active Participant
0 Kudos

Hello KH Fong,
Oh, you can find a KBA at the same place you display SAP note.
Just input the KBA number 1760985 then you can read it.
KBA means Knowledge Based Article.
Best regards,
Miya

0 Kudos

Hi Miya,

Is this in the production environment? Please aware that deleting cost element will lead to some inconsistencies in SAP. The alternative way is to put deletion mark on the GL account with FS00 (G/L Account>Set delete flag).


Regards,

Ferdinand

former_member287204
Participant
0 Kudos

Dear Ferdinand,

It is just in our DEV environment. Could you also advise what inconsistencies will cause after deleting the dependent records of cost element ?

We still need to use the GL A/C (for posting without cost object) so cannot mark Deletion Flag for it.

Tks,

KH Fong

former_member287204
Participant
0 Kudos

Dear Miya,

For your above advised SAP Note 175522, it also mentioned a program ZKACOR21R. As checked in transaction RKABSHOW, does it mean that the program ZKACOR21R is used to delete both the "reversed documents (i.e. field COBK-STOKZ = "X")" and the "reversal documents (i.e. field COBK-STFLG = "X") ? and also used to delete the documents with "follow-on documents" that can no longer be reset or posting period is closed.

For other normal documents (i.e. both the fields "COBK-STOKZ & COBK-STFLG = blank"), does it mean that the program ZKACOR21 is used to delete these normal documents ?

Tks,

KH Fong

miya_wang
Active Participant
0 Kudos

Hello KH Fong,
As mentioned in note 175522, you can use the program ZKACOR21R to generate reversal documents for different periods for these documents, if the deletion of the documents is not possible because follow-on documents already exist that can no longer be reset or the posting period is already closed.

This means, program ZKACOR21R is not used to delete reversal documents, but used to generate reversal documents.

To delete normal documents, you can use program ZKACOR21.

Best regards,
Miya

former_member287204
Participant
0 Kudos

Dear Miya,

Thanks for your advice. Does it mean that the program ZKACOR21 is also used to delete those "reversed documents (i.e. field COBK-STOKZ = "X")" and "reversal documents (i.e. field COBK-STFLG = "X")" ?

Tks,

KH Fong

miya_wang
Active Participant
0 Kudos

Dear KH Fong,
Yes, the program ZKACOR21 is also used to delete those "reversed documents (i.e. field COBK-STOKZ = "X")" and "reversal documents (i.e. field COBK-STFLG = "X")" .

But please pay attention to the following part in note 175522.

Important:
Deleting and subsequently posting CO documents may be problematic if one of the following actions already exists for the document:

  • Line item settlement to internal orders or projects
  • Line items planned or invoiced for expense-related invoices
  • Assessments for the period
  • Line items were transfer posted
  • Document was reversed


The last two items can be checked using the option "CO follow-on documents" in transaction RKABSHOW. If a reversal document is concerned that was posted from external accounting to CO, the fields COBK-STOKZ and COBK-STFLG in the document header show whether the document was reversed or is a reversal document. In such cases, you must reverse the transaction before deleting and subsequently posting a CO document (for example, reverse line item settlement or transfer posting) and repeat it after the document is repaired. If you do not do this, there is a risk that document references are no longer correct, and documents may be settled twice (individually), may be transfer posted, and so on. Normal settlements cause no problems because possible differences are taken into account in the next settlement run.

If you delete a reversed document or a reversal document, also delete the associated reversal document or reversed document, respectively (and subsequently post it if necessary).

Best regards,
Miya

former_member287204
Participant
0 Kudos

Dear Miya,

Thanks for your advice again and the above important reminder. Also would like to clarify the above important reminder -

Q1) As it mentioned "...If a reversal document is concerned that was posted from external accounting to CO,...", does the "external accounting" mean other external / NON-SAP system ? If those reversed & reversal documents were generated from SAP FI/CO modules, is it relevant to the case mentioned in the above important reminder ?

Q2) As it mentioned "If you delete a reversed document or a reversal document, also delete the associated reversal document or reversed document, respectively (and subsequently post it if necessary).", I didn't use the program ZKACOR21 before and didn't know such deletion process, does it mean that executing the program ZKACOR21 will directly delete those CO documents from dependent tables such as COEP, COSP, COSS & COKA, and without any record / subsequent documents left ? Why did it mention "(and subsequently post it if necessary)" ?

Tks,

KH Fong

miya_wang
Active Participant
0 Kudos

Hello KH Fong,

To the questions:
1, the external accounting does not mean non-SAP systems. It means "not CO internal postings", such as allocation. The external accounting documents can from MM/SD/FI, etc.


2, yes, program ZKACOR21 will delete documents from tables and no documents left. Therefore it is mentioned in the note 175522 that "Note that in the case of incorrect usage of the program ZKACOR21, data is lost irrevocably."

Best regards,
Miya




former_member287204
Participant
0 Kudos

Dear Miya,

Thanks for your advice again.

For my above Q1,  how can I know whether our CO documents contained those "NON-CO internal postings" / "Allocation" ?

For example, if our CO documents were generated from Goods Issue of Delivery Note (Movement Type 601) and the relevant Material document contained "Accounting document" & "Controlling document", should we have to reverse such posting (Movement Type 602) and then generate the sub-sequent reversal CO documents in the above mentioned table(s) ? Does it mean that the program ZKACOR21R can be used to reverse such posting ?

If the above is correct, after completing the above reversed posting, is it correct to use the program ZKACOR21 to delete all of the reversed and reversal documents ?

Tks,

KH Fong

miya_wang
Active Participant
0 Kudos

Hello KH Fong,
The above understanding is correct.
For CO external postings, the original/source document of the controlling document is from MM/SD/FI.
Best regards,
Miya

former_member287204
Participant
0 Kudos

Dear Miya,

Thanks for your advice and above info.

One more question is that If we had already followed the above instructions to reverse and delete the CO documents, will there be still data inconsistence / bad impact on the SAP system ?

Many Thanks,

KH Fong

miya_wang
Active Participant
0 Kudos

Dear KH Fong,
There should be no data inconsistency if you follow the steps correctly.
And after you finished the deletion, you will be able to delete the cost element.
Best regards,
Miya

Answers (0)