cancel
Showing results for 
Search instead for 
Did you mean: 

Specification deletion (CG02) with linked report (MSDS) in CG50

0 Kudos

I want to clean-up my specification database in CG02. I have an issue with specifications linked to a report (MSDS) in CG50, since the deletion process is blocked by this linked.

How can I cancel the report link in order to be able to do delete my specification :

--> Do we need as a mandatory to previously archive the repor and if yes what is process for implementing the report archiving?

--> Is there another alternative ?

Thanks in adance for your Help.

Marc

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Marc,

I am working on a similar issue right now: I am trying to delete a lot of EHS data.

I am not sure whether or not deleting the reports is in your scope, but you can search the reports in ESTDH by SUBID.

Then use the report MCDOKDEL to delete the reports physically.

I added some tables to be deleted because it disregards some EHS tables:

LOOP AT it_data INTO ls_data.

     DELETE FROM estdj

       WHERE recnroot = ls_data-recn.

     DELETE FROM estdo

       WHERE recnroot = ls_data-recn.

     DELETE FROM estdh

       WHERE dmskey = ls_data-dmskey.

     SELECT recn FROM cvddh

       INTO TABLE lt_recn

       WHERE dmskey = ls_data-dmskey.

     LOOP AT lt_recn INTO ls_recn.

       DELETE FROM cvddp

         WHERE recnroot = ls_recn.

       DELETE FROM cvddh

         WHERE recn = ls_recn.

     ENDLOOP.

ENDLOOP.


For deleting substances you'll need to look into referenced and inherited data and delete dependencies as well. I think I solved it using RC1PHDEL and a recursive search. This is given in my thread http://scn.sap.com/thread/3290719

If this is of any value for you, I am happy to support you on this.

cheers,

J

0 Kudos

Thanks a lot Julian for your answer.

So if I well understood, I need :

1) Flag for deletion the reports I want to get rid of.

2) Copy the report MCDOKDEL and add the detailed ABAP modifications in order to delete entries in some additionnal EHS tables.

3) Run the corrected report

Thanks a lot.

Regards,

Marc

0 Kudos

Hi Marc,

yep, almost . In fact, even simpler:

MCDOKDEL just deletes the report you give to it by the DMSKEYs. There is no DELFLG to be set. Search for your reports, hand its key to MCDOKDEL (e.g. using SUBMIT) and the delete the according lines in tables EST* and CVD*. Then you should be fine.

  *   Export data to memory
      EXPORT itab_draw TO MEMORY ID 'SUBMIT_MCDOKDEL'.
      SUBMIT ('MCDOKDEL') WITH dokar    = l_doccat_tab
                          WITH test    = esp1_false
                          WITH restrict = esp1_true
                          EXPORTING LIST TO MEMORY AND RETURN.

Then you can take care of the rest of the tables.

Is you want to delete substances you'll have to set the DELFLG manually and then run RC1PHDEL. But there is this issue with dependencies you have to take care in advance.

christoph_bergemann
Active Contributor
0 Kudos

Dear all

the proposed solutions by Julian, MArc etc. will on "technical" level work, but I can not recommand to do so. As explained: if you "delelet" (using the above mentioned "potential" solutions) you do not influence the data in CVD1 as an example.- On high level: you will get "corrupt" EH&S database.

In most cases these are some alternatives:

one need to discuss the business demand; because of many reasons (especially in your example) you should not delete the report but make it "invisible".

Here a number of options are available to do so:

1.) move the specification with the report from one substance authorization group to a different one there only you IT SAP Support has access

2.) You could try to use the "Restriction" on specification header to do "nearly" the same. If you create e.g. an access concept there the normal Business user does have only display access right the "restrication" does have the usage e.g. "PUBLIC/REG_WORLD"; if now the restriction would have the restriction does have "PRIVATE/REG_WORLD" the normal user could not "see" the specification.

In most cases these two options are legally more robust; if you use the approach as mentioend above you will have in your database only change documents as the SAP EH&S tables are "empty" now; it will take a while to "reconstruct" the old situation. And as mentioned above. if you have sued an ALE scenario distrbuting SDS now effect will happen in the target system

C.B.

PS: I need to review the code of julian. I believe it "clears" anything related to CG54, CVD1 but not considering ALE etc.

LOOP AT it_data INTO ls_data.

     DELETE FROM estdj

       WHERE recnroot = ls_data-recn.

     DELETE FROM estdo

       WHERE recnroot = ls_data-recn.

     DELETE FROM estdh

       WHERE dmskey = ls_data-dmskey.

     SELECT recn FROM cvddh

       INTO TABLE lt_recn

       WHERE dmskey = ls_data-dmskey.

     LOOP AT lt_recn INTO ls_recn.

       DELETE FROM cvddp

         WHERE recnroot = ls_recn.

       DELETE FROM cvddh

         WHERE recn = ls_recn.

     ENDLOOP.

ENDLOOP.

0 Kudos

I agree with Christoph, in an ALE context this approach does not work.

That was specified in my project, so I did not mentioned that. Sorry.

Shipping orders have to be taken care of as well. Report RCVDRFSH is your friend here.

We'll test our software at the customer next week. I will report back how it worked.

christoph_bergemann
Active Contributor
0 Kudos

Dear Marc

if you have had a linked material to the specification (and with an attached MSDS I would assume that there was a material link) and you are using DG filling, HS filling or substance volume tracking: recommendation is: do not delete the specification.

Further on if you are using SAP EH&S IHS and the specification is used in that context you should not delete the specification.

The material number will not be deleted in your process but will "stay" alone (and there will be change documents on material level I assume indicating that i has been linked to a specification which is not existing any more), Therefore the DG master, HS master and SVT data will stay in database.

In my thread i missed to mention. you can not delete the specification if it is used:

a.) in an inheritance relationsship

b.) or (this is in your case not relevant) has been used as a DG Hazard inducer

Therefore you should check your system landscape and EH&S subprocesses. The change documents related to the specifications will stay as well in the system (if you do not delete them as well). You remove only the data in EH&S tables)

C.B..

0 Kudos

Dear Christoph,

Thanks a lot agian for your answers and help.

I will implement you proposed standard solution and give you a feedback when done.

Regards,

Marc

Answers (1)

Answers (1)

christoph_bergemann
Active Contributor
0 Kudos

Dear Marc

if on level of specification at least one report is "released" or "historic" you can not delete any more the specification  using CG02. Other prerequisites for deletion are:

- no linked material

- specification is not used as reference, part of compositon or specification listing

Therefore: by standard you can not delete the specification.

Based on experience the same specification will have a material linke to it, it is used in compositions and specification listing and most important if a material is attached to the specification and the report is of type SDS/MSDS then it can be assumed that some report distribution took place. Now if you have a distributed SAP landspace with ALE dsitribution of EH&S data from one system to a different one this is in the top a good reason not to delete the specification. If there is a material link one can assume on the top that a GD master and a HS master exists.

All this are reasons why the SAP standard don't allow "easily" to delete the specification. In this FORUM the topic has been discussed several time. Please check other threads as well.

C.B.

PS: to my knowledge: even if the report would be archived you can not delete the specification if you have "released" or "historic" reports. If you have only reports of type e.g. "ready" the story is different.

0 Kudos

Thanks a lot Christoph for your answer. The reason why I want to delete some specifications is  that there are from old entities which are not belonging to our company anymore. Now I understand I don't have an "easy" and standard solution to do so.

Thanks and regards,

marc