on 12-12-2013 10:09 AM
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
Hi,
If I understood your requirement correctly then , you can make lr_ent1 of type cl_crm_bol_entity so that there will be no need to move it later.
Second you can use the set_property method of interface as well without converting it first to type cl_crm_bol_entity i.e. do not use line lr_res ?= lr_ent1 and use lr_ent1 to set the property.
Thanks
Kumar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.