cancel
Showing results for 
Search instead for 
Did you mean: 

Interaction screen: The IREC screen is limited to only 4 interactions

Former Member
0 Kudos

Hi Experts,

In the Last interaction block of interaction records screen, I need to exceed the number of interactions to 10. I enhanced CL_ICCMP_BT_CUCOIRHIST_IMPL/GET_LAST_INTERACTIONS but its passing only 5 interactions and there is no way where i can get all list, its always 5.

Please help, its urgent.

Thanks,

Priya

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Priya, 

Comment below code from the method GET_LAST_INTERACTIONS. 

  • restrict to 4 result entities   lr_bo = lr_queryres_col->find( iv_index = 5 ).  

WHILE lr_bo IS BOUND.    

lr_queryres_col->remove( iv_bo = lr_bo ).    

lr_bo = lr_queryres_col->find( iv_index = 5 ).  

ENDWHILE. 

Line 48 to 53. 

Regards,

Naresh

Former Member
0 Kudos

I did still got  5 entries,

lr_query_service->set_query_parameters( it_parameters = lt_parameter ).
lr_queryres_col = lr_query_service->get_query_result( ).

lr_queryres_col returns 5 entries only...

Any other option? Thankd for your help!

former_member193634
Active Participant
0 Kudos

Hi,

In the method GET_LAST_INTERACTIONS, the query is driven by standard class CL_CRM_CONTACT_QUERY.

In the method GET_QUERY_RESULT, the max hit is set to 5 :

You should then do the following :

  • Create specific class, heriting from class CL_CRM_CONTACT_QUERY
  • Redefine method GET_QUERY_RESULT to add your own logic regarding the max hits
  • Enhance view to redefine method GET_LAST_INTERACTIONS
  • Call your specific method instead of the standard one, by changing definition of lr_query_service

Hope this helps.

Best regards,

Sylvain AGUETTAZ

sumeet_gehlot
Contributor
0 Kudos

Hi Priya,


You can try with search query 'BTQuery1O'  in get_interaction( ). method

and not using standard CL_CRM_CONTACT_QUERY class.

DATA: ls_parameter        TYPE crmt_name_value_pair,

            lt_parameter          TYPE crmt_name_value_pair_tab,

            lr_query_service   TYPE REF TO cl_crm_contact_query,

            lr_queryres_col     TYPE REF TO if_bol_bo_col,

            lr_bo                      TYPE REF TO if_bol_bo_property_access,

            lr_entity                  TYPE REF TO cl_crm_bol_entity,

            lv_object_type        TYPE string,

             lr_col TYPE REF TO if_bol_bo_col,

             lr_query TYPE REF TO cl_crm_bol_query_service,

             lr_core TYPE REF TO cl_crm_bol_core.

  DATA : lr_entity1 TYPE REF TO if_bol_entity_col,

             lr_result  TYPE REF TO cl_crm_bol_entity_col.

* clear result table on initial account

  IF iv_bpnumber IS INITIAL.

    me->typed_context->btordercusthist->clear_collection( ).

    RETURN.

  ENDIF.

** prepare query parameters

  ls_parameter-name  = 'BP_NUMBER'.                         "#EC NOTEXT

  ls_parameter-value = iv_bpnumber.

  APPEND ls_parameter TO lt_parameter.

* run query / search for last interactions

  TRY.

      CREATE OBJECT lr_query_service.

    CATCH cx_crm_unsupported_object.

      me->typed_context->btordercusthist->clear_collection( ).

      RETURN.

  ENDTRY.

  lr_core = cl_crm_bol_core=>get_instance( ).

  lr_core->start_up( 'ONEORDER' ).

  lr_query = cl_crm_bol_query_service=>get_instance( 'BTQuery1O' ).

  lr_query->set_query_parameters( it_parameters = lt_parameter ).

  lr_queryres_col = lr_query->get_query_result( ).

  CREATE OBJECT lr_result.

  lr_entity ?= lr_queryres_col->get_first( ).

  WHILE lr_entity IS BOUND.

    lr_entity1 ?= lr_entity->get_related_entities( iv_relation_name = 'BTOrderCustHist' ).

    lr_result->if_bol_bo_col~add_collection( lr_entity1 ).

    lr_entity ?= lr_queryres_col->get_next( ).

  ENDWHILE.

  gr_bol_col = lr_result->if_bol_entity_col~get_copy( ).

  me->typed_context->btordercusthist->set_collection( gr_bol_col ).

  lr_core->modify( ).

Regards,

Sumeet

Former Member
0 Kudos

No it doesnt work this way!

Former Member
0 Kudos


Thanks Sumeet!! You solved my problem in seconds points rewarded !!!!

But one more problem is raised with this, I have to remove the interaction with the status 'Open'.. I could do it with the previous code.

   *  WHILE lr_bo IS BOUND.
*    TRY.
*        lr_entity ?= lr_bo.
*        lr_entity->get_property_as_value(
*                      EXPORTING iv_attr_name = 'STAT_TXT'
*                      IMPORTING ev_result    = lv_object_type ).
*        IF lv_object_type EQ lv_status.
*          lr_queryres_col->remove( iv_bo = lr_bo ).
*        ENDIF.
*      CATCH cx_bol_exception cx_root.
*    ENDTRY.
*    lr_bo = lr_queryres_col->get_next( ).
*  ENDWHILE.

Now all the data is in related entities, I tried to retrieve it but didnt work for me. can you please help with this. I am ready to open a new post if you say!!

sumeet_gehlot
Contributor
0 Kudos

Hi Priya,

use below code before this statement   gr_bol_col = lr_result->if_bol_entity_col~get_copy( ).

and also make sure to refer your code with standard query lr_queryres_col = lr_query_service->get_query_result( ). for sort result list by date & time for the last interactions.

IF lr_result IS BOUND.

     lr_entity ?= lr_result->if_bol_bo_col~get_first( ).

     WHILE lr_entity IS BOUND.

       TRY.

           lr_entity->get_property_as_value(

                         EXPORTING iv_attr_name = 'STAT_TXT'

                         IMPORTING ev_result    = lv_object_type ).

           IF lv_object_type EQ 'Open'.

             lr_result->if_bol_bo_col~remove( iv_bo = lr_entity ).

           ENDIF.

         CATCH cx_bol_exception cx_root.

       ENDTRY.

       lr_entity ?= lr_result->if_bol_bo_col~get_next( ).

     ENDWHILE.

   ENDIF.


Regards,

Sumeet

former_member193634
Active Participant
0 Kudos

Too bad, because it's working fine for me.

I am not fond of replacing a query by another one, just to modify the max hits value.

You loose the ability of benefiting of SAP future enhancements of this query.

Moreover, using 'BTQuery1O' does not retrieve the same objects as using the query provided in the standard implementation, so your result list will be different !

Best regards,

Sylvain AGUETTAZ

Former Member
0 Kudos

Problem Solved! Thank you Sumeet!!

Thanks for being wonderful!! I really appreciate your help!!!

Former Member
0 Kudos

if you are using this code and its working for you, it makes sense to try this but I didn't get a chance to try this...through debugging i changed the max hits value and it didnt return any value in the entity thats why i said so... Thanks for your help

sumeet_gehlot
Contributor
0 Kudos

Hi Slyvain,

Thanks for the information, but as per your suggestion you are trying to set the max hits to difference query name MktInteractionObjectStdQuery  which is not required

* set max hit count to 10

   data: LS_PARAM type CRMT_NAME_VALUE_PAIR.

   LS_PARAM-NAME = 'MAX_HITS'.

   LS_PARAM-VALUE = '10'.

   append LS_PARAM to LT_QUERY_PARAMS.

  LV_IO_RESULT = LV_CORE->QUERY( IV_QUERY_NAME   = ME->IO_QUERY_NAME

                                  IT_QUERY_PARAMS = LT_QUERY_PARAMS

                                  IV_VIEW_NAME    = ME->VIEW_NAME ).


But as per functionality of standard behavior Actual result required in result list is using BUSACT_QUERY_NAME ( as Query object BTQueryBusAct ') you can check and debug the the below code, so max_hits wont work in this case.

* fire activity query

   data: LV_BUSACT_RESULT type ref to IF_BOL_ENTITY_COL.

   LV_BUSACT_RESULT = LV_CORE->QUERY( IV_QUERY_NAME   = ME->BUSACT_QUERY_NAME

                                      IT_QUERY_PARAMS = LT_QUERY_PARAMS

                                      IV_VIEW_NAME    = ME->VIEW_NAME ).


Moreover you can execute the same in genil_bol_browser.


i am not sure still about this we can achieve this with the the same query name or do this using some configuration in spro.

Thanksss

Regards,

Sumeet

former_member193634
Active Participant
0 Kudos

Hi,

You are right, I answered too quickly, and on the wrong query, my bad ...

But still it is possible to change the max hit of query BTQueryBusAct, either by

  • enhancing genil class by substituting the standard class (CL_CRM_QUERYBUSACT_RUN_BTIL) by a custom one, and change method READ_BUSINESS_ACTIVITIES based to set the max hit (see screenshot, the max hit it is hard coded ...)

  • using BADI CRM_ORDER_AUTH_CHECK, method CRM_RFW_SET_MAX_HITS : but this BADI is valid not only for a given query ..

Best regards,

Sylvain AGUETTAZ

Former Member
0 Kudos

Hi Summet,

Everything seems to be working fine except one thing , The Notes History is Blank, we can't see anything in Notes History, Please help to find out what could be the reason. Thanks!

Please reply.

Below is the code.

    CALL METHOD super->get_last_interactions
    EXPORTING
      iv_bpnumber = iv_bpnumber.

   * prepare query parameters
  ls_parameter-name  = 'BP_NUMBER'.                         "#EC NOTEXT
  ls_parameter-value = iv_bpnumber.
  APPEND ls_parameter TO lt_parameter.
* run query / search for last interactions
  TRY.
      CREATE OBJECT lr_query_service.
    CATCH cx_crm_unsupported_object.
      me->typed_context->btordercusthist->clear_collection( ).
      RETURN.
  ENDTRY.
  lr_core = cl_crm_bol_core=>get_instance( ).
  lr_core->start_up( 'ONEORDER' ).
  lr_query = cl_crm_bol_query_service=>get_instance( 'BTQuery1O' ).
  lr_query->set_query_parameters( it_parameters = lt_parameter ).
  lr_queryres_col = lr_query->get_query_result( ).
  CREATE OBJECT lr_result.
  lr_entity ?= lr_queryres_col->get_first( ).
  WHILE lr_entity IS BOUND.
    lr_entity1 ?= lr_entity->get_related_entities( iv_relation_name = 'BTOrderCustHist' ).
    lr_result->if_bol_bo_col~add_collection( lr_entity1 ).
    lr_entity ?= lr_queryres_col->get_next( ).
  ENDWHILE.
  IF lr_result IS BOUND.
    lr_entity ?= lr_result->if_bol_bo_col~get_first( ).
      while lr_entity IS BOUND.
        TRY.
            lr_entity->get_property_as_value(
                          EXPORTING iv_attr_name = 'STAT_TXT'
                          IMPORTING ev_result    = lv_object_type ).
            IF lv_object_type EQ lv_status.
              lr_result->if_bol_bo_col~remove( iv_bo = lr_entity ).
            ENDIF.
          CATCH cx_bol_exception cx_root.
        ENDTRY.
        lr_entity ?= lr_result->if_bol_bo_col~get_next( ).
    ENDWHILE.
  ENDIF.
  gr_bol_col = lr_result->if_bol_entity_col~get_copy( ).
  me->typed_context->btordercusthist->set_collection( gr_bol_col ).
  lr_core->modify( ).

former_member193634
Active Participant
0 Kudos

Hello,

First thing to check : do you have good test data for this ? After identifying customer and contact (in case of B2VB scenario), you should have at least a previous interaction record with a note maintained in it.

Then, you could check if some custom WebUI/IC development is the reason for your issue. In order to do this, you can set the following parameter to your user : WCF_IGNORE_ENHANCEMT. Set this user parameter to "A". Then disconnect and reconnect again to WebIC, and test again.

Finally, you may want to try if you get the same issue by using a standard business role, such as IC_AGENT.

Hope this helps,

Best regards.

Sylvain AGUETTAZ

Former Member
0 Kudos

Thanks for the inputs!! Problem is the with code above when i comment this code everything works fine.. there is something missing or wrong with this code.

I think there is some standard statement missing which is making the standard notes history Blank!


Former Member
0 Kudos

When you say - make sure to refer your code with standard query lr_queryres_col = lr_query_service->get_query_result( ).

where do you want me to put this..this may be one reason you never know!

Former Member
0 Kudos

Hi Sumeet,

Any inputs??

Thanks,

priya

sumeet_gehlot
Contributor
0 Kudos

Hi Priya,

Sorry for the delay, I am not sure about the notes it effecting somewhere by this 'BTQuery1O' query  m not able to find out the issue and its also effecting standard functionality of notes .So i request to Please revert all the changes and go with the standard flow and make visible upto 5 records.

you can try with Sylvain AGUETTAZ solution.

  • enhancing genil class by substituting the standard class (CL_CRM_QUERYBUSACT_RUN_BTIL) by a custom one, and change method READ_BUSINESS_ACTIVITIES based to set the max hit (see screenshot, the max hit it is hard coded ...

Regards,

Sumeet

Former Member
0 Kudos

It's Ok nothing wrong with your code, I debugged it and there was issue with Custom code of the notes History. its resolved now. Thanks for replying

sumeet_gehlot
Contributor
0 Kudos

Hi Priya,

Thats great , good to know you resolved by yourself.

Regards,

Sumeet

Former Member
0 Kudos

Thanks but we got one more problem with this, when we try to select a record in the interaction historty we are getting error - " Dynamic navigation to this object is not supported"

Through Debugging there is a class CL_CRM_UI_OBJECT_MAPPING_SRV=>CL_CRM_UI_OBJECT_MAPPING_SRV in which they are checking the Object name as BTOrder but in my case the OBject name is BTQResCuHist since the Object name doesnt match its not passing the navigation.

Basically its checking for Root which should be BTOrder but its getting BTQResCuHist.

Is there a way we can read the root node and set it as Object name. Let me know if you can help in this regard.

Thanks,

Priya.

sumeet_gehlot
Contributor
0 Kudos

Hi Priya,

redefine OP_Default of the your ZL_ICCMP_BT_INRLASTHIST_IMPL class and get the parent entity of the lr_order and pass to lr_data_collection.

     DATA : lr_entity TYPE REF TO cl_crm_bol_entity.


  lr_cucobt ?= me->get_custom_controller( controller_id = if_iccmp_global_controller_con=>cucobt ).

   IF lv_object_type_s <> 'BUS2000111'.

     lr_order ?= ir_entity.

     IF lr_order IS BOUND.

       IF lr_order->get_name( ) = 'BTAdminH'.                "#EC NOTEXT

         lr_order = lr_order->get_parent( ).

       ENDIF.

       IF lr_order->get_name( ) = 'BTOrder'.                 "#EC NOTEXT

         lr_order ?= lr_order->get_root( ).

       ENDIF.

     ENDIF.

     lr_entity ?= lr_order->get_parent( ).

     lr_data_collection = lr_cucobt->get_descriptor_object( ir_entity    = lr_entity

                                                            iv_component = 'ICCMP_BT_IRHIST' ).



Cheers

Sumeet

Former Member
0 Kudos

Thanks Sumeet!! once again you solved my problem

After I enhanced ICCMP_BT_IRHIST/InrLastHist to redefine OP_DEFAULT- there is no more Navigation error but it discovered one more issue -

It gives me dump in method - GET_LAST_INTERACTIONS in line lr_core->modify( ) as Dereferencing of the NULL reference in method DO_INIT_CONTEXT( ). ,

Right now I commented code lr_core->modify( ) and its working fine but I am not sure if it will not create any further problem without this statement.

Please throw some light on this. I hope I am not bothering you more

Thanks,

Priya

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Priya,

We can achieve this easily using Interaction Profile assigned in Business Role Function profile INTERACTION_HISTORY.

Update the Rows for the profile as shown in below.

Hope this will solve your problem.

Thanks and Regards.

Y. Ravi Kumar

Former Member
0 Kudos

Thanks Ravi Kumar, I tried it but it didnt work for me