cancel
Showing results for 
Search instead for 
Did you mean: 

Object locked by RFC User during SC or PO approval

Former Member
0 Kudos

Hi gurus,

I have a big issue.

I'm working with one SRM system and two ECC backend and in ECC using FM module.

In one ECC, when user trying to approve or process SC or PO, Object requested is currently locked by user RFC_ error message is raised and it's not possible to complete the above documents.

Could you please help me with this issue?

Thanks a lot

BR

Giuseppe

Accepted Solutions (0)

Answers (1)

Answers (1)

konstantin_anikeev
Active Contributor
0 Kudos

Hi Giuseppe,

please provide the name (if standard) or code (if custom dev.) of your function module.

Regards

Konstantin

Former Member
0 Kudos

Hi Konstantin,

TYPES: BEGIN OF t_guid,

           guid TYPE bbp_guid,

         END OF t_guid.

  DATA: lt_zsap_srm_sc_comm    TYPE TABLE OF zsap_srm_sc_comm.

  DATA: ls_zsap_srm_sc_comm    TYPE zsap_srm_sc_comm.

  DATA: lt_purchaserequi   TYPE TABLE OF zsrm_bapiacpr00.

  DATA: ls_purchaserequi   TYPE zsrm_bapiacpr00.

  DATA: lt_purchaseamount  TYPE TABLE OF bapiaccrpo.

  DATA: ls_purchaseamount  TYPE bapiaccrpo.

  DATA: lt_return          TYPE TABLE OF bapiret2.

  DATA: ls_return          TYPE bapiret2.

  DATA: lv_rfcdst          TYPE bapirfcdst.

  DATA: lt_bbp_backend_dest TYPE TABLE OF bbp_backend_dest.

  DATA: ls_bbp_backend_dest TYPE bbp_backend_dest.

  DATA: ls_documentheader  TYPE bapiache07.

  DATA: lv_comm_executed   TYPE xflag.

  DATA: lt_accpr TYPE zbbpt_acpr02.

  DATA: ls_accpr TYPE zbbp_acpr02.

  DATA: lt_sc_header_coll TYPE bbpt_pd_header.

  DATA: lt_sc_item_coll TYPE bbpt_pd_sc_item_d.

  DATA: lt_sc_itm_acc_coll TYPE bbpt_pd_acc.

  DATA: ls_sc_header_coll TYPE bbp_pds_header.

  DATA: ls_sc_item_coll TYPE bbp_pds_sc_item_d.

  DATA: ls_sc_itm_acc_coll TYPE bbp_pds_acc.

  DATA: lt_sc_itm_check_guid TYPE bbpt_guid_list.

  DATA: ls_sc_itm_check_guid TYPE bbp_guid.

  DATA: lt_item_guid TYPE TABLE OF t_guid.

  DATA: ls_item_guid TYPE t_guid.

* SC data

  DATA: ls_sc_header       TYPE bbp_pds_sc_header_d.

  DATA: lt_sc_item_data    TYPE TABLE OF bbp_pds_sc_item_d.

  DATA: ls_sc_item_data    TYPE bbp_pds_sc_item_d.

  DATA: lt_sc_status       TYPE TABLE OF bbp_pds_status.

  DATA: ls_sc_status       TYPE bbp_pds_status.

  DATA: lt_sc_tax          TYPE TABLE OF bbp_pds_tax.

  DATA: ls_sc_tax          TYPE bbp_pds_tax.

  DATA: lt_partner         TYPE TABLE OF bbp_pds_partner.

  DATA: ls_partner         TYPE bbp_pds_partner.

  DATA: lv_item_key TYPE awpos.

  DATA: lv_acc_key TYPE awid.

  DATA: lv_limit TYPE flag.

  DATA: lv_testrun TYPE flag.

  FIELD-SYMBOLS: <fs_zsap_srm_sc_comm> TYPE zsap_srm_sc_comm.

  FIELD-SYMBOLS: <fs_item_guids> LIKE LINE OF it_item_guids.

  CONSTANTS:

        c_source_relevant  VALUE 'X',

        c_sc_released(5)   VALUE 'I1129',

        c_sc_ordered(5)    VALUE 'I1106',

        c_x                VALUE 'X',

        c_dist_ind_q       VALUE 'Q',

        c_type_rmba(4)     VALUE 'RMBA',

*        c_type_rmba(4)     VALUE 'PREQ',

        c_curr_type_00(2)  VALUE '00',

        c_classic_transfer TYPE zsrm_create_event VALUE 'CT',  "classic transfer

        c_ecs_transfer TYPE zsrm_create_event VALUE 'ET',  "ECS transfer

        c_complete TYPE zsrm_create_event VALUE 'CO',

        c_delete  TYPE zsrm_create_event VALUE 'DL', "delete out of monitoring

        c_budget_check TYPE zsrm_create_event VALUE 'BC', "in budget check

        c_dist_ind_v       VALUE 'V'.

* initialization

  CLEAR: lt_accpr,

         lt_sc_item_data,

         lt_sc_status,

         lt_item_guid,

         lt_sc_itm_check_guid.

* read commitment customizing

  DATA: lt_zsap_sc_comm_cus TYPE TABLE OF zsap_sc_comm_cus.

  DATA: ls_zsap_sc_comm_cus TYPE zsap_sc_comm_cus.

* store information about transfer processing in global variable

  IF iv_event EQ c_classic_transfer OR iv_event EQ c_ecs_transfer.

    gv_transfer_flag = c_x.

  ENDIF.

* in case of SOA methods, the commit work is done in transfer of PO

  IF iv_event EQ c_classic_transfer AND iv_commit = 'X'.

    gv_soa_transfer = c_x.

  ENDIF.

*   Determine SC data

* ----------------------------------------------------------------------

  IF iv_guid IS NOT INITIAL.

* only in case of singel shopping cart the header guid is filled

* IV_GUID is needed for any update

* only when deleting the commitment (Transfer and completion)

* the header data is not relevant

    CALL FUNCTION 'BBP_PD_SC_GETDETAIL'

      EXPORTING

        i_guid          = iv_guid

        i_with_itemdata = 'X'

      IMPORTING

        e_header        = ls_sc_header

      TABLES

        e_item          = lt_sc_item_data

*      E_ACCOUNT       = LT_SC_ACCOUNT_DATA

        e_status        = lt_sc_status

*      E_LIMIT         = LT_LIMIT

        e_partner      = lt_partner

*      E_ITMLIM_REL    = LT_SC_ITMLIM_REL

        e_tax           = lt_sc_tax

               .

* get rid of deleted partner entries

    DELETE lt_partner WHERE del_ind EQ 'X'.

* continue only if SC ordered of some customer specific status.

* exact logic needs to be defined.

    READ TABLE lt_sc_status WITH KEY stat = c_sc_ordered

                                     inact = space

      TRANSPORTING NO FIELDS.

    CHECK sy-subrc = 0.

  ENDIF.

* if it_item_guids is filled, process only these items

  IF it_item_guids IS NOT INITIAL.

    LOOP AT it_item_guids ASSIGNING <fs_item_guids>.

* move item guid to guid list

      ls_item_guid-guid = <fs_item_guids>.

      APPEND ls_item_guid TO lt_item_guid.

* get item data for every single item, if header guid was initial

* otherwise item data already selected for single SC

      IF iv_guid IS INITIAL.

        CALL FUNCTION 'BBP_PD_SC_ITEM_GETDETAIL'

          EXPORTING

            i_guid = ls_item_guid-guid

          IMPORTING

            e_item = ls_sc_item_data.

        APPEND ls_sc_item_data TO lt_sc_item_data.

      ENDIF.

    ENDLOOP.  "it_item_guids

* IF header guid was supplied,

* delete SC items that are not in ITEM_guid list

    IF iv_guid IS NOT INITIAL.

      LOOP AT lt_sc_item_data INTO ls_sc_item_data.

        READ TABLE lt_item_guid TRANSPORTING NO FIELDS

          WITH KEY guid = ls_sc_item_data-guid.

        IF sy-subrc NE 0 OR ls_sc_item_data-ext_demid EQ ls_sc_item_data-logsys_fi.

          DELETE lt_sc_item_data.

        ENDIF.

      ENDLOOP.

    ENDIF.

  ELSE.

* fill item guid list for all SC items (selected via header guid)

    LOOP AT lt_sc_item_data INTO ls_sc_item_data.

      ls_item_guid-guid = ls_sc_item_data-guid.

* do not process external requirements

      IF ls_sc_item_data-ext_demid NE ls_sc_item_data-logsys_fi.

        APPEND ls_item_guid TO lt_item_guid.

      ENDIF.

    ENDLOOP.

  ENDIF.

  DATA: lv_counter TYPE i.

* new check agaist customizing if an item is activated to post commitments

  LOOP AT lt_item_guid INTO ls_item_guid.

    READ TABLE lt_sc_item_data INTO ls_sc_item_data

      WITH KEY guid = ls_item_guid-guid.

* check customizing (logsys, co_code, item_type)

    IF zcl_sap_sc_comm_check_cust=>check_no_commitment(

        is_sc_item_data  = ls_sc_item_data

        iv_event         = iv_event

           ) EQ 'X'.

      DELETE lt_item_guid.

    ENDIF.

  ENDLOOP.

* always check if a log entry already exists

  SELECT * FROM zsap_srm_sc_comm INTO TABLE lt_zsap_srm_sc_comm

      FOR ALL ENTRIES IN lt_item_guid

      WHERE guid = lt_item_guid-guid.

* transfer item guids to interface table

  LOOP AT lt_item_guid INTO ls_item_guid.

    APPEND ls_item_guid-guid TO lt_sc_itm_check_guid.

  ENDLOOP.

  CHECK lt_sc_itm_check_guid[] IS NOT INITIAL.

  CLEAR lv_testrun.

* determine commitment data

  CALL FUNCTION 'Z_SAP_SRM_SC_COMM_ACC_COLLFUND'

    EXPORTING

      it_sc_itm_check_guid                 = lt_sc_itm_check_guid

      iv_event                             = iv_event

      iv_po_guid                           = iv_po_guid

*       IT_HDR_FOLLOW_ON_BO_UNREL_GUID       =

*       IV_NO_FAILED_PO_REPLICATE            = ' '

    IMPORTING

      et_accpr                             = lt_accpr

       et_sc_header                         = lt_sc_header_coll

       et_sc_item                           = lt_sc_item_coll

       et_sc_itm_acc                        = lt_sc_itm_acc_coll

       ev_testrun                           = lv_testrun

*       ET_SC_LIMIT                          =

*       ET_SC_ITM_REL                        =

*       ET_SC_PARTNER                        = lt_partner

            .

  DATA: lwa_sc_item_coll TYPE bbp_pds_sc_item_d.

  LOOP AT lt_accpr INTO ls_accpr.

    CLEAR: ls_purchaserequi,

           ls_purchaseamount.

* limit item check

   READ TABLE lt_sc_item_coll TRANSPORTING NO FIELDS WITH KEY guid = ls_accpr-item_guid

                                                         itm_type = 'LIMI'.

    IF sy-subrc = 0.

      lv_limit = 'X'.

    ENDIF.

* move commitment data to BAPI interface tables

    MOVE-CORRESPONDING ls_accpr TO ls_purchaserequi.

    ls_purchaserequi-obj_type     = c_type_rmba.

* in Transfer methods deletion of complete commitment is required

    IF    iv_event = c_classic_transfer

       OR iv_event = c_complete

       OR iv_event = c_budget_check

       OR iv_event = c_delete

* for Limit items is in ECS always complete fulfilment

       OR ( iv_event = c_ecs_transfer AND lv_limit = 'X' ).  " for limit items in ECS

      ls_purchaserequi-delete_ind = 'X'.

    ENDIF.

Can you Help Me please?

Thanks

BR

G

konstantin_anikeev
Active Contributor
0 Kudos

Hi Giuseppe,

I do not see any try to approve the document. This function should not lock the document.

May be Z_SAP_SRM_SC_COMM_ACC_COLLFUND locks it somewhere?

Regards

Konstantin

Former Member
0 Kudos

Hi Konstantin,

in my point of view the errore si on ECC sfide, because already exist for the confirmation.

An example when confirmation is in error band reprocessing it, I nave the following error

Object requested is currently locked by user YCPxxxxx

Message no. MC601

Diagnosis

A lock requested by calling an ENQUEUE function module cannot be set up because another SAP transaction is using the lock in question.

Technical Information: The C_ENQUEUE routine returned the following values:

COLLISION_OBJECT = EKBLP

COLLISION_UNAME = YCXxxxx

System Response

The ENQUEUE function module triggers an appropriate exception. If this exception was not intercepted by the application program, this leads automatically to the active SAP transaction being cancelled.

Procedure

Look in the lock table to establish which user or transaction is using the requested lock (Tools -> Administration -> Monitor -> Lock entries). You may need to contact the user in question.

Con you help me please?

BR

Giuseppe

konstantin_anikeev
Active Contributor
0 Kudos

Now I'm totally lost

What is users action?

What transaction is started (on SRM or ECC side)?

What does the user do (custom button click, action of save)?

What is the direction of RFC? ECC->SRM or vice versa?

Which system throws the message: SRM or ECC?

How do you see/get this message?

Regards

Konstantin

Former Member
0 Kudos

Usually error appear during SRM --> ECC dialogo. Errore above si related to IDOC in errore on ECC side.

BR

Giuseppe

konstantin_anikeev
Active Contributor
0 Kudos

Hi Guiseppe,

what does the Workflow have to do with the IDOC's in your process?

Regards

Konstantin