cancel
Showing results for 
Search instead for 
Did you mean: 

Duplicate messages using report_attribute_t100_message

former_member189690
Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

ChrisPaine
Active Contributor
0 Kudos

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.

former_member189690
Participant
0 Kudos

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

ChrisPaine
Active Contributor
0 Kudos

Hi,

you need to aggregate your errors for a given element - the message manager will not do this for you.

only call the method once per element - but with the three attributes specified.

former_member189690
Participant
0 Kudos

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

ChrisPaine
Active Contributor
0 Kudos

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.

former_member189690
Participant
0 Kudos

>

> 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!

Former Member
0 Kudos

All the method you use is the same.so do not wast your time on this.

If you embedded a view in the main view, maybe this is the point.

Let me know if this can help you, otherwise, I can give you some more help

Answers (4)

Answers (4)

former_member189690
Participant
0 Kudos

thx!

Former Member
0 Kudos

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.

Former Member
0 Kudos

Syed, why do you think this should avoid the duplicate messages? Thats the problem he is talking about - and as I already said I have the exact same problem. Hope to find solution in OSS Note, our system is 701 005

Former Member
0 Kudos

YES! I found the solution in SAP OSS Note 1160988

Former Member
0 Kudos

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...

Former Member
0 Kudos

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.