cancel
Showing results for 
Search instead for 
Did you mean: 

Loop at UI Elements

Former Member
0 Kudos

Hi Gurus,

I want to loop over all InputFields, check if they are enabled/not read only and empty. If a field is found, the cursor should be set on this field.

In classic abap it is done like this:

loop at screen.

if screen-input eq 1.

assign (screen-name) to <g1>.

if sy-subrc eq 0 and <g1> is initial.

set cursor field screen-name.

exit.

endif.

endif.

endloop.

I already know how can is set the cursor. But how can I do the loop?

Thanks in advance.

BR,

Alfons

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member205703
Participant
0 Kudos

Hi Alfons,

To check if InputField is enable or not you need to do the following coding in the WDDOMODIFYVIEW method of the view which have that UI element.


Data:lr_inp_fld type ref to cl_wd_input_field,
     lv_enable type abap_bool. 

lr_inp_fld ?= view->get_element( ID = 'ID of Input Field' ).

lv_enable = lr_inp_fld->GET_ENABLED( ).

In the same way you can check for other property's of the ui element.

Regard's

Amol

Former Member
0 Kudos

hi,

you can get all the elements in a container in a table

eg lt_table = lo_tray->get_children( ).

this table is a table of cl_wd_uielement

loop over this table where id cs 'INP_'

and you are looping over all your input fields (considering you named all the inputfields

INP_name

there you can perform the requests for attribute value, read_only etc

grtz,

Koen