Skip to Content
avatar image
Former Member

Regarding Messages

Hi All,

As per my requirement, I have 2 tabs on which respective ALV table is shown and there is a Common

Save button to save data for both the ALV tables.

I'm using the Message Area to display the messages which is also used across other views in the application.

The message area gets refreshed when there is a change in the tab ie Tab changed.

When clicked on SAVE the messages are shown. When the tab seletion is made then messages get

refreshed.

How to retain the messages in the message area when the tab change occurs as they are the business

validations. As a alternative solution, If I try use the Table(to hold messages) instead of Message area then I need to explicitkly show the messages in that table accross all the views.

Any workaround to this would be highly appreciated.

Regards,

Lekha.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Feb 23, 2009 at 11:29 AM

    Hi Lekha,

    You can use two local variable of STRING type to store messages. ideally you should be updating these variables on your OnTabChange event for the tab strip.

    example LV_ALV1_MSG = get message when you are on ALV1 on tab strip.

    LV_ALV2_MSG = get message when you are on ALV2 on tab strip.

    Also you can another local variable to keep track of which ALV user is currently working on.

    now when user switches to tab1 , populate the Message Area with value in the LV_ALV1_MSG, update the ALV identification flag. This should be easier than internal table.

    Greetings

    Prashant

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Lekha,

      Each tab has ONE ALV right ? so when you start this view you will have one default tab ( tab1 )...user clicks save here; message area is populated with message ~ read this message and populate STRING variable LV_ALV1_MSG, update m_alv ( type i ) with value 1.

      now user clicks on other tab( tab2 ) , clear ONLY the message area; update m_alv with value 2. User does processing on this tab & saves. On Save message displayed in message area ~ read this message and populate STRING variable LV_ALV2_MSG.

      essentially event OnSelect for the TabStrip will be fired, check which TabStrip user has navigated to using following code

      data:    tab_id type string.
      
        call method myevent->get_string
          exporting
            name  = 'ID'
          receiving
            value = tab_id.
      "clear the message area 
      
      case tab_id
      
      when 'TAB_1'.
      " read  m_alv if NOT 1 then user is navigating from Tab2 to Tab 1
      " hence clear the message area, read the LV_ALV1_MSG lastly set the message area with LV_ALV1_MSG value.
      
      
      when 'TAB_2'.
      " read  m_alv if NOT 2 then user is navigating from Tab1 to Tab 2
      " hence clear the message area, read the LV_ALV2_MSG lastly set the message area with LV_ALV1_MSG value.
      
      
      endcase
      .

      hope this makes it clear.

      Greetings

      Prashant

  • avatar image
    Former Member
    Feb 23, 2009 at 05:01 PM

    hi

    To make the message permanent set the corresponding variable in method used for message display:

    • get message manager

    DATA lo_api_controller TYPE REF TO if_wd_controller.

    data str type string.

    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

    .

    data str type string.

    //Your condition

    • report message

    CALL METHOD lo_message_manager->report_error_message

    EXPORTING

    message_text = ' tab a is empty'

    is_permanent = ABAP_TRUE

    scope_permanent_msg = '0'

    controller_permanent_msg = lo_api_controller

    receiving

    message_id = str

    .

    endif.

    Thanks

    Vishal Kapoor

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      If we set the property IS_PERMANENT to ABAP_TRUE and the Scope also........

      Eventhough there are No errors still these messages are shown because of this property.

      Regards,

      Lekha.