Skip to Content
0
Former Member
Dec 12, 2013 at 10:09 AM

Gettin Exception in EH_ONSEARCH

27 Views

Hi,

I have created new component with Search & Result and created EH_ONSEARCH event in search view to fill the result collection, but problem is that I am getting exception while converting if_bol_bo_property_access to CL_CRM_BOL_ENTITY.

1. please suggest what is wrong with this code and also suggest which method is best to fill Result collection?

2. Does sort functionality in result will work ?

code:

DATA : lr_ent TYPE REF TO if_bol_bo_property_access,
lr_ent1 TYPE REF TO if_bol_bo_property_access,
lr_res TYPE REF TO cl_crm_bol_entity.
DATA: lr_cuco TYPE REF TO ZL_ZNEHA_ZCUCO_IMPL.



data : IT_TEMP type table of Znitin,
wa_temp like LINE OF it_temp,


lr_cuco ?= me->get_custom_controller( 'GLOBAL.ZNEHA/ZCuCo ' ).


lr_ent ?= me->typed_context->SEARCH->collection_wrapper->get_current( ).

lr_ent1 ?= lr_cuco->typed_context->result->collection_wrapper->get_current( ).



lr_res ?= lr_ent1. "Getting Exception Here



SELECT * from znitin into table it_temp .


loop at it_temp INTO wa_temp.

lr_res->set_property( iv_attr_name = 'ZID'
iv_value = wa_temp-zid ).
lr_res->set_property( iv_attr_name = 'NAME'
iv_value = wa_temp-name ).
lr_res->set_property( iv_attr_name = 'ZADD'
iv_value = wa_temp-zadd ).
lr_cuco->typed_context->result->collection_wrapper->add( lr_res ).

ENDLOOP.


Please suggest if my approach is wrong.



Regards

Nittu