cancel
Showing results for 
Search instead for 
Did you mean: 

Data transfer between to components

Former Member
0 Kudos

Hi,

My requirement is to add a button 'Duplicate Check' in the component view 'BT115H_SLSO/SOHOverView' and on click of the button an event need to be triggered 'EH_ONDUPLICATE', and it should call the view 'BT115S_SLSO/SlsOrdSQ' and it should open with selection fields requested by client and pre filled with values from previous view. Ex:- Sale order ID, Posting date Channel partner etc... And this search fields includes item level search also.. (Ex:- Item product, quantity).

On click of search it should display the orders with the current filled search criteria.

My part of work done:

1) Created a duplicate button in IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS method of view BT115H_SLSO/SOHOverView.

2) Created a event handler to handle the on click event 'EH_ONDUPLICATE'.

3) In the event handler method, read the attribute 'GUID' of the current Order.

4) Created component usage for the view 'BT115S_SLSO/SlsOrdSQ'

5) Opened one pop-up using the created component usage to cal the view 'BT115S_SLSO/SlsOrdSQ' in the pop-up.

6) Created one out bound plug in the view 'BT115H_SLSO/SOHOverView' . (But code not inserted to handle data transfer)

7) In the do_prepare_output method of view 'BT115S_SLSO/SlsOrdSQ' , added some code to set the search field criteria, but the previous fields are also getting diplayed.

"" here is the code inserted in do_prepare_output"""

lr_qs = me->get_current_dquery( ).

lr_qs->clear_selection_param_values( ).

lr_qs->delete_empty_selection_params( ).

lr_qs->add_selection_param( iv_attr_name = 'OBJECT_ID' iv_sign = 'I' iv_option = 'EQ' iv_low = '6020104' ).

lr_qs->add_selection_param( iv_attr_name = 'CHANNEL_PARTNER' iv_sign = 'I' iv_option = 'EQ' iv_low = 'XYZ' ).

So on click of 'Duplicate Check' a search screen is displayed but with empty values and different search fields..

Now i was stuck:

What code need to be inserted in the created outbound plug...

Should i create a inbound plug for collecting the guid in the search view?? (code snippets if possible)

How to set the selection criteria in the new pop-up screen with the required fields..

how to fill the selection criteria conditions with the required values...

Please help me out.

Thanks in advance..

Regards,

Swathi.

Edited by: swathi Chandra on May 9, 2011 1:00 PM

Edited by: swathi Chandra on May 9, 2011 1:05 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

test

Edited by: Micha Van Nijen on May 9, 2011 10:48 AM

Former Member
0 Kudos

Hi Swathi,

Try the following:

I stead of adding these parameters in the do_prepare_output of the search view, create a dynamic Query entity before you navigate to the search query and add it in the iv_data_collection parameter.

If you look at the IP_SEARCH of the MainWindow of Component BT115S_SLSO you see the following:

method ip_search.

data lr_entity type ref to cl_crm_bol_dquery_service.

data lv_name_entity type crmt_ext_obj_name.

data lr_comp type ref to cl_bt115s_s_bspwdcomponen_impl.

super->ip_search( iv_collection = iv_collection ).

lr_comp ?= comp_controller.

if iv_collection is bound.

lr_entity ?= iv_collection->get_current( ).

if lr_entity is bound.

lv_name_entity = lr_entity->get_name( ).

if lv_name_entity cp '*_AC'.

lr_comp->gv_archive = abap_true.

else.

lr_comp->gv_archive = abap_false.

endif.

endif.

else.

lr_comp->gv_archive = abap_false.

endif.

endmethod.

Within this superclass the following code is interesting:

METHOD ip_search.

DATA:

lr_ctx_node TYPE REF TO cl_bsp_wd_context_node,

lr_tcc TYPE REF TO cl_bsp_wd_context_node,

lr_entity TYPE REF TO cl_crm_bol_dquery_service,

lv_name_entity TYPE crmt_ext_obj_name.

IF gv_cuco_search IS INITIAL OR

gv_cuco_search_ac IS INITIAL.

  • component does not yet support archiving

ip_search_old( iv_collection ).

EXIT.

ENDIF.

set_process_mode( gc_proc_mode_normal ).

CHECK NOT gv_node_search IS INITIAL.

IF iv_collection IS BOUND.

lr_entity ?= iv_collection->get_current( ).

IF lr_entity IS BOUND.

lv_name_entity = lr_entity->get_name( ).

IF lv_name_entity CP '*_AC'.

lr_tcc = get_cuco_context_node( iv_cnode_name = gv_node_search controller_id = gv_cuco_search_ac ).

toggle_archived_search( ).

ELSE.

lr_tcc = get_cuco_context_node( iv_cnode_name = gv_node_search controller_id = gv_cuco_search ).

toggle_normal_search( ).

ENDIF.

IF lr_tcc->collection_wrapper->find( iv_bo = lr_entity ) IS NOT BOUND.

  • query service is provided by outside world: clear collection and add given search

  • as only one search is allowed per collection

lr_tcc->collection_wrapper->clear( ).

lr_tcc->collection_wrapper->add( iv_entity = lr_entity

iv_set_focus = abap_true ).

ENDIF.

RETURN.

ENDIF.

ENDIF.

me->view_manager->navigate( source_rep_view = me->rep_view

data_collection = iv_collection

outbound_plug = gv_navlink_search ).

ENDMETHOD.

Here you see that of you transfer the query immediately to the iv_data_collection, the system takes it over...

this is how you could create a dynamic query that you need:

lr_query_service = cl_crm_bol_dquery_service=>get_instance( 'BTQSlsOrd' ).

IF lr_query_service IS BOUND.

DATA:

lr_sel_param_col type ref to if_bol_bo_col,

lr_object_id type ref to IF_BOL_BO_PROPERTY_ACCESS,

lr_chn_partner type ref to IF_BOL_BO_PROPERTY_ACCESS,

lr_selection_param_buil TYPE REF TO if_bol_selection_param.

lr_sel_param_col ?= lr_query_service->get_selection_params( ).

lr_iterator ?= lr_sel_param_col->get_iterator( ).

lr_iterator->filter_by_property( iv_attr_name = 'OBJECT_ID' iv_value = '' ).

lr_object_id ?= lr_iterator->get_first( ).

lr_iterator->delete_filter( 'X' ).

lr_iterator->filter_by_property( iv_attr_name = 'CHANNEL_PARTNER' iv_value = '' ).

lr_chn_partner ?= lr_iterator->get_first( ).

lr_iterator->delete_filter( 'X' ).

IF lr_object_id is bound.

lr_object_ide->set_property_as_string( iv_attr_name = 'OPTION' iv_value = 'EQ' ).

lr_object_id->set_property_as_string( iv_attr_name = 'LOW' iv_value = '6020104' ).

ELSE.

CALL METHOD lr_query_service->insert_selection_param

EXPORTING

iv_index = 1

iv_attr_name = 'OBJECT_ID'

iv_sign = 'I'

iv_option = 'EQ'

iv_low = '6020104'

RECEIVING

rv_selection_param = lr_selection_param_buil.

ENDIF.

IF lr_chn_partner is bound.

lr_chn_partner->set_property_as_string( iv_attr_name = 'OPTION' iv_value = 'EQ' ).

lr_chn_partner->set_property_as_string( iv_attr_name = 'LOW' iv_value = 'XYZ' ).

ELSE.

CALL METHOD lr_query_service->insert_selection_param

EXPORTING

iv_index = 2

iv_attr_name = 'CHANNEL_PARTNER'

iv_sign = 'I'

iv_option = 'EQ'

iv_low = 'XYZ'

RECEIVING

rv_selection_param = lr_selection_param_buil.

ENDIF.

ENDIF.

...

CREATE OBJECT lr_collection.

lr_collection->if_bol_bo_col~add( lr_query_service ).

op_navigate_search( lr_collection ).

hope this helps you out a bit...

KR,

Micha

Former Member
0 Kudos

I'm sorry,

but I had posted it with correct formatting, but somehow it gets mixed up each time I paste my answer the reply box.

KR,

Micha

Former Member
0 Kudos

Hi Micha,

Thanks for your response.

I have gone through the code Inbound plug IP_SEARCH of BT115S_SLSO/MainWindow, and the super class method...

I have some doubts, where should i create this dynamic query?? i.e, In which component/view/method should i insert the code for creating dynamic query??

what code need to written in OP_DUPLICATE of BT115H_SLSO/SOHOverView and how to call an out bound plug in my event??? how to assign the guid value to iv_collection in the event???

*****

CREATE OBJECT lr_collection.

lr_collection->if_bol_bo_col~add( lr_query_service ).

op_navigate_search( lr_collection )

*****

could not find OP_NAVIGATE_SEARCH in the view BT115S_SLSO/MainWindow???

The values that i have hardcoded for object_id '6020104' and channnel_partner 'XYZ' , i would be getting this from the event handler(GUID).. how can i map these values to the iv_collection.

Regards,

Swathi.

Edited by: swathi Chandra on May 10, 2011 8:55 AM

Former Member
0 Kudos

Hi Chandra,

you need to create the dynamic query in the event handler of your button.

regarding the OP_navigate_display, have a look at view BT115H_SLSO/Details OP_SEARCH_MEMBSHP. this is quite the same...

you should create an op yourselve.

KR,

Micha

Former Member
0 Kudos

Hi Micha,

Thanks for your guidance and help.

Now, i have added the code for creating the dquery in the evnt handler and

created one outbound plug op_duplicate (op_navigatesearch as you said)

I am adding the code written in the outbound plug..

METHOD op_duplicate.

  • Added by wizard: Outbound plug 'DUPLICATE'

gv_reuse_popup ?= comp_controller->window_manager->create_popup(

iv_interface_view_name = 'MainWindow'

iv_usage_name = 'DUPLICATE_CHECK' " component usage created

iv_title = 'Hello Swathi' ).

gv_reuse_popup->set_on_close_event( iv_event_name = 'reuse_popup_closed' iv_view = me ).

gv_reuse_popup->open( ).

me->view_manager->navigate( source_rep_view = me->rep_view "'BT115S_SLSO/SlsOrdSQ'

outbound_plug = 'DUPLICATE'

data_collection = iv_data_collection ).

ENDMETHOD.

I debugged the outbound plug, iv_data_collection get filled with the required selection fields and values, but the feilds and values are not set in the output screen...

Please correct me if i am wrong..

Thanks & Regards,

Swathi.

Edited by: swathi Chandra on May 10, 2011 2:14 PM

Edited by: swathi Chandra on May 10, 2011 2:15 PM

Edited by: swathi Chandra on May 10, 2011 2:16 PM