Hi Experts,
My requiremnt is to get a view as a popup in a f4 help.
Product search is a different view IN ICCMP_PRODUCT/PROSEARCH.I want this window as a popup in my f4 help on product in camapiagn in CPGOE_ABLOCKS/OVELProducts.
I have created a OP_Productsearch,now it is showing me a popup on that f4,but my problem is in that winodw (ICCMP_PRODUCT) when we search a products and select and click on Back Button, Its not showing any action.
Again when i am traying to click on close it comes out of Camapaign .
my code in OP is as follows:I have added ICCMP_PRODUCT as component usage in runtime repository.
*******************************
method op_productsearch.
Added by wizard: Outbound plug 'PRODUCTSEARCH'
data: lv_title type string.
lv_title = cl_bsp_runtime=>get_otr_text( alias = 'CRM_IC_APPL_UI_MARKETING/SEARCHFORPRODUCTS' ).
if gv_popup is not bound.
gv_popup = comp_controller->window_manager->create_popup( iv_interface_view_name = 'ProductWindow'
iv_usage_name = 'CUproductsearchPOPup'
iv_title = lv_title ).
endif.
OPEN THE POPUP
gv_popup->set_window_height( 500 ).
gv_popup->set_window_width( 600 ).
gv_popup->set_on_close_event( iv_event_name = 'PRODSEARCH_POPUPCLOSED' iv_view = me ).
gv_popup->set_display_mode( if_bsp_wd_popup=>c_display_mode_surrounded ).
gv_popup->open( iv_inbound_plug = 'TORESLIST' ).
endmethod. "OP_PRODUCTSEARCH
*******************************
code i have written in EH_ONPRODSEARCH_POPUPCLOSED is as follows:
*******************************
method eh_onprodsearch_popupclosed.
data: lr_context_node type ref to cl_bsp_wd_context_node,
lr_current type ref to if_bol_bo_property_access,
lr_product_id type string,
lv_outbound_plug type seocmpname,
lv_value type string,
lr_cnode type ref to cl_cpgoe_ab_ovelproducts_cn01. "cl_cpgoe_ab_cucocampaign_impl
get query result context node
lr_context_node = gv_popup->get_context_node( iv_cnode_name = 'PRODRESULT' ).
check lr_context_node is bound.
lr_current = lr_context_node->collection_wrapper->get_current( ).
check lr_current is bound.
Check outbound plug
lv_outbound_plug = gv_popup->get_fired_outbound_plug( ).
check lv_outbound_plug = 'CLOSE_POPUP'.
Retrieve Product ID
lr_product_id = lr_current->get_property_as_string( 'PRODUCT_ID' ).
check lr_product_id is not initial.
lr_current = me->typed_context->products->collection_wrapper->get_current( ).
set product id
if lr_current is bound.
lr_current->set_property( iv_attr_name = 'PRODUCT_ID' iv_value = lr_product_id ).
endif.
Clean up result
lr_context_node->collection_wrapper->clear( ).
try.
catch cx_sy_ref_is_initial cx_sy_move_cast_error.
return.
endtry.
endmethod. "EH_ONPRODSEARCH_POPUPCLOSED
in this lr_context_node in initial so it comes out of the method in first time itself.
*******************************
Do i need to redefine EH_ONDONE and there i can write a code for that back button.
I have seen many standard components for product search.
I have gone through many threads but not able to figure out the solution.
Can you all please help me in this??
Thanks in advance.
Best Regards,
Sunita.
Hi Sunita,
This seems to be a special case....
First I checked component ICCMP_PRODUCT. There is a Search page, but no Search Result page. I did some research and most probably assume that the result page being shown is of ICCMP_PRODMAIN/ProdDetail. I opened the HTML page for this view and saw that there is a BACK button indeed for this view.(Please validate that I gave the correct result view, by doing an F2 on the result page on your screen.)
My basic understanding is that, all the thing we need to create a F4 Help is..
Source Component:
1. Create a Component Usage in Run Time Repo.
2. Create an Outbound plug and specify the same in the GET_V method where F4 needs to come.
3. Call the Pop up using Create Pop Up method in the Outbound Plug. Specify the On close event handler. Open the Pop Up(if required pass, query parameters).
Target Component:
1. There should be an event handler like EH_ONSELECT.
2. Here once we select a row....
i. the corresponding bol entities should be identified, added to a
collection and passed to an Outbound Plug to call Source Component.
ii. or create a context node in the component controller and exchange
data between the source and target components.
You can take a look at any standard component..to see what happens.
The goal should be to catch the Entities(Select Event Handler) selected in the pop up and pass back to source component either by attaching the collection to the OutBound Plug or by creating context node in the component controller.
Regards,
Masood Imrani S.
hi,
Thanks a lot for reply.
The standard one which is working properly is ICCMP_BT_SLO/Slo1Cart ->OP_PRODUCTSEARCH .
In the run time repository i checked the component usage in ICCMP_PRODUCT and in this component again they have added component usage ICCMP_PRODMAIN/PRODLIST.
In this component the code is written for back button .EH_ONDONE and EH_ONLINESELECT is there.
In my component i have added the same thing but the correction is m caling that view as a pop up and in standard it works as window.
in my case i put a break point in all these event handlers. In EH_ONLINESELECT m getting the lv_index but when i click back button no action is happening.
method eh_ondone. data lr_coco type ref to cl_iccmp_pr_bspwdcompone0_impl. data lr_window_controller type ref to cl_bsp_wd_window. *** lr_coco ?= me->comp_controller. if lr_coco->is_called_as_popup eq abap_false. op_default_back( ). else. lr_window_controller ?= me->view_manager->get_window_controller( ). lr_window_controller->call_outbound_plug( iv_outbound_plug = 'CLOSE_POPUP' ). lr_coco->is_called_as_popup = abap_false. endif. * commeneting the Previewhide flag because its needed to keep the flag to store value in the restore event * GV_PREVIEWHIDE = ABAP_FALSE. endmethod.
there is custom cotroller in ICCMP_PRODMAIN/CucoProdSelected.
do i need to create the same in my component.
I didnt get these points.can you please elaborate it.
2. Here once we select a row....
i. the corresponding bol entities should be identified, added to a
collection and passed to an Outbound Plug to call Source Component.
ii. or create a context node in the component controller and exchange
data between the source and target components.
Sunita,
By looking at the code, I can say that it should go to into the Else Condition
Else. lr_window_controller ?= me->view_manager->get_window_controller( ). lr_window_controller->call_outbound_plug( iv_outbound_plug = 'CLOSE_POPUP' ). lr_coco->is_called_as_popup = abap_false. Endif.
At the Source Component where the component usage is created,an outbound plug 'CLOSE_POPUP' in the Run time repository should exist.
At the Target Component in the EH_ONDONE event handller an outbound plug should be called which in turn calls an outbound plug 'CLOSE_POPUP' of the MainWindow. Here in Window Outbound Plug another Outbound Plug should be fired so that the control goes to Source Component.
In the Source Component, in the Pop Up close event handler, put a similar code
DATA: lr_context_node TYPE REF TO cl_bsp_wd_context_node, lr_current TYPE REF TO if_bol_bo_property_access, lv_outbound_plug TYPE seocmpname. * Get the Outbound Plug lv_outbound_plug = gr_popup->get_fired_outbound_plug( ). CHECK lv_outbound_plug = 'CLOSE_POPUP'. lr_context_node = gr_popup->get_context_node( iv_cnode_name = 'PRODSELECTED' ). CHECK lr_context_node IS BOUND. lr_current = lr_context_node->collection_wrapper->get_current( ).
The context node PRODSELECTED contains the selected product entries and you will be able to access it at the target component(without any additional creation steps) as this context node is aleady added to the Component Interface of component 'ICCMP_PRODMAIN'.
Regards,
Masood Imrani S.
Hi Masood ,
Yes, i have already written that code.
But when i click on back button it is going inside IF but no history is maintained so it does not return any value in lv_no_back
lv_history_access = me->view_manager->get_history_manager_display( ). lv_history_access->get_history( importing no_back = lv_no_back ). if lv_no_back = abap_false.
so it comes out without any action.
the code i have written for close popup is as folows:
method eh_onprodsearch_popupclosed. data: lr_context_node type ref to cl_bsp_wd_context_node, lr_current type ref to if_bol_bo_property_access, lr_product_id type string, lv_outbound_plug type seocmpname, lv_value type string, lr_cnode type ref to cl_cpgoe_ab_ovelproducts_cn01. "cl_cpgoe_ab_cucocampaign_impl * Check outbound plug lv_outbound_plug = gv_popup->get_fired_outbound_plug( ). check lv_outbound_plug = 'CLOSE_POPUP'. * get query result context node lr_context_node = gv_popup->get_context_node( iv_cnode_name = 'PRODSELECTED' ). check lr_context_node is bound. lr_current = lr_context_node->collection_wrapper->get_current( ). check lr_current is bound. * Retrieve Product ID lr_product_id = lr_current->get_property_as_string( 'PRODUCT_ID' ). check lr_product_id is not initial. lr_current = me->typed_context->products->collection_wrapper->get_current( ). * set product id if lr_current is bound. lr_current->set_property( iv_attr_name = 'PRODUCT_ID' iv_value = lr_product_id ). endif. * Clean up result lr_context_node->collection_wrapper->clear( ). try. catch cx_sy_ref_is_initial cx_sy_move_cast_error. return. endtry. endmethod. "EH_ONPRODSEARCH_POPUPCLOSED
Please help me in this.
Thanks a lot for your help.
Hi Masood,
I have added the OP in run time repository.but when i click on close for the first time it comes to home page same happens for 2nd time but when third time i am doing this No Outbound plug in this -> lv_outbound_plug
* Check outbound plug lv_outbound_plug = gv_popup->get_fired_outbound_plug( ). check lv_outbound_plug = 'CLOSE_POPUP'.
I have debugged the stadndard component too.And done changes accordingly but this is the problem i am facing.
Can we do one thing??instead of back button when we select a value from popup it should close the popup and the selected value should be available.
for this i have seen standard F4 helps.
My OP contains this code.
method op_productsearch. * Added by wizard: Outbound plug 'PRODUCTSEARCH' data: lv_title type string. lv_title = cl_bsp_runtime=>get_otr_text( alias = 'CRM_IC_APPL_UI_MARKETING/SEARCHFORPRODUCTS' ). if gv_popup is not bound. gv_popup = comp_controller->window_manager->create_popup( iv_interface_view_name = 'ProductWindow' iv_usage_name = 'CUproductsearchPOPup' iv_title = lv_title ). endif. * OPEN THE POPUP gv_popup->set_window_height( 500 ). gv_popup->set_window_width( 600 ). gv_popup->set_on_close_event( iv_event_name = 'PRODSEARCH_POPUPCLOSED' iv_view = me ). gv_popup->set_display_mode( if_bsp_wd_popup=>c_display_mode_surrounded ). gv_popup->open( iv_inbound_plug = 'TORESLIST' ). endmethod. "OP_PRODUCTSEARCH
That is the code for Outbound part. That is working fine right. To implement the code for close on select of the result, you need to implement in method EH_ONSELECT of the result page.
I think the issue is that there are two components right.
ICCMP_PRODUCT and ICCMP_PRODMAIN.
The control has to come back from
ICCMP_PRODMAIN->ICCMP_PRODUCT->Source View
This navigation if made, closes the issue.
You can hide the Back button by setting a public attribute in window inbound plug and accessing it in HTML page.
Hi Masood,
Yes you are right.The navigation is from ICCMP_PRODMAIN->ICCMP_PRODUCT->SOURCE VIEW
You mean to say the code which i have written in EH_ONPRODSEARCH_POPUPCLOSED which i posted in earlier post, i have to add it to Eh_onselect?
Do i need to create the navigation link?
I mean i have added ICCMP_PRODUCT as
ComponentUsage "CUproductsearchPOPup "
in my source view.
navigation link is ->
Source CPGOE_ABLOCKS/OVELProducts Outbound Plug PRODUCTSEARCH Target CUproductsearchPOPup.ProductWindow Inbound Plug TORESLIST
similarly i should create component usage for ICCMP_PRODMAIN and add in the navigation as
Source CPGOE_ABLOCKS/OVELProducts Outbound Plug PRODUCTSEARCH Target CUprodserach.MainWindow Inbound Plug DEFAULTASPOPUP
.
No...that is not required.
Fire an outbound plug at ICCMP_PRODMAIN to navigate to ICCMP_PRODUCT. I believe you need to figure out this from ICCMP_BT_SLO(as u said it is working there). Or just try firing and outbound plug from EH_ONLINESELECT event handler and see if the control goes to any of the inbound plugs of Main Window ICCMP_PRODUCT.If that works.. thats it...fire an out bound plug at Main Window of ICCMP_PRODUCT.It will take u to ur source comp.
At ur source component.. the code u have already written is sufficient.
Hi Masood,
Yes the Problem is solved.
The problem was in the Navigation,Modifications done EH_ONLINESELECT and in EH_ONDONE in Component ICCMP_PRODMAIN.
We Enhanced the Main component CPG_MAIN of CPGOE_ABLOCKS.
Added component usage " ICCMP_PRODUCT " in Runtime Repository of CPG_MAIN.Redefined the EH_ONSAVE of CPG_MAIN.
The main Problem was in runtime repository.Now the window ans usages are working fine.
Thanks a lot for your help.
Best Regards,
Sunita.
Have a gr8 time!!!
Hi Masood,
I've solve the problem.
the outbound plug is by default protected, should be change to public.
Best regards,
Anders
Hi Masood,
I got an error when calling the value help.
View '' does not have the public outbound plug 'OP_XXXXX' for value help navigation
But I does create a value help. Do you know how I can debug?
Thanks and best regards,
Anders