Hi Gurus,
As i am new to CRM, i am facing one problem, my problem is in input field i am entering customer serial no and according to that get main serial no and materail during run time... now i have to set that main serial no and material again in the field during run time. but my problem is when i am doing loop and using set_property_as_string in loop, i dont know how to append 2 search options in it. please help me
example ouput is:
equipment Material Serial Customer serial no
no no
10003865 | 4010720703 | abc123 | CUSTOMERSERIAL0011 |
10003866 | 4010720500 | abc123 | CUSTOMERSERIAL0011 |
My code is as below:
DATA: l_cuco TYPE REF TO cl_iccmp_io_iobject_impl,
gr_cuco TYPE REF TO cl_iccmp_io_iobject_impl,
lv_cucostr TYPE string,
lv_size TYPE string,
lv_object_sin TYPE string,
lv_object_plr TYPE string,
lv_ref_material type COMT_PRWB_PRODUCT_ID,
lr_comp_co TYPE REF TO cl_iccmp_io_bspwdcomponen_impl,
lr_query_service TYPE REF TO cl_crm_bol_query_service,
lr_col TYPE REF TO if_bol_bo_col,
lr_entity TYPE REF TO cl_crm_bol_entity,
lr_prop_access TYPE REF TO if_bol_bo_property_access,
lr_obj_wty TYPE REF TO cl_crm_bol_entity,
lr_product type ref to cl_crm_bol_entity,
l_cuco ?= get_custom_controller( 'GLOBAL.ICCMP_IOBJECT/IObject' ).
l_cuco->typed_context->list->clear_collection( ).
lr_col ?= me->typed_context->iObject->collection_wrapper.
IF lr_col IS BOUND.
lr_query_service ?= lr_col->get_current( ).
lr_prop_access = lr_col->get_current( ).
lr_prop_access->get_property_as_value( EXPORTING iv_attr_name = 'OBJ_R3SER_NO' IMPORTING ev_result = lv_result ).
IF lv_result IS INITIAL.
lr_prop_access->get_property_as_value( EXPORTING iv_attr_name = 'PRODUCT_ID' IMPORTING ev_result = lv_result ).
lv_object_id = lv_result.
lr_prop_access->set_property( iv_attr_name = 'PRODUCT_ID'
iv_value = '' ).
CALL METHOD ycl_crm_utility=>get_sn_from_object_id
EXPORTING
iv_object_id = lv_object_id
IMPORTING
ev_equipment_sn = lv_serial_no.
lv_r3serial_no = lv_serial_no.
ELSE.
lv_serial_no = lv_result.
lv_r3serial_no = lv_result.
ENDIF.
serial_no = lv_result.
CALL METHOD ycl_crm_utility=>get_top_equipment_sn_from_sn
EXPORTING
iv_sn = serial_no "lv_serial_no
IMPORTING
ev_top_equipment_sn = lv_serial_no
eV_REF_MATERIAL = lv_material_no
ev_wty_start_date = lv_wty_start_date
ev_wty_end_date = lv_wty_end_date
lt_equipment1 = lt_equipment_new.
loop at lt_equipment_new INTO ls_equipment_new.
lv_material_no1 = ls_equipment_new-REF_MATERIAL . "lv_material_no.
lv_serial1 = lv_serial_no.
lr_prop_access->set_property_as_string( iv_attr_name = 'OBJ_R3SER_NO' iv_value = lv_serial1 ).
lr_prop_access->set_property_as_string( iv_attr_name = 'REF_PRODUCT' iv_value = lv_material_no1 ).
lv_serial_no = lv_serial1.
lv_r3serial_no = lv_serial1.
endloop.
***How to add to serach option in the query
if lv_serial1 is not initial. "IF lv_serial_no IS NOT INITIAL.
l_cuco->search( me->typed_context->IObject->collection_wrapper ).
endif.