cancel
Showing results for 
Search instead for 
Did you mean: 

set focus in combination with message

former_member193202
Participant
0 Kudos

Hi folks,

we're using statement view->request_focus_on_view_elem for setting focus on a certain fields in event WDDOMODIFYVEIW ; this works fine, but when we raise a message with the message manager then we never can set the focus on that certain field, although the wddomodify view gets executed.

any hints are welcome!

kind regards

oliver

Accepted Solutions (0)

Answers (2)

Answers (2)

alejandro_bindi
Active Contributor
0 Kudos

I think what you need is just to use method REPORT_ATTRIBUTE_T100_MESSAGE.

You send an element object to it and it focuses on the specific field (similar to the check_mandatory_attributes_on_view method behaviour).

Here you have an example, I assume you already know how to get and use the message manager reference:


DATA:
    lr_node         TYPE REF TO if_wd_context_node,
    lt_items_elems  TYPE wdr_context_element_set,
    ls_item         TYPE wd_this->element_items,
    ls_msg          TYPE symsg,
    lr_msg_manager  TYPE REF TO if_wd_message_manager.
  FIELD-SYMBOLS:
    <lfs_elem>      TYPE REF TO if_wd_context_element.

* Check each item:
  lr_node = wd_context->get_child_node( wd_this->wdctx_items ).
  lt_items_elems = lr_node->get_elements( ).

  LOOP AT lt_items_elems ASSIGNING <lfs_elem>.
    <lfs_elem>->get_static_attributes(
      IMPORTING
        static_attributes = ls_item
    ).

******************************************************
*   HERE YOU PUT YOUR VALIDATION CODE
******************************************************
    IF sy-subrc <> 0.
      ls_msg-msgid = wd_assist->c_msgid.
      ls_msg-msgty = wd_assist->c_msgtype_error.
      ls_msg-msgno = '096'.
      lr_msg_manager->report_attribute_t100_message(
          msg                       = ls_msg
          element                   = <lfs_elem>
          attribute_name            = 'ID'
      ).
      CLEAR ls_msg.
    ENDIF.

Regards

rainer_liebisch
Contributor
0 Kudos

Hello Oliver,

I already answered the question in this thread:

Regards,

Rainer

former_member188831
Contributor
0 Kudos

Hi Rainer in your previuos post you said like

Hello Jörg,

the message area gets the focus automatically if you raise a message. The reason for this is to fulfill the accessibility requirements for blind people. They will be informed about the new raised message because of the focus. Unfortunately there is no workaround for this behaviour, as you can't influence the focus of the message area.

Regards,
Rainer

But what i feel is when we click on error message the focus automatically goes to the particular mandatory field.

there is one possibility to set focus,by calling the message handler link_to_action event/method which is triggering when we clik on message.

this is the standard wdc: WDR_MESSAGE_AREA

hope we shall make use of this component methods/events.

Regards,

Mahesh