Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Table Control - single cell change attributes

Former Member
0 Likes
2,113

Hi,

I have TC on subscreen and need to change single cell with amount to be able for input data depending status in another field. This can be done in some rows in some not. Field in screen painter is seted on INPUT = 1.

my code looks like this:

PBO:

 loop at it into wa 
    with control tab_ctrl.
    module data_transfer.
    module change_cell.
  endloop.

module change_cell.
  loop at screen.
   if screen-name = 'AMOUNT'.
      if plast = 'X'.
        screen-input = 1.
        screen-output = 1.
        screen-active = 1.
      else.
        screen-input = 0.
        screen-output = 1.
        screen-active = 1.
      endif.
    endif.
    modify screen.
  endloop.

endmodule. 

Where is the problem?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,399

Try this..

PBO:

loop at it into wa

with control tab_ctrl.

module data_transfer.

module change_cell.

endloop.

module change_cell.

loop at screen.

if screen-name = 'AMOUNT'.

if plast = 'X'.

screen-input = 1.

screen-output = 1.

screen-active = 1.

else.

screen-input = 0.

screen-output = 1.

screen-active = 1.

endif.

else.

screen-input = 0.

endif.

modify screen.

endloop.

endmodule.

Try this..

PBO:

loop at it into wa

with control tab_ctrl.

module data_transfer.

module change_cell.

endloop.

module change_cell.

loop at screen.

if screen-name = 'AMOUNT'.

if plast = 'X'.

screen-input = 1.

screen-output = 1.

screen-active = 1.

else.

screen-input = 0.

screen-output = 1.

screen-active = 1.

endif.

else.

screen-input = 0.

endif.

modify screen.

endloop.

endmodule.

7 REPLIES 7
Read only

Former Member
0 Likes
1,399

Hi ... i did changes on your code .... seee the first one i guess you have to padd the excat field name you can see the next code of myin where i pass the field with internal table .

<b>my code of yours</b>


loop at it into wa 
    with control tab_ctrl.
    module data_transfer.
    module change_cell.
  endloop.
 
module change_cell.
  loop at screen.
   if plast = 'X'.
   if screen-name = 'AMOUNT'.
         screen-input = 1.
         modify screen.
      endif.
    endif.

  endloop.
 
endmodule.

<b>my code of sample :</b>

MODULE populate_screen OUTPUT.
    DATA: ld_line TYPE i.
  
*   Set which line of itab is at the top of the table control
    IF sy-stepl = 1.
      tc100-lines =
        tc100-top_line + sy-loopc - 1.
    ENDIF.
  
*   move fields from work area to scrren fields
    MOVE-CORRESPONDING wa_ekko TO ztc_ekko.
  
    ld_line =  sy-stepl + tc100-top_line - 1.
  
*   Changes individual field attributes of table control,
*   Sets EBELN field on 3rd row of TC to not be an input field!
    LOOP AT SCREEN.
      IF ld_line EQ 3.
        IF screen-name EQ 'ZTC_EKKO-EBELN'.
          screen-input = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDIF.
    ENDLOOP.
  ENDMODULE.                 " populate_screen  OUTPUT

reward points if it is usefull .....

Girish

Read only

Former Member
0 Likes
1,400

Try this..

PBO:

loop at it into wa

with control tab_ctrl.

module data_transfer.

module change_cell.

endloop.

module change_cell.

loop at screen.

if screen-name = 'AMOUNT'.

if plast = 'X'.

screen-input = 1.

screen-output = 1.

screen-active = 1.

else.

screen-input = 0.

screen-output = 1.

screen-active = 1.

endif.

else.

screen-input = 0.

endif.

modify screen.

endloop.

endmodule.

Read only

0 Likes
1,399

not working/helping

Read only

0 Likes
1,399

In a table control, you cannot make a single cell or row read_only or editable. If you do screen-input = 1/0 it will work at the entire column level. For this requirement, use an ALV it will work.

Regards,

Nithya

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,399

Hi,

If you know line no.,here is the sample code.

MODULE set_screen_fields OUTPUT.

LOOP AT SCREEN.

IF flg IS INITIAL.

screen-input = 0.

ELSEIF ( flg EQ 'Y' ).

IF ( ( screen-name = 'I_MAKT-ZMAKTX'

OR screen-name = 'I_MAKT-CHECK1' )

AND t_ctrl-current_line LE ln ) .

  • Making the screen fields as editable

screen-input = 1.

ELSEIF ( ( screen-name = 'I_MAKT-ZMATNR' )

AND t_ctrl-current_line LE ln ).

  • Making the screen field as uneditable

screen-input = 0.

ENDIF.

ENDIF.

  • Modifying the screen after making changes

MODIFY SCREEN.

ENDLOOP.

ENDMODULE. " set_screen_fields OUTPUT

Read only

Former Member
0 Likes
1,399

solved, i deactivated some perform which always sets my field to be only output....sorry

Read only

former_member491305
Active Contributor
0 Likes
1,399

Hi,

Change it like this.I think the screen name for AMOUNT field of table control is

WA-AMOUNT.In Loop at screen ,you got to pass the full name of the field.And this <b>plast</b> field also should be one of the field in that itab structure.What you can

Chk out corrected code.

PBO:

loop at it into wa

with control tab_ctrl.

module data_transfer.

module change_cell.

endloop.

module change_cell.

loop at screen.

if screen-name = 'WA-AMOUNT'.

<b> If WA-PLAST = 'X'.</b>

screen-input = 1.

screen-output = 1.

screen-active = 1.

else.

screen-input = 0.

screen-output = 1.

screen-active = 1.

endif.

endif.

modify screen.

endloop.

endmodule.