cancel
Showing results for 
Search instead for 
Did you mean: 

How to show the message BAPI call delievers

Former Member
0 Kudos

Hi, Experts,

I have called some back end FM via BAPI. Also the message that FM generates will be sent back to WD context. How can I show them on the top of the screen.

Best regards,

Fan

Accepted Solutions (1)

Accepted Solutions (1)

former_member402443
Contributor
0 Kudos

Hi Fan,

First of all,You need to use UI component message area that you can place on the top of the VIEW like any other webDynpro UI Element in design mode. Next you need to create instance of the message manager.

You have to set the value of parameter message_text, the message that you recieve from the BAPI.

  • get message manager

DATA: l_current_controller TYPE REF TO if_wd_controller,

l_message_manager TYPE REF TO if_wd_message_manager.

l_current_controller ?= wd_this->wd_get_api( ).

CALL METHOD l_current_controller->get_message_manager

RECEIVING

message_manager = l_message_manager

.

LOOP AT lt_return INTO ls_return .

IF ls_return-type = 'E'.

  • report error message

CALL METHOD lo_message_manager->report_error_message

EXPORTING

message_text = ls_return-message.

ELSEIF ls_return-type = 'S'.

  • report success message

CALL METHOD lo_message_manager->report_success

EXPORTING

message_text = ls_return-message.

ELSEIF ls_return-type = 'W'.

  • report warning message

CALL METHOD lo_message_manager->report_warning

EXPORTING

message_text = ls_return-message.

ENDIF.

CLEAR ls_return.

ENDLOOP.

Regards

Manoj Kumar

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Fan,

You need to use UI Component message area that you can place on the top of the VIEW like any other webDynpro UI Element in design mode. Next you need to create instance of the message manager you can use the Wizard to create it , use CTRL + F7 key. if its sucess message then

use method report_success if its error you can select REPORT_WARNING etc

all you need to do is set the value of parameter message_text the message that you recieve from the FM/ BAPI.

*    get message manager
   DATA: l_current_controller TYPE REF TO if_wd_controller,
         l_message_manager    TYPE REF TO if_wd_message_manager.

   l_current_controller ?= wd_this->wd_get_api( ).

   CALL METHOD l_current_controller->get_message_manager
     RECEIVING
       message_manager = l_message_manager
       .

*    report message
   CALL METHOD l_message_manager->report_success
     EXPORTING
       message_text             =
*       PARAMS                   =
*       MSG_USER_DATA            =
*       VIEW                     =
*       SHOW_AS_POPUP            =
*       IS_PERMANENT             = ABAP_FALSE
*       SCOPE_PERMANENT_MSG      =
*       CONTROLLER_PERMANENT_MSG =
*       MSG_INDEX                =
       .

Greetings

Prashant