Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Current interaction.

To check if an agent has current interaction:

DATA: lr_ref_intman TYPE REF TO cl_crm_ic_interaction_manager.

lr_ref_intman = cl_crm_ic_interaction_manager->get_instance( ).

CHECK lr_ref_intman->has_current_interaction( ) EQ abap_true.

Current call state.

To check current call state:

DATA: lr_ccs_instance TYPE REF TO cl_iccmp_ccs,
      lr_contact TYPE REF TO cl_crm_ic_mcm_contact,
      lv_phoneid TYPE string.

lr_ccs ?= cl_iccmp_ccs=>get_instance( ).

lv_phoneid = lr_ccs->get_currentphoneid( ).
IF lv_phoneid IS NOT INITIAL. "no phone id => no current contact => no flashing buttons
   lr_contact ?= lr_ccs->get_contact( lv_phoneid ).
   CASE lr_contact->m_status.
      WHEN if_crm_ic_contact~c_status_started.
      "current contact has status ContactStarted (flashing buttons)
      "........
      WHEN if_crm_ic_contact~c_status_accepted.
      "current contact has status ContactAccepted (no flashing buttons)
      "........
   ENDCASE.
ENDIF.

PS: If there is no GET_CURRENTPHONEID method in CL_ICCMP_CCS class then check please this discussion. Perhaps it will help you.

Ready / not ready state.

To check agent "ready/not ready" state:

DATA: lr_bcb_user TYPE REF TO cl_bcb_user,
       lv_user TYPE string,
       lr_bcb_session TYPE REF TO cl_bcb_session,
       ls_current_workmode TYPE bcb_text_element.

 CALL METHOD cl_bcb_worker_session=>get_bcb_session
   EXPORTING
     cc_system   = 'bcm-test' "!!! here you should put you CMS id, bcm-test is an example
   RECEIVING
     bcb_session = lr_bcb_session.

 IF lr_bcb_session IS BOUND.
   TRY.
       lv_user = sy-uname.
       CREATE OBJECT lr_bcb_user
         EXPORTING
           session = lr_bcb_session
           userid  = lv_user.
       ls_current_workmode = lr_bcb_user->get_current_workmode( ).
       CASE ls_current_workmode-id.
         WHEN cl_bcb_user=>logged_off.
         " not logged in to CMS
         WHEN cl_bcb_user=>logged_on_ready.
         " logged on and ready
         WHEN cl_bcb_user=>logged_on_not_ready.
         " logged on and not ready
       ENDCASE.
     CATCH cx_bcb_exception.
   ENDTRY.
 ENDIF.