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 with both Editable and non Editable fields

Former Member
0 Likes
4,566

Transaction is in change mode for Custom Development.

Requirement : Data is fetched from Database and needs to be shown in Table control with few columns as editable and few columns as non editable.Also when we press insert button a new blank row should be inserted with all its columns as editable.

Can anyone please let me know how we can do it.

Kind Regards

Sajid

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,353

go for table control with wizard......here u will get all functionality(insert delete etc...)

for enabling and disabling .....use loop at screen.

modify screen.

endloop.

with in the loop in PBO of flow logic...

loop at itab.

module enable_disable.

endloop.

in driver program

module enable_disable.

endmodule...

3 REPLIES 3
Read only

Former Member
0 Likes
1,354

go for table control with wizard......here u will get all functionality(insert delete etc...)

for enabling and disabling .....use loop at screen.

modify screen.

endloop.

with in the loop in PBO of flow logic...

loop at itab.

module enable_disable.

endloop.

in driver program

module enable_disable.

endmodule...

Read only

Former Member
0 Likes
1,353

The answer to my question is:

*" screen flow PBO

loop at gt_data1 into gs_data1 with control gtc_9999.

module d9999_modify_screen_tc.

endloop.

  • PBO module

module d9999_modify_screen_tc output.

check gs_data1-XYZ = 'demo'. "condition

loop at screen. "for current row of TC

if screen-name = 'XYZ'. "for one cell

screen-active = '0'.

screen-intensified = '1'. "or whatever

endif.

modify screen.

endloop.

endmodule.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,353

Hi Sajid,

To make certain fields as editable and some as non-editable, you can follow any one of the below two approaches:-

1. Either while designing the module pool screen keep those textbox fields as output only which need not be edited and rest textbox fields as input & output both.

2. If you want enable/disable input for textbox fields while execution, then while designing the screen, the textbox fields which need to be non-editable define the group1 as ABC for those fields. Now, In PBO of the screen, write code:-


loop at screen.
  if ( screen-group1 = 'ABC' ).
    screen-input = 0. "disable textbox for input
    screen-active = 0.
  endif.
  modify screen.
endloop.

loop at screen.
  if ( screen-group1 = 'ABC' ).
    screen-input = 1. "enable textbox for input
    screen-active = 1.
  endif.
  modify screen.
endloop.

The number of lines in table control depends on the size of table control on screen.

If number of lines in table control are same as the number of records in the internal table, then to insert a new row when user clicks INSERT button, then use code:-


case sy-ucomm.
  when 'INSERT'.
    tab_ctrl-lines = tab_ctrl-lines + 1. "to insert a new line into table control tab_ctrl
    loop at screen.
      if ( screen-group1 = 'ABC' ).
        screen-input = 1. "enable textbox for input
        screen-active = 1.
      endif.
      modify screen.
    endloop.
endcase.

It is not possible to enable only one row when you click INSERT button, rather it will enable the all fields for all lines in table control.

We can only enable/disable columns in a table control.

So, if you want not to show the existing records when you click INSERT button then use a new table control to insert new records.

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir