Skip to Content
0
Former Member
Nov 29, 2010 at 09:48 AM

Display BAPI return message in Pop Up Window

2642 Views

Hi,

My Requirement is to display the BAPI Return Messages in a pop up window.

On click of a button i will be calling a BAPI and the return messages from the BAPI have to be displayed in a POP UP Window.

I have placed a Message Area UI in the view embedded in the window to be used for Pop Up.

In the below code instead of calling a BAPI i have populated the return messages.

On click of the button the return messages are getting displayed both in Main view and inside the Pop Up window also. I need the messages to be displayed only inside pop up window.

method ONACTIONPOP .

 data: it_return type table of bapiret2.
 data: wa_return type bapiret2.

 ***Populating return messages
 wa_return-type = 'S'.
 wa_return-message = 'Success Message'.
 APPEND wa_return to it_return.

 wa_return-type = 'E'.
 wa_return-message = 'Error Message'.
 APPEND wa_return to it_return.

***Code to print return message based on the message type returned by the BAPI
 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.

 loop at it_return into wa_return.
   if wa_return-type = 'S'.
       CALL METHOD lo_message_manager->report_success
          EXPORTING
           message_text = wa_return-message.
   ELSEIF wa_return-type = 'E'.
     CALL METHOD lo_message_manager->report_error_message
        EXPORTING
         message_text = wa_return-message.
   ELSEIF wa_return-type = 'E'.
      CALL METHOD lo_message_manager->report_warning
        EXPORTING
        message_text = wa_return-message.
   ENDIF.
   clear: wa_return.
  ENDLOOP.

****code to open pop up window

  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.

  lo_api_component  = wd_comp_controller->wd_get_api( ).
  lo_window_manager = lo_api_component->get_window_manager( ).
  lo_window         = lo_window_manager->create_window(
                      window_name            = 'W_POP'
                      title                  = 'Pop Up Window Demo'
*                     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_ok
                      message_type           = if_wd_window=>co_msg_type_none
                      default_button         = if_wd_window=>co_button_ok
                     ).

  lo_window->open( ).
endmethod.

Regards,

Bala Baskaran.S