cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CRM - How to get current activity in IC from a different UI component

Hi experts,

I need to access an activity data from an UI component. I have to implement some code in CRMCMP_EMAIL/MailSearchResultView but first, I need to have access to the current activity data in IC (BT125H_TASK UI Component). So here is the scenario: The operator confirm a BP, then search an activity (Navigation Bar--> Search activity), then goes in edit mode, after that click on Email Outbounding (Navigation Bar-->Email)...and here is where I need to intervene to implement my code and I need to access the current activity data which is in edit mode. I tried to use

lr_gdc ?= cl_crm_ui_data_context_srv=>get_instance( me )

but can't get any data regarding the current activity in IC. But if I repeat the same process with Service Request instead of activity (Navigation Bar--> Search Service Request), it gave perfectly the entity of current service request. what am I missing?

Does anyone know which of the following Global Custom Controller provides me the entity of the activities?

GLOBAL.CRM_IC/CategoryController”

GLOBAL.ICCMP_CM/CuCoCm”

GLOBAL.CRMCMP_BPIDENT/CuCoBuPa”

GLOBAL.ICCMP_BT_GLOBAL/CuCoBT”

GLOBAL.ICCMP_BT_GLOBAL/CuCoDeBT”

GLOBAL.ICCMP_FAXLETTER/CuCoFaxLetter”

GLOBAL.CRMCMP_IC_FRAME/CuCoHiddenView”

GLOBAL.ICCMP_IBASE/cucoibase”

GLOBAL.ICCMP_BT_GLOBAL/CuCoIRec”

GLOBAL.CRMCMP_CCS_EML/MailCuCo”

GLOBAL.ICCMP_BT_GLOBAL/CuCoProcess”

GLOBAL.ICCMP_PROD_GLOB/CucoProduct”

GLOBAL.ICCMP_GLOBAL/CuCoUI”

GLOBAL.ICCMP_EMP_SRCH/CuCoEmp”

GLOBAL.ICCMP_AUTO_VEHI/VEHICuco’

I also tried:

DATA: LV_CC TYPE REF TO CL_BT125H_T_TASKDETAILSCU_IMPL.

LV_CC ?= GET_CUSTOM_CONTROLLER( 'GLOBAL.BT125H_TASK/TaskDetailsCuCo' ).

but the BSP application crashes. Any suggestion?

appreciate your time and attention in advance

corrine_guan
Employee
Employee

Hello Amir,

1. 'implement some code in CRMCMP_EMAIL/MailSearchResultView but first', do you mean you enhance the view and redefine some method to implement you codes? Or any way else? can we have details?

2. lr_gdc ?= cl_crm_ui_data_context_srv=>get_instance( me )

Do you mean lr_gdc returns INITIAL? or it is not INITIAL but you cannot find expected activity in lr_gdc? Can we have all your related codes?

3. Can you provide the detailed steps of how you get to the view CRMCMP_EMAIL/MailSearchResultView? I checked in IC_AGENT, if click 'Email' menu from navigation bar profile, it is component CRMCMP_CCS_EML, not CRMCMP_EMAIL. Can we know which logics link or work center ID you are using for the 'Navigation Bar-->Email'?

4. What's the activity process type and 'object type'(is it BUS2000126)?

5. What's the activity search view ? What's the activity display/edit view?

Best Regards, Corrine

0 Kudos

Hello Corrine,

Thank you very much for your quick response.

1. Yes, I enhanced the MailSearchResultView and redefined EH_ONSELECT.

2. No, it's not initial but as you said I can't find any entity relative to Activities. I test it several times, first without confirming a BP and searching an activity, I straightly clicked on Navigation Bar-->Email and checked the entity that Ir_gdc gave me. It seems that as per default it always gets CURRENTIREC and CURRENTBT:

then I tried it again but this time before getting into Email section, first I confirmed a BP, then searched for an activity and put it on edit mode and the result was:

still got nothing that gave me entity related to any activity, just, in addition, I got CURRENTCUSTOMER which provides the entity related to the BP.

For the third time I repeated the second test but this time after confirming BP I searched for a Service Request and put it on edit mode and it gave me perfectly the entity of current service request and with CRM_GUID I could extract all the rest of data from CRM_ORDERADH_H. (The blog didn't let me add any more screen-short, is case you need them, I'll post them in the next comment)

What am I missing? Why it works only for Service Request but not the activities?

3. Yes, your're right but I need to intervene the moment in which an operator searches for a Mail Form (template) and chooses one from the result list, so that's why I enhanced CRMCMP_EMAIL/MailSearchResultView.

4. the activity process type is ZEMH and the object type isBUS2000126 as you said.

5. The activity search view is BT126S_APPT/ApptSQ and the activity display/edit view is BT125H_TASK/TaskDetails.

appreciate your time in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

corrine_guan
Employee
Employee
0 Kudos

Hello Amir,

I enhanced the view CRMCMP_EMAIL/MailSearchResultView, implement the EH_ONSELECT method. The codes inside this method will be:

CALL METHOD SUPER->EH_ONSELECT
EXPORTING
htmlb_event = htmlb_event
htmlb_event_ex = htmlb_event_ex
.
DATA: lr_gdc TYPE REF TO if_crm_ui_data_context,
lr_entity TYPE REF TO if_bol_bo_property_access.
TRY.
lr_gdc ?= cl_crm_ui_data_context_srv=>get_instance( iv_controller = me ).
CATCH cx_root.
RETURN.
ENDTRY.

TRY.
lr_entity ?= lr_gdc->get_entity( name = if_iccmp_global_data_cont_con=>GDC_CURRENTCONTEXT ).
CATCH cx_root.
RETURN.
ENDTRY.

---------------------------

What I did is the same as yours:

  1. confirm an account
  2. Search an acitivty, display and then edit it
  3. Go to Email view, click 'search' on 'standard responses' blog.
  4. In the pop up dialog, make a search, then select an entry from result list.
  5. Then in my method EH_ONSELECT, we can debug into statement: lr_entity ?= lr_gdc->get_entity( name = if_iccmp_global_data_cont_con=>GDC_CURRENTCONTEXT ).

I compared the entries in gt_entity, there are 4 entries with names:

CURRENTCUSTOMER, CURRENTIREC, CURRENTBT, CURRENTCONTEXT

I compared the GUID of them, the one for CURRENTCONTEXT is the activity I edited just now.

This CURRENTCONTEXT is set when click 'Edit' button on the activity view. From the callstack in attached picture we can know more. You can compare the callstack to check why the activity is not there.

Best Regards, Corrine