2006 May 24 8:51 PM
Could someone tell me how to change the attributes of a field (not the whole column, but only one 'cell'). Using 'LOOP WITH CONTROL' in the PBO doesn't work.
module fill_table_control_0100 output.
read table gt_open_pernr into gs_open_pernr
index co_lkout_open-current_line.
if gs_open_pernr-status_txt = 'Locked'.
loop at co_lkout_open-cols into gs_cols where index = 5.
gs_cols-screen-input = '0'.
modify co_lkout_open-cols from gs_cols index sy-tabix.
endloop.
endif.
endmodule. "fill_table_control_0100 OUTPUT
The field in that row is still editable.
2006 May 24 8:57 PM
Hopefully you used the table control wizard, if so you should see something simular to this in your screen flow logic. Notice the MODULE in BOLD, it is inside the LOOP. You will need to implement this module in your program. If it is commented, uncomment it and double click it, system will ask if you want to create it, say yes.
PROCESS BEFORE OUTPUT.
* PBO FLOW LOGIC FOR TABLECONTROL 'I_WOODCAPCON'
* MODULE I_WOODCAPCON_CHANGE_TC_ATTR.
* MODULE I_WOODCAPCON_CHANGE_COL_ATTR.
LOOP AT I_WOODCAP
WITH CONTROL I_WOODCAPCON
CURSOR I_WOODCAPCON-CURRENT_LINE.
<b> MODULE I_WOODCAPCON_CHANGE_FIELD_ATTR.</b>
ENDLOOP.
MODULE STATUS_0300.
MODULE SET_CURSOR_FIELD.
Now here is the code that will allow you to change the attributes of the field of that line of the table control.
************************************************************************
* Module I_WOODCAPCON_CHANGE_FIELD_ATTR OUTPUT
************************************************************************
module i_woodcapcon_change_field_attr output.
modify i_woodcap index i_woodcapcon-current_line.
loop at screen.
if i_woodcap-level = 'B'
and ( screen-name = 'I_WOODCAP-PDATE'
or screen-name = 'I_WOODCAP-PLANT' ).
screen-invisible = '1'.
endif.
if i_woodcap-level = 'C'
and ( screen-name = 'I_WOODCAP-PDATE'
or screen-name = 'I_WOODCAP-PLANT'
or screen-name = 'I_WOODCAP-LDTIMX' ).
screen-invisible = '1'.
elseif i_woodcap-level = 'C'
and sy-tcode = 'ZWDCP02'
and screen-name = 'I_WOODCAP-PLNQTY'.
screen-input = '1'.
elseif i_woodcap-level = 'C'
and i_woodcap-parmtype = 'A'
and ( screen-name = 'I_WOODCAP-ACTQTY'
or screen-name = 'I_WOODCAP-OPNQTY' ).
screen-invisible = '1'.
endif.
modify screen.
endloop.
endmodule.
This is taken directly from a program that I wrote where I had to turn some cells off depending on certain criteria.
Regards,
Rich Heilman
2006 May 24 8:57 PM
Hopefully you used the table control wizard, if so you should see something simular to this in your screen flow logic. Notice the MODULE in BOLD, it is inside the LOOP. You will need to implement this module in your program. If it is commented, uncomment it and double click it, system will ask if you want to create it, say yes.
PROCESS BEFORE OUTPUT.
* PBO FLOW LOGIC FOR TABLECONTROL 'I_WOODCAPCON'
* MODULE I_WOODCAPCON_CHANGE_TC_ATTR.
* MODULE I_WOODCAPCON_CHANGE_COL_ATTR.
LOOP AT I_WOODCAP
WITH CONTROL I_WOODCAPCON
CURSOR I_WOODCAPCON-CURRENT_LINE.
<b> MODULE I_WOODCAPCON_CHANGE_FIELD_ATTR.</b>
ENDLOOP.
MODULE STATUS_0300.
MODULE SET_CURSOR_FIELD.
Now here is the code that will allow you to change the attributes of the field of that line of the table control.
************************************************************************
* Module I_WOODCAPCON_CHANGE_FIELD_ATTR OUTPUT
************************************************************************
module i_woodcapcon_change_field_attr output.
modify i_woodcap index i_woodcapcon-current_line.
loop at screen.
if i_woodcap-level = 'B'
and ( screen-name = 'I_WOODCAP-PDATE'
or screen-name = 'I_WOODCAP-PLANT' ).
screen-invisible = '1'.
endif.
if i_woodcap-level = 'C'
and ( screen-name = 'I_WOODCAP-PDATE'
or screen-name = 'I_WOODCAP-PLANT'
or screen-name = 'I_WOODCAP-LDTIMX' ).
screen-invisible = '1'.
elseif i_woodcap-level = 'C'
and sy-tcode = 'ZWDCP02'
and screen-name = 'I_WOODCAP-PLNQTY'.
screen-input = '1'.
elseif i_woodcap-level = 'C'
and i_woodcap-parmtype = 'A'
and ( screen-name = 'I_WOODCAP-ACTQTY'
or screen-name = 'I_WOODCAP-OPNQTY' ).
screen-invisible = '1'.
endif.
modify screen.
endloop.
endmodule.
This is taken directly from a program that I wrote where I had to turn some cells off depending on certain criteria.
Regards,
Rich Heilman
2006 May 24 9:23 PM
hi,
Yes, I think the statement 'MODIFY SCREEN' is the key which you can't substitute.