Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos


Today we were blocked from recreating indices for PLM search because of one broken ER in the system, the indexing short dumped while trying to close an ER with inconsistent sub-components. I tried all the standard methods, even tried to use /PLMI/CL_ECR_BO->DELETE_CHANGE_RECORDS without success. I then found out about BAPI_CASE_DELETE but even that wouldn't work because of the inconsistency with the ER in question. However, I ended up using BAPI_CASE_DELETE because that was the easiest to cheat around.

Disclaimer: do not attempt the following unless you know what you are doing. Even if you do, I do not take any responsibility if you happen to break your system by following these instructions. You have been warned!!!


Navigate from BAPI_CASE_DELETE to CL_SCMG_CASE_API->IF_SCMG_CASE_API~DELETE and then to CL_SCMG_CASE->IF_SCMG_CASE~DELETE. Locate the code which is checking each sub-component for authorization and place a break point following the call.


        READ TABLE gt_subcomp_fcodes INTO wa_fcode WITH KEY fcode = <wa_subcomponent>-fcode.

        IF sy-subrc = 0.

          IF wa_fcode-classname IS NOT INITIAL.

            ls_subcom_clas_method-clsname = wa_fcode-classname.

            ls_subcom_clas_method-cpdname = 'CHECK_ACTIVITY_AUTHORIZATION'.



                cpdkey      = ls_subcom_clas_method


                not_existing = 1

                no_method   = 2

                OTHERS      = 3.

            IF sy-subrc <> 0.

              lb_activity_is_authorized = if_srm=>true.

* method CHECK_ACTIVITY_AUTHORIZATION does not exist..default auth to be true

*this may occur for subcomponents created by other appl & customer




                  CREATE DATA lcl_subcomp_ref_var TYPE REF TO (wa_fcode-classname).

                  ASSIGN lcl_subcomp_ref_var->* TO <wa_subcomp_clas_instance>.

                  <wa_subcomp_clas_instance> ?= <wa_subcomponent>-class.

                  ls_string = 'CHECK_ACTIVITY_AUTHORIZATION'.

                  lcl_subcomp_obj ?= <wa_subcomp_clas_instance> .

                  CALL METHOD lcl_subcomp_obj->(ls_string)


                      im_activity              = if_srm_document=>act_delete

                      im_skip_authorization    = if_srm=>false


                      ex_activity_is_authorized = lb_activity_is_authorized.

*--keep check as TRUE if the check_activity_authorization is not implemented by

*--component or the class is different.

                CATCH cx_root.

                  lb_activity_is_authorized = if_srm=>true.

                  lb_activity_is_authorized = if_srm=>true.


            ENDIF.                        " close of IF sy-subrc <> 0.

            IF lb_activity_is_authorized = if_srm=>false.  " <-- place break point here

              MESSAGE s009(scmg_case) DISPLAY LIKE 'E'.

              RAISE EXCEPTION TYPE cx_srm_sp_client.


          ENDIF.                          " close of IF wa_fcode-classname IS NOT INITIAL

        ENDIF.                            " close of IF sy-subrc = 0

      CATCH cx_scmg .

        RAISE EXCEPTION TYPE cx_srm_sp_client.


Whenever the execution reaches your break point, change the value of lb_activity_is_authorized to 'X'. At the end of the execution your inconsistent ER will be deleted and you will be able to create indices for PLM search.


While not pretty, the solution works. In my opinion there should be a standard report to either repair ERs or delete them if they are beyond repair.

Labels in this area