cancel
Showing results for 
Search instead for 
Did you mean: 

Error in processing. Function was not executed.

former_member307541
Participant
0 Kudos

Hi Experts,

A custom object was developed to change WBS user status. In this object, I am using this BAPI "BAPI_BUS2054_SET_STATUS".

Now, while testing this BAPI returns following error message:

"Error in processing. Function was not executed".

To Use this BAPI I fallowed below Sequence.

'BAPI_PS_INITIALIZATION'

'BAPI_BUS2054_SET_STATUS'

'PS_FLAG_SET_GLOBAL_FLAGS'

'BAPI_TRANSACTION_COMMIT'

Still while debugging found BAPI returns Error..

TYPE 'E'

ID 'CNIF_STATUS'

NUMBER '005'

MESSAGE 'Error in processing. Function was not executed'.

Does anyone has any idea how to handle this? Pls suggest.

Thanks in Advance

Sundeep.

Accepted Solutions (1)

Accepted Solutions (1)

raymond_giuseppi
Active Contributor

You forgot the call of BAPI_PS_PRECOMMIT before BAPI_TRANSACTION_COMMIT. PS_FLAG_SET_GLOBAL_FLAGS is only one the FM executed in this BAPI which, as most BAPI, also fill a RETURN parameter that you MUST check before next call.

former_member307541
Participant
0 Kudos

Hi Raymond Giuseppi,

Thankyou it worked BAPI_PS_PRECOMMIT before BAPI_TRANSACTION_COMMIT was resolved the trouble.

Answers (1)

Answers (1)

keohanster
Active Contributor

Sundeep, did you try searching for the error message?

https://www.google.com/search?q=CNIF_STATUS+0005&ie=utf-8&oe=utf-8&client=firefox-b

former_member307541
Participant
0 Kudos

Hi Susan,

Yes I did, I found few discussions with helpful information and I did few corrections accordingly still problem was not resolved. Below was the code please take a look and let me know if i am missing anything.

begin_method process_approve changing container.
  DATA: wbs_element TYPE prps-posid.
  DATA : wbs_syst_stat TYPE TABLE OF bapi_wbs_mnt_system_status,  
         wa_syst_stat TYPE bapi_wbs_mnt_system_status,
         wa_usr_stat TYPE bapi_wbs_mnt_user_status,
         wbs_usr_stat TYPE TABLE OF bapi_wbs_mnt_user_status,
         result TYPE TABLE OF bapi_status_result,
         return TYPE bapireturn1,
         ret TYPE TABLE OF bapiret2,
         wa_ret TYPE bapiret2,
         garg TYPE seqg3-garg.
  DATA : enq TYPE TABLE OF seqg3.
  DATA : et_return TYPE TABLE OF bapiret2,
         ret_precommit TYPE TABLE OF bapiret2.

  swc_get_element container 'wbs_element' wbs_element.
  wa_usr_stat-wbs_element = wbs_element.
  wa_usr_stat-set_user_status = 'UCAP'.
  APPEND wa_usr_stat TO wbs_usr_stat.
  CLEAR wa_usr_stat.

  IF wbs_usr_stat IS NOT INITIAL.
    DATA : tname TYPE seqg3-gname VALUE 'PROJ_ENQ'.
    CALL FUNCTION 'ENQUEUE_READ'
        EXPORTING
          gclient = sy-mandt
          gname = tname        "'PROJ_ENQ'
          guname = space
          garg = garg
        TABLES
          enq = enq
        EXCEPTIONS
          communication_failure = 1
          system_failure = 2
          OTHERS = 3.
    IF sy-subrc <> 0.
    ENDIF.

    IF enq IS NOT INITIAL.
      CALL FUNCTION 'ENQUE_DELETE'
          EXPORTING
            suppress_syslog_entry = 'X'
          TABLES
             enq = enq.
    ENDIF.
    CALL FUNCTION 'BAPI_PS_INITIALIZATION'.
    WAIT UP TO 5 SECONDS.

    CALL FUNCTION 'BAPI_BUS2054_SET_STATUS'
         IMPORTING
           return = return
         TABLES
* I_WBS_SYSTEM_STATUS = wbs_syst_stat
           i_wbs_user_status = wbs_usr_stat
* E_RESULT =
    .

    IF sy-subrc = 0 AND return-type <> 'E'.
      CALL FUNCTION 'PS_FLAG_SET_GLOBAL_FLAGS'
          EXPORTING
* I_WBS_DATA = '-'
* I_NETWORK_DATA = '-'
           i_precommit_ok = 'X'
* I_ERROR = '-'
* I_INITIALIZED = '-'
      .
      IF sy-subrc = 0.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
               wait = 'X'.
      ENDIF.
    ELSE.
      swc_set_element container 'STAT_ERR' return-message.
    ENDIF.
  ENDIF.

  swc_set_element container 'wbs_element' wbs_element.
end_method.

Thanks,

Sundeep

keohanster
Active Contributor

Hi Sundeep,

That code looks pretty similar to my own call to BAPI_BUS2054_SET_STATUS - so I don't see anything there, except that in my own application (for better or for worse) I do not call:

'PS_FLAG_SET_GLOBAL_FLAGS'

'BAPI_TRANSACTION_COMMIT'

I don't know if that helps you at all. Can you test the object through the BOR and debug through the BAPI?

Sue

matt
Active Contributor

Moderator note. In future if you're going to post code, please use the code button in the editor. Make sure your code is nicely indented and remove anything not directly relevant, like unnecessary comments. This makes your code easier to read, and means you're more likely to receive help. I have formatted your code for you this time.

Additionally, you have an error right at the start. You call function module ENQUEUE_READ, but you don't do anything if your get a non-zero return code,

former_member307541
Participant
0 Kudos

Hi Matthew,

Thanks For your suggestions I will consider all of them .

former_member307541
Participant
0 Kudos

Hi Susan,

thank you.. your comments were really helped. FM 'PS_FLAG_SET_GLOBAL_FLAGS' was created all the trouble any how problem was resolved.

keohanster
Active Contributor

So does this mean your issue is now resolved? If so, please let future generations know how! And then mark the question as answered 🙂