cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with focus after raising an error message

Former Member
0 Kudos

Hello experts,

we have a problem with one of our WD applications.

In one view, there is an input field which is focused via method WDDOINIT:


lr_inp_field type ref to cl_wd_input_field.
lr_inp_field ?= view->get_element( 'MATNR' ).
lr_inp_field->focus( ).

It works so far, but if we show a message, because there is an error in backgroud processing, the message is shown, but the meant input field loose the focus. I tried to ste it in WDDOINIT and ind WDDOMODIFYVIEW, but the focus is always on the shown error message (we raise this message via if_wd_message_manager).

Is there any possibility to show the message and get focus on the input field?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Which method of messenger class have you used?

If you have used report_attribute_errror_message then you could have got the focus on Input field automatically by passing the MATNR as attirbute name.

I think you might have used report_error_message .

Regards,

Lekha.

Former Member
0 Kudos

Hello,

exactly we used:

REPORT_WARNING

REPORT_SUCCESS

REPORT_ERROR_MESSAGE

We can use REPORT_ATTRIBUTE_ERROR_MESSAGE for the error message, but what can we use for warning or sucess? Or can i change the message icon also via this method?

Is there any sample application?

arjun_thakur
Active Contributor
0 Kudos

Hi Benjamin,

Try using REPORT_ATTRIBUTE_MESSAGE to display the messages. Also refer the standard component: WDR_TEST_MSG_MANAGER_00.

I hope it helps.

Regards

Arjun

Former Member
0 Kudos

Hello Arjun Thakur,

i tried your solution using method REPORT_ATTRIBUTE_MESSAGE, but this method doesnt exist in interface IF_WD_MESSAGE_MANAGER, i´ll try to find a solution by studiing WD-component wdr_test_msg_manager_00.

arjun_thakur
Active Contributor
0 Kudos

Hi Benjamin,

REPORT_ATTRIBUTE_MESSAGE method does exist in interface IF_WD_MESSAGE_MANAGER. Try to search it again.

Regards

Arjun

Former Member
0 Kudos

Hello,

no it does not. In our system the interface hast the following methods:

REPORT_EXCEPTION

REPORT_SUCCESS

REPORT_WARNING

REPORT_ERROR_MESSAGE

REPORT_T100_MESSAGE

REPORT_FATAL_EXCEPTION

REPORT_FATAL_ERROR_MESSAGE

REPORT_ATTRIBUTE_ERROR_MESSAGE

REPORT_ATTRIBUTE_EXCEPTION

REPORT_ATTRIBUTE_T100_MESSAGE

REPORT_ELEMENT_ERROR_MESSAGE

REPORT_ELEMENT_EXCEPTION

REPORT_ELEMENT_T100_MESSAGE

IS_EMPTY

CLEAR_MESSAGES

HAS_VAL_ERRORS_FOR_WINDOW

REMOVE_MESSAGE

GET_MESSAGES

HAS_VALIDATION_ERRORS

RAISE_EXCEPTION

RAISE_ATTRIBUTE_EXCEPTION

RAISE_ERROR_MESSAGE

RAISE_T100_ERROR

RAISE_FATAL_EXCEPTION

RAISE_FATAL_ERROR_MESSAGE

I solved the problem by adding an extra textview in the dynpro. In onmodify i read the messages via GET_MESSAGES, make a decission if the message is an error or not, and if it is one i set the visibility of my textview "true" and write the text into it. After that i clear the messages via CLEAR_MESSAGES.

It looks not like the original, but it works, and the focus is set correctly into my input field.

Thanks for your help

Answers (1)

Answers (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Benjamin,

As per what I know I think that its SAP's standard functionality to have the focus set on any error messages that get thrown. Trying to explicitly set the focus to something else wouldn't work out. Lets see as to what the experts have to say about this.

Regards,

Uday