cancel
Showing results for 
Search instead for 
Did you mean: 

Mass deletion of Save Search

pedro_murias
Participant
0 Kudos

Hi,

I need to delete all saved searches on a specific component.

I have already check on table CRMD_SHORTCUT and I know which ones I shall delete.

But I don't like the idea of deleting directly the registers of that table.

Any FM or report that can be used?

Regards

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182421
Active Contributor
0 Kudos

I'm afraid you will need to develop a custom report to do that an interesting option can be using the BOL component set SAVEDSEARCH, you have nice queries there:

ShortcutSearchByAudience

ShortcutSearchByKey

ShortcutSearchByOwner

ShortcutSearchByParameter

I guess those queries will retunr the root object Shortcut, once you got the instance you will need to use the instance of CL_CRM_SHORTCUT_MANAGER in order to delete the shortcut.

You can put a break point into the method EH_ONDELETE of the class CL_CRM_SAVE_LAUNCHER_IMPL and remove a saved search from the WebUI in order to understand how it works.

Unfortunately I can not give you more detail because a never faced this scenario so will be cool if you share your conclusions with us.

Cheers!

Luis

pedro_murias
Participant
0 Kudos

I did some debuging on that and didn't get  much conclusions coding will be kind of.

identify your searches on CRM_SHORTCUT.

To get guid and type

       guid = iv_shortcut->get_property_as_string( iv_attr_name = 'GUID' ).

       type = iv_shortcut->get_property_as_string( iv_attr_name = 'TYPE' ).

*     Delete the saved search shortcut

       iv_shortcut->delete( ).

*     Clean-up references

       data: referencing_shortcuts type ref to if_bol_entity_col,

             referencing_shortcut type ref to cl_crm_bol_entity.

       referencing_shortcuts =

          me->get_shortcuts_by_reference_key( iv_referenced_key = guid ).

       referencing_shortcut = referencing_shortcuts->get_first( ).

       while referencing_shortcut is not initial.

         me->delete_shortcut( iv_shortcut = referencing_shortcut ).

         referencing_shortcut = referencing_shortcuts->get_next( ).

       ENDWHILE.

Any case still searching for a cleaner solution..

former_member182421
Active Contributor
0 Kudos

Well that's what's happening inside the method of the CL_CRM_SHORTCUT_MANAGER->DELETE_SHORTCUT but you don't need the code inside of this method right?

Maybe I'm getting lost somewhere but that's not the same thing I proposed, did you check the method of the controller I provided? combining that with the result of the query object should be something quite simple and clean.

Any way I don't see the logic of the DELTE inside any API, the DELETE is directly coded in the GENIL Class,  check

CL_CRM_SHORTCUT_GENIL->IF_GENIL_SO_HANDLER2~DELETE