Showing the pop-ups/dialog boxes for information, confirmation etc in WDA HCMPF is tricky. We have to spend some time and also have to understand the HCMPF framework for showing the popups. So I thought its better to have a wiki which could help the community.
Initially I was under impression that the new WDA HCMPF framework doesn’t support the pop ups but by digging little deep I understood that I was wrong. I realized there are at least two ways to show pop ups. I will go ahead and will explain both the options. You can use what ever you like.
As the WDA HCMPF is based on FPM architecture, we can use the underlying FPM methods to show the dialog boxes. We can use the FPM’s OPEN_DIALOG_BOX method to show informational, confirmation and also can design any other custom dialog box as per the requirement. Here we have the required flexibility in designing our own form for popup.
Here is the sample code:
data lo_fpm type if_fpm.
* Get FPM instance
lo_fpm = cl_fpm_factory=>get_instance( ).
"Show the dialog box
if lo_fpm is bound .
lo_fpm->open_dialog_box( '<Dialog_box_ID>' ).
endif.
Using the passed dialog box id, it will open the respective dialog box.
The WDA HCMPF uses the application config ASR_PROCESS_EXECUTE_OVP_CFG to show the new WDA Process and Forms applications. If we take a close look at application config, we will understand how to introduce and add the dialog boxes.
We need to add our dialog box here. To do this we need to make copy of the application config ASR_PROCESS_EXECUTE_OVP_CFG to ZASR_PROCESS_EXECUTE_OVP_CFG and have to add our required dialog boxes. And then we need to update/configure the launch pad to use the newly created application config for the WDA HCMPF applications.
Let see an example of how to add and configure the dialog box in the application config.
In the dialog box, we can show different kinds of UIBBs or even we can have the custom WDA application. I have used the From UIBB with component FPM_FORM_UIBB_GL2 so that in case if we have to show any of the HCMPF form fields etc, it would be easy. Also in case if we have to add any custom buttons/events etc, it would be easy to handle from the HCMPF Generic Service.
In screen shot we can see different attributes. Through “Button Sets” we can have different types of predefined button to the dialog box.
To use the newly created app config ZASR_PROCESS_EXECUTE_OVP_CFG.
Note: In case if we are executing the application directly from the transaction “HRASR_DT”, we have to modify the url to use ZASR_PROCESS_EXECUTE_OVP_CFG instead of ASR_PROCESS_EXECUTE_OVP_CFG
This is how popup will look like:
Some times, based on the button clicks we might have to perform some actions. So how do we handle the events?
If we use the default buttons provided by the framework, they just raise the events to close the dialog box and from the HCMPF frame work i.e. from the generic service we will not be able to find which button click was done.
For handling the dialog box button events, we need to add the required buttons though the design time and associate the buttons with respective user define events. So once we click on the buttons the control would go back to the HCMPF Generic Service and there we can write the required business logic.
At the end of the business logic, we need to write the code to close the popup which we have opened. It can be done by raising the even FPM_CLOSE_DIALOG which will close the popup.
if lo_fpm is bound.
lo_fpm->raise_event_by_id( 'FPM_CLOSE_DIALOG' ).
endif.
SAP uses the needs_confirmation method of feeder class to show the confirmation popups. We can use same method for writing the post exist enhancement to show the pop ups for our custom events. Here we can show only informational or confirmation popups.
Let’s see in detail how to show confirmation popups by enhancing the feeder class. Here we are just going to write a post exit that too without any business logic, until we don’t write any business logic, I think it should be ok to enhance feeder class.
Here is the sample implementation.
data: lt_confirmation_text type string_table,
lo_confirmation_request type ref to cl_fpm_confirmation_request.
if io_event->mv_event_id eq '<event_name>'. "Provide the event name here
append 'Do you agree?' to lt_confirmation_text.
create object lo_confirmation_request
exporting
it_confirmation_text = lt_confirmation_text
iv_window_title = 'Agreement '
iv_button_text_approve = 'I Agree'
iv_button_text_reject = 'Cancel'.
eo_confirmation_request = lo_confirmation_request.
me->obj->core_object->a_check_fired = abap_true.
me->obj->core_object->a_data_changed = abap_false.
endif.
(While raising the event, we are informing the HCMPF framework that event is raised by the HCMPf Form)
data: lt_params type apb_lpd_t_params,
ls_param like line of lt_params,
io_event_data type ref to if_fpm_parameter,
lo_event type ref to cl_fpm_event.
ls_param-key = 'MS_SOURCE_UIBB-COMPONENT'.
ls_param-value = 'FPM_FORM_UIBB_GL2'.
append ls_param to lt_params.
ls_param-key = 'MS_SOURCE_UIBB-CONFIG_ID'.
ls_param-value = '<HCMPF_Fom_Name>'."Need to give the HCMPF Form name
append ls_param to lt_params.
ls_param-key = 'MS_SOURCE_UIBB-CONFIG_TYPE'.
ls_param-value = '00'.
append ls_param to lt_params.
io_event_data = cl_fpm_parameter=>create_by_lpparam( it_parameter = lt_params ).
lo_event = cl_fpm_event=>create_by_id( iv_event_id = '<event_name>' "Give the event name
io_event_data = io_event_data ).
lo_event->ms_source_uibb-component = 'FPM_FORM_UIBB_GL2'.
lo_event->ms_source_uibb-config_id = '<HCMPF_Fom_Name>'."Need to give the HCMPF Fomr name
lo_event->ms_source_uibb-config_type = '00'.
lo_fpm->raise_event( io_event = lo_event ).
Upon raising the event, need confirmation gets invoked and there the framework checks to see if this particular event needs any confirmation, depending upon our post exit implementation, it will show the confirmation dialog. Upon clicking the “I Agree” button, the respective implementation in generic service will get called.
We can refer to following help.sap.com link to know more about the dialog boxes. http://help.sap.com/SAPhelp_nw73/helpdata/en/23/102a78b5184affbd0da0546f1ebf6a/content.htm?frameset=...
Also from the FPM Developers guide we can find more information about FPM.
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 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 |