on 05-10-2010 3:14 PM
Hi gurus,
I'm trying to check input values of an ALV. When check is not true the WDA have to throw a message for each element that doesn't pass the check. What I want to do:
LOOP AT data_modified.
if check = FALSE.
lo_element = get_element( ).
lo_message_manager->report_attribute_t100_message( msg = ls_msg
element = lo_element
attribute_name = FIELD.
endif.
ENDLOOP.
For example, if user puts three incorrect values I want to throw just three messages, and not six...
Any idea to avoid duplicates?
Thank you
Edited by: vanbelal on May 10, 2010 4:14 PM
I will assume you can write your own code to aggregrate the errors/attributes in error per element...
then you can use the
REPORT_ELEMENT_T100_MESSAGE
method in which you can pass a parameter "ATTRIBUTES" which is a list of the attributes of the element that you want to highlight.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chris,
Thank you for the answer. I've tried use this method, I get the three cells highlighted correctly but in the message area are appearing messages duplicates (or triplicate), and I want to show only three messages, corresponding to the three elements the user has been typed wrongly.
I put my source code for more info:
DATA lo_node TYPE REF TO if_wd_context_node.
DATA lo_element TYPE REF TO if_wd_context_element.
DATA ls_node TYPE wd_this->element_n_empleado.
DATA ls_empleado TYPE zhr_wd_s_detalle.
DATA ls_msg TYPE symsg.
DATA lt_attributes TYPE string_table.
DATA ls_attributes TYPE string.
get message manager
DATA lo_api_controller TYPE REF TO if_wd_controller.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
navigate from <CONTEXT> to <N_EMPLEADO> via lead selection
lo_node = wd_context->get_child_node( name = wd_this->wdctx_n_empleado ).
IF element IS INITIAL.
get element via lead selection
lo_element = lo_node->get_element( index = index ).
ELSE.
lo_element = element.
ENDIF.
get all declared attributes
lo_element->get_static_attributes(
IMPORTING
static_attributes = ls_empleado ).
IF value LT ls_empleado-incsu.
wd_comp_controller->get_message_manager( ).
ls_msg-msgid = 'ZHR_CM'.
ls_msg-msgty = 'E'.
ls_msg-msgno = '634'.
ls_attributes = 'INCAC'.
APPEND ls_attributes TO lt_attributes.
CALL METHOD wd_comp_controller->go_message->report_element_t100_message
EXPORTING
msg = ls_msg
element = lo_element
attributes = lt_attributes.
ENDIF.
Thank you for your help
Hello,
I don't get you very well Chris.
I'm calling method once per element( inside a loop passing element that doesn't pass the check ), and I want to highlight just one attribute (one input field) per element. I don't understand why I have to put all attributes. As I said previosly, input field has been highlighted fine for each element but a lot of messages are appearing on the message area, and I want to show just one message per element.
Thanks!
Edited by: vanbelal on May 11, 2010 9:13 AM
>
> Sorry - I had thought you were highlighting multiple attributes per element...
>
> if you are finding that the same message for the same element and attribute is being shown multiple times - check how often the method raising the method is being called.
No problem Chris,
I'm completely sure that I'm calling method once per error that I find during the process. It has no sense. I've tried ALL methods to throw messages using pattern and occurs the same!
REPORT_ATTRIBUTE_MESSAGE
REPORT_ELEMENT_T100_MESSAGE
REPORT_ATTRIBUTE_ERROR_MESSAGE
REPORT_ELEMENT_ERROR_MESSAGES
I'm frustrated!
thx!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vanbelal,
Check the below code.
data_modified1[] = data_modified[].
LOOP AT data_modified1.
read table data_modified into wa_data_modified with key <from data_modified1>.
if check = FALSE.
lo_element = lo_node->get_element( index = sy-tabix ).
* lo_element = get_element( ).
lo_message_manager->report_attribute_t100_message( msg = ls_msg
element = lo_element
attribute_name = FIELD.
endif.
ENDLOOP.
Regards,
-Syed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have the exact same strange behaviour. Im quite sure, that this is an Bug in SAP.
I think it only appears when using ALVs in combination with report_message.
And besides, I am also very frustrated about it.
Maybe writing an OSS note would be senseful...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Before passing the message to message manager,
Get all messages.
DESCRIBE TABLE e_messages LINES lv_lines.
Delete the dulplicate messages .
" Delete duplicate messages from the table
SORT e_messages ASCENDING.
DELETE ADJACENT DUPLICATES FROM e_messages .
READ TABLE e_messages INDEX lv_index ASSIGNING <fs_msg>.
l_message_text = <fs_msg>-message.
CALL METHOD mr_message_manager->report_t100_message
EXPORTING
msgid = <fs_msg>-msgid
msgno = <fs_msg>-msgnumber
msgty = <fs_msg>-msgtype
p1 = <fs_msg>-message_v1
p2 = <fs_msg>-message_v2
p3 = <fs_msg>-message_v3
p4 = <fs_msg>-message_v4
view = l_view.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.