cancel
Showing results for 
Search instead for 
Did you mean: 

error message in a table (not ALV)

davidwallner
Participant
0 Kudos

Hi there,

i know that in ALV an error-message appears and the cell is marked if an user puts a not allowed value in the cell.

Now i want to achieve the same in my non-alv-table. If a user enters a value in a specific cell, i want to output a message and mark the specific cell as "wrong". Can anyone provide me with a code-example?

Best regards

David

Accepted Solutions (1)

Accepted Solutions (1)

Madhu2004
Active Contributor
0 Kudos

HI,

Even in table cell if a value is entered that is not permitted ,system issues an error message and highlights the cell after some action is performed.

Case1: Suppose you enter a character value in date field and perform some action system performs the checks, issues an error message an higlights the cell.

Case 2: If validation of the entered value needs to be done programatically after an action is performed the use the below logici in the WDOBEFOREACTION method.

a) Get the node binded to the table( lo_node = wd_context->get_child_node('Node Name").
b) Using the node reference get alll the elements using the method GET_ELEMENTS of IF_WD_CONTEXT_NODE i.e lo_node.
c) Now loop at list of elements and for each element use the method GET_STATIC_ATTRIBUTES to get the attribute values
d) Do the required validation if some error is found use REPORT_ATTRIBUTE_ERROR_MESSAGE using the attribute name and element refernece.

Hope this helps.

Regards,

Madhu.

Answers (1)

Answers (1)

ChrisPaine
Active Contributor
0 Kudos

Hi David,

As mentioned the methods of the message manager that mention "attribute" do allow you to highlight a given field.

There are multiple of these:

REPORT_ATTRIBUTE_ERROR_MESSAGE

REPORT_ATTRIBUTE_EXCEPTION

REPORT_ATTRIBUTE_T100_MESSAGE

REPORT_ATTRIBUTE_MESSAGE

NB that you can even report multiple attributes of the same element using the

REPORT_ELEMENT_EXCEPTION

REPORT_ELEMENT_T100_MESSAGE

REPORT_ELEMENT_ERROR_MESSAGE

Do be aware however that you will have issues highlighting drop-down by index UI elements using any of these methods. (it certainly hasn't worked for me in the past) the problem being that these UI elements are not really bound to any element or attribute, but a node... I'm keeping my fingers crossed for some sort of solution in NW7.02 when it finally gets to us.

Chris