Skip to Content

How to put focus on a cell in ALV table for error handling?

Hi Experts,

I have a webdynpro ALV report. In the ALV table there is a column ROUTECODE which is editable.

If there are 5 rows in the ALV table and user changes the field ROUTECODE of the second row and press enter button.

Then if the entered value is invalid, how to put focus on that cell ( field ROUTECODE of second row) with error message?

I have tried the sample code below but got stuck.

lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.

* report message
CALL METHOD lo_message_manager->report_attribute_error_message(
EXPORTING
message_text = lv_error
element = <-- Here how to get reference of the context element ( field ROUTECODE of second row) ?
attribute_name = 'ROUTECODE' ).

Thanks

Gopal

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Sep 24, 2013 at 10:36 AM

    Hi,

    To get the reference of 2nd row use the below code.

    lo_el_<NODE> = lo_nd_<NODE>->get_element( index = 2 ).

    For error handling you can simply loop the internal table and and validate the field and display error.

    EX:

    LOOP AT lt_flight INTO ls_flight.

    * Do Validation

    if error.

    lo_el_flight = lo_nd_flight->get_element( index = sy-tabix ).

    Display error

    endif.

    ENDLOOP.

    Hope this helps u.,

    Regards,

    Kiran

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.