cancel
Showing results for 
Search instead for 
Did you mean: 

Suspend FPM_SAVE to display cofirmation message

vivek_priyadarshi2
Participant
0 Kudos

Hello,

I am trying to display a confirmation message to user before committing save, the confirmation message is displayed in a custom view ( using dialog box), I am using an OVP. The problem is, the FPM_EVENT continues after launching the confirmation popup. I want to find  a way to suspend the FPM_SAVE event till I get the user response to the confirmation popup. if the user selects 'OK' FPM_EVENT continues.

I can get this behavior by using the NEEDS_CONFIRMATION method, but I need the confirmation popup to look a certain way. The solution I am looking for will behave like NEEDS_CONFIRMATION but allows using the custom views to display confirmation message.

Regards,

Vivek

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Vivek,


a solution is to use a normal WD PopUp.

First you have to catch the FRM_SAVE event in OVERRIDE_EVENT_OVP:


:



if  IO_OVP->GET_EVENT( )->MV_EVENT_ID = 'FPM_SAVE'.

     wd_this->check_save_event(  IO_OVP )

endif.

In the Method "check_save_event" you can cancel  FPM_SAVE:


  TRY.

             IO_OVP->CANCEL_EVENT( ).

    CATCH CX_FPM_FLOORPLAN.    "

             RETURN.

ENDTRY.

After this you create a WD POPUP with custom content and button(s).

For example:


  DATA lo_window_manager TYPE REF TO if_wd_window_manager.

  DATA lo_api_component     TYPE REF TO if_wd_component.

  DATA lo_window                 TYPE REF TO if_wd_window.

  DATA lo_view_controller     TYPE REF TO if_wd_view_controller.

  DATA lv_string                    TYPE string_table.

  lo_api_component  = WD_THIS->wd_get_api( ).

  lo_window_manager = lo_api_component->get_window_manager( ).

  lo_window         = lo_window_manager->create_window(

                     window_name                    = 'W_NEEDS_CONFIRMATION '

                     title                                      = 'NEEDS_CONFIRMATION PopUp'

                     close_in_any_case             = abap_true

                     message_display_mode     = if_wd_window=>co_msg_display_mode_selected

                     close_button                       = abap_true

                     button_kind                         = if_wd_window=>co_buttons_okcancel

                     message_type                    = if_wd_window=>CO_MSG_TYPE_WARNING

                     default_button                     = IF_WD_WINDOW=>CO_BUTTON_OK

                     ).

  WD_THIS->go_window = lo_window.

    CALL METHOD LO_WINDOW->SUBSCRIBE_TO_BUTTON_EVENT

       EXPORTING

           BUTTON            = IF_WD_WINDOW=>CO_BUTTON_OK

           BUTTON_TEXT       = 'Save'

*         TOOLTIP           =

           ACTION_NAME       = 'POPUP_SAVE'

           ACTION_VIEW       = WD_THIS->GO_VIEW_CONTROLLER

*         IS_DEFAULT_BUTTON =  ABAP_FALSE

    .

  lo_window->open( ).

In a new custom view (e.g.: V_NEEDS_CONFIRMATION) of the window (e.g.: W_NEEDS_CONFIRMATION) you have to create a action POPUP_SAVE.

In the action method (ONACTIONPOPUP_SAVE) now you fire FPM_SAVE.


DATA lr_fpm TYPE REF TO if_fpm.

  lr_fpm = cl_fpm_factory=>get_instance( ).

 

LR_FPM->RAISE_EVENT_BY_ID(

      EXPORTING

        IV_EVENT_ID   = 'FPM_SAVE'

).

Or the user press  "Cancel"-Button --> nothing happens.

Regards

Shkelqim

vaibhav_singh12
Participant
0 Kudos

Create a custom button assigning new event called PRE_SAVE or something, do you actions in your popup, after that raise FPM_SAVE event.

vivek_priyadarshi2
Participant
0 Kudos

HI Naga, Ram,

I am using a freesstyle UIBB in my application, I am able to generate popup, but how do I suspend the current FPM loop and wait for user action? This will have the effect of making the popup synchronous.

Regards,

Vivek

former_member197475
Active Contributor
0 Kudos

Hi Vivek,

Check the below blog .

BR,

RAM.

Former Member
0 Kudos

Dear Vivek,

Implement IF_FPM_GUIBB_FORM_EXT interface in your form feeder class. Write below code in NEEDS_CONFIRMATION method.

data :   lo_confobj      type ref to cl_fpm_confirmation_request,

         lt_conf_text    type        string_table,

         lv_conf_txt     type        string,

         lv_window_title type        string.

 

CASE  io_event->mv_event_id.

  WHEN 'FPM_SAVE'.

     

         lv_conf_txt = text-001.

         lv_window_title = 'Your required titile'.

          append lv_conf_txt to lt_conf_text.

          create object lo_confobj

            exporting

              it_confirmation_text = lt_conf_text

              iv_window_title      = lv_window_title.

          if lo_confobj is not initial.

            eo_confirmation_request = lo_confobj.

          endif

.ENDCASE.

Create a text element for 001. Which contains the confirmation message in the popup.

Note: For this requirement no need to create a dialog box.:)

Hope this will helps you.

Regards,

Naga