08-21-2011 6:04 PM
Hi Gurus,
I want to change the screen element of a single field (or the whole row) in a table control according to a condition.
I have 2 columns in the table control. One is an input column and one output only. When user enters values into the input column, they need to be compared against the values in the other column, and if there is a discrepancy, the row where the discrepancy is needs to be highlighted.
I have tried the following code which highlights the whole column ...
CONTROLS: TC_ZVOYG_BINS TYPE TABLEVIEW USING SCREEN 0500.
DATA: wa_tc_zvoyg_col LIKE LINE OF TC_ZVOYG_BINS-cols.
LOOP AT G_TC_ZVOYG_BINS_ITAB
INTO G_TC_ZVOYG_BINS_WA.
if G_TC_ZVOYG_BINS_WA-zdelivery_bin ne G_TC_ZVOYG_BINS_WA-zactual_bin.
loop at screen.
IF screen-name = 'ZVOYG_BINS-ZACTUAL_BIN'.
wa_tc_zvoyg_col-screen-intensified = 1.
MODIFY tc_zvoyg_bins-cols FROM wa_tc_zvoyg_col TRANSPORTING
screen-intensified WHERE screen-name = screen-name.
endif.
endloop.
endif.
endloop.
And also the following code which makes no change ...
LOOP AT G_TC_ZVOYG_BINS_ITAB
INTO G_TC_ZVOYG_BINS_WA.
if G_TC_ZVOYG_BINS_WA-zdelivery_bin ne G_TC_ZVOYG_BINS_WA-zactual_bin.
loop at screen.
IF screen-name = 'ZVOYG_BINS-ZACTUAL_BIN'.
screen-intensified = '1'.
modify screen.
endif.
endloop.
endif.
endloop.
Thanks in advance.
08-21-2011 7:45 PM
Hi,
The modification of a screen element attribute (LOOP AT SCREEN...MODIFY SCREEN) must always be done in the PBO (for a dynpro, it will be in a PBO module, i.e. declared by MODULE ... OUTPUT)
About the loop at the internal table, it is done automatically by the system, also during the PBO, you'll find something like LOOP [AT itab] ... WITH CONTROL ... in the PBO part of the screen flow logic (note: you may have to complete with a supplementary READ TABLE if you don't use AT itab). So you don't need an additional loop.
Best regards
Sandra
08-21-2011 7:45 PM
Hi,
The modification of a screen element attribute (LOOP AT SCREEN...MODIFY SCREEN) must always be done in the PBO (for a dynpro, it will be in a PBO module, i.e. declared by MODULE ... OUTPUT)
About the loop at the internal table, it is done automatically by the system, also during the PBO, you'll find something like LOOP [AT itab] ... WITH CONTROL ... in the PBO part of the screen flow logic (note: you may have to complete with a supplementary READ TABLE if you don't use AT itab). So you don't need an additional loop.
Best regards
Sandra