cancel
Showing results for 
Search instead for 
Did you mean: 

set focus in error records

former_member182337
Participant
0 Kudos

Hello,

How can i set the focus on a cell which is an error? I have an alv output and users can add entries into it.IF there is error in one of the cells in the ALV then the save functionality should be stopped and the cell's which are error must be focusssed. I am able to stop from saving but not sure as to how to set the focus on that cell.

Please help.

Thanks,

Prem

Accepted Solutions (1)

Accepted Solutions (1)

chengalarayulu
Active Contributor
0 Kudos

Hi Prem,

It seems to very simple, as per my understanding you might be hitting a button after filling the ALV table. so, just in that button action read the context node which is bound to ALV Data node by using As table operation.

2. Loop that table

3. use get_element method like lo_element = lo_nd_<name>->get_element( index = sy-tabix ).

4. Validate your input field conditions..

5. use REPORT_ATTRIBUTE_ERROR_MESSAGE and provide the attribute name which takes error place.. and export lo_element as ELEMENT.

6. Execute and test.

Hope this would resolve your issue.

former_member182337
Participant
0 Kudos

Thanks.its working.

Answers (3)

Answers (3)

former_member182337
Participant
0 Kudos

Hello Kiran,

I tried the same code but there is no change. The fields are not getting highlighted.

Jana, do you have some example code for it? I searched it online and few posts reagrding set_focus but even then the alv field is not getting highlighted. I also found one another method report_attribute_error_message. Can we use this method as well for this case.

Thanks,

Prem

JanarthananE
Contributor
0 Kudos

Hi,

Did you tried interface method  SET_FOCUS  was introduced in the SALV_WD_TABLE WD ABAP ALV component. This allows you to set the focus to a particular cell in the ALV output.   the focus can be set to a line.

Regards,

Jana

former_member184578
Active Contributor
0 Kudos

Hi,

check this thread http://scn.sap.com/thread/1639949

Hope this helps u.,

Thanks & Regards,

Kiran.