Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Popup BAPI return messages

Former Member
0 Likes
24,079

Hello experts,

I would like a way to quickly handle the BAPI return table (TYPE TABLE OF bapiret2).  I would like to pass the table into a function module or helper method to popup all the messages at once.  This is the same way MIGO (and many other programs) do a popup of messages with little red, yellow, and green icons to the left.  Currently I am using a series of calls to function module BAL_LOG_... and I feel there has to be a better way.

I tried searching for the answer to this question, but if the answer exists, it is buried within the noise of a million people saying use 'POPUP_TO_CONFIRM' and other function modules.  To clarify: I do not want buttons to confirm.  I want a popup of a list of messages with red, yellow, and green icons on the left.

Whoever answers my question correctly will henceforth be referred to by me as "the Magnificent."

1 ACCEPTED SOLUTION
Read only

Former Member
14,457

Hi Eric,

you can call in sequence FMs MESSAGES_INITIALIZE, MESSAGE_STORE (for every message to show in the popup windows) and MESSAGES_SHOW.

You can easily set up a little test, but if you need you can search in SCN: there's a lot of examples.

Marco

8 REPLIES 8
Read only

Former Member
14,458

Hi Eric,

you can call in sequence FMs MESSAGES_INITIALIZE, MESSAGE_STORE (for every message to show in the popup windows) and MESSAGES_SHOW.

You can easily set up a little test, but if you need you can search in SCN: there's a lot of examples.

Marco

Read only

14,457

Read only

former_member223133
Active Participant
0 Likes
14,457

Hi Eric,

You can use the function module " MRM_PROT_FILL" to populate the messages into message tab.

Below is the source code:

*   Set error message
         ls_err-msgty = c_msgty.
         ls_err-msgid = c_msgid.
         ls_err-msgno = c_msgno.
         ls_err-msgv1 = ls_drseg-ebelp.
         ls_err-source = c_source.
         ls_err-rblgp = ls_drseg-rblgp.
         ls_err-shown = c_shown.
         APPEND ls_err TO lt_err.
*   Populate the message into message tab
         CALL FUNCTION 'MRM_PROT_FILL'
           TABLES
             t_errprot = lt_err.


  Append all your messages to lt_err . It works well.


Thanks

Gangadhar

Read only

0 Likes
14,457

I'm not sure how those constants work, and when I tried this nothing happened.  More explanation might be helpful.

Read only

0 Likes
14,457

Hi Eric,

you can use the FM FINB_BAPIRET2_DISPLAY.

It accepts as internal table of type BAPIRET2 and pops it to the screen.

Cheers!

Regards,

Vamsi

Read only

0 Likes
14,457

That is even simpler than Gangadhar's answer, but it doesn't allow me to set the SEND_IF_ONE parameter.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
14,457

My 2 cents ...

IF_RECA_MESSAGE_LIST is the most convenient message handler i have used so far So i would use it in this way -

  1. Get the instance using the factory class CF_RECA_MESSAGE_LIST=>CREATE( ).
  2. Add the BAPI messages using the method ADD_FROM_BAPI( ).
  3. Get the handle via GET_HANDLE( ) & display using function BAL_DSP_LOG_DISPLAY.
  1. DATA(o_msg_list) = cf_reca_message_list=>create( ).
  2. o_msg_list->add_from_bapi(
  3.   EXPORTING
  4.     it_bapiret = VALUE #( id = 'BC_IBF'
  5.                         ( type = 'I'  number = '008' )
  6.                           type = 'E' ( number = '050' message_v1 = 'AA')
  7.                                      ( number = '051' message_v1 = 'BB')
  8.                                      ( number = '055' message_v1 = 'CC')
  9.                         ) ) .
  10. DATA st_log_disp_prof TYPE bal_s_prof.
  11. CALL FUNCTION 'BAL_DSP_PROFILE_POPUP_GET'
  12.   IMPORTING
  13.     e_s_display_profile = st_log_disp_prof.
  14. st_log_disp_prof-use_grid   = abap_true.
  15. st_log_disp_prof-disvariant
  16.   = VALUE #( handle = o_msg_list->get_handle( )
  17.              report = sy-repid
  18.            ).
  19. CALL FUNCTION 'BAL_DSP_LOG_DISPLAY'
  20.   EXPORTING
  21.     i_s_display_profile  = st_log_disp_prof
  22.   EXCEPTIONS
  23.     profile_inconsistent = 1
  24.     internal_error       = 2
  25.     no_data_available    = 3
  26.     no_authority         = 4
  27.     OTHERS               = 5.
  28. IF sy-subrc <> 0.
  29. * Implement suitable error handling here
  30. ENDIF.

BR,

Suhas

Read only

itzssreddy
Explorer
0 Likes
14,457

Hi Eric,

Can you tell me how did you manage to store multiple messages and show them in a single display pop up.

Thanks,

Sree