Skip to Content

There would be scenarios, where we would require Pop-up confirmation’s based on certain actions. In order to achieve this kind of functionality, we would need to call the pop-ups manually and handle the po-up button functionality accordingly. To make the life easy, FPM framework provides the pop-up’s functionality through the interface method – NEEDS_CONFIRMATION. Just populate the pop-up text and create an instance of the class CL_FPM_CONFIRMATION_REQUEST passing this pop-up text. You can control the process flow based on the pop-up’s action. Like if user clicks on “Ok” button the interface method – PROCESS_EVENT gets executed, in case if the user clicks on “Cancel” button the interface method – PROCESS_EVENT won’t get executed. I decided to write a blog to illustrate this feature.

Create a WD Component implementing the interface – IF_FPM_UI_BUILDING_BLOCK –

  

Create an OIF based WD Application using Application Creation Tool (which automatically creates the respective Application Configuration and Component Configurations-IDR and OIF) –

For test purpose, let’s create 3 buttons (Default, Refresh and Save) in the IDR component configuration –

 

 

 

Getting back to the WD Comp, I managed to handle these events using the PROCESS_EVENTS method as shown below –

* get message manager
data lo_api_controller     type ref to if_wd_controller.
data lo_message_manager    type ref to if_wd_message_manager.

lo_api_controller ?= wd_This->Wd_Get_Api( ).
CALL METHOD lo_api_controller->GET_MESSAGE_MANAGER
  RECEIVING
    MESSAGE_MANAGER = lo_message_manager
    .
* Based on Event ID – Perform the appropriate action
CASE IO_EVENT->MV_EVENT_ID.
  WHEN ‘FPM_SAVE’.

* report message
CALL METHOD lo_message_manager->REPORT_SUCCESS
  EXPORTING
    MESSAGE_TEXT              = ‘Save action processed’    .

  WHEN ‘FPM_REFRESH’.
* report message
CALL METHOD lo_message_manager->REPORT_SUCCESS
  EXPORTING
    MESSAGE_TEXT              = ‘Refresh action processed’    .

  WHEN ‘FPM_DEFAULT’.
* report message
CALL METHOD lo_message_manager->REPORT_SUCCESS
  EXPORTING
    MESSAGE_TEXT              = ‘Default action processed’    .

ENDCASE.

The pop-ups can be created from the FPM’s interface method – NEEDS_CONFIRMATION. This method is called before the PROCESS_EVENT method, based on the user action, the PROCESS_EVENT method is called accordingly i.e. if user clicks on CANCEL button in the pop-up, the PROCESS_EVENT method is never called. You have an option to display the pop-up text as per the event (the Save button and Refresh buttons illustrates the same – You would have to populate the Pop-up text into an internal table, and create an instance of the class – CL_FPM_CONFIRMATION_REQUEST passing this popup text), Also you have the default pop-up option where if we have to set the export parameter EO_CONFIRMATION_REQUEST to CL_FPM_CONFIRMATION_REQUEST=>GO_DATA_LOSS.

  DATA : lo_instance type ref to cl_fpm_confirmation_request,
         lt_popup_text TYPE STRING_TABLE,
         ls_popup_text TYPE STRING.

  CASE io_event->MV_EVENT_ID.
    WHEN ‘FPM_SAVE’.
      CLEAR : lt_popup_text[], ls_popup_text.
      ls_popup_text = ‘You have just clicked on Save button.’.
      APPEND ls_popup_text to lt_popup_text.
    CREATE OBJECT lo_instance
        EXPORTING
          it_confirmation_text = lt_popup_text.
      eo_confirmation_request = lo_instance.

    WHEN ‘FPM_REFRESH’.
      CLEAR : lt_popup_text[], ls_popup_text.
      ls_popup_text = ‘You have just clicked on Refresh button.’.
      APPEND ls_popup_text to lt_popup_text.
    CREATE OBJECT lo_instance
        EXPORTING
          it_confirmation_text = lt_popup_text.
      eo_confirmation_request = lo_instance.

    WHEN ‘FPM_DEFAULT’.
      eo_confirmation_request = cl_fpm_confirmation_request=>GO_DATA_LOSS.

    WHEN OTHERS.

  ENDCASE.

You may test this application to see the following results –

 

Default pop-up

 

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

    1. Raja Sekhar Kuncham Post author

      Sorry for a delayed response Ashish.

      Thanks for your feedback on the blog.

      Well, you should be handling the “Ok” button in the PROCESS_EVENT method with the event name of the button clicked(After which the PROCESS_BEFORE_OUTPUT method is called).

      In case if the user clicks on “Cancel” button, the control never hits the PROCESS_EVENT method, instead it hits the method – AFTER_FAILED_EVENT before hitting the PROCESS_BEFORE_OUTPUT method.

      So the flow is pretty simple –

      If “Ok” button is clicked – PROCESS_EVENT method is called.

      If “Cancel” button is clicked – AFTER_FAILED_EVENT method is called.

      I shall take any more questions if you still have any.

      Thanks

      Raja

      (0) 
      1. Ashish Shah

        Hi Raja,

        Thanks for responding.

        Suppose we are raising multiple Confirmation pop ups , in that case how do we differentiate the OK buttons of different pop up windows ?

        If you can share code snippet it will be really helpful.

        Regards,

        Ashish Shah

        (0) 
        1. Raja Sekhar Kuncham Post author

          Hi Ashish,

          Well, the key is FPM Event ID. Based on the Event ID, you would be able to handle it accordingly in PROCESS_EVENT method. Hope this helps.

          Thanks

          Raja

          (0) 
        2. Raja Sekhar Kuncham Post author

          Hi Ashish,

          Well, the key is FPM Event ID. Based on the Event ID, you would be able to handle it accordingly in PROCESS_EVENT method. Hope this helps.

          Thanks

          Raja

          (0) 

Leave a Reply