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- Make particular rows editable

Former Member
0 Likes
2,825

Hi All,

My requirement is as below:

In my screen I have a table control. Initially all the rows are non editable( All are initial).

Now when I click a button 'Add a line' only the first line should be editable ( So that user can enter data). If click the button 'Add a line' again then one more line should be editable(Now two lines are editable and if user has entered any data in the first line that should be displayed) and so on.

How to achieve this?

Regards,

Manoj kumar P

1 ACCEPTED SOLUTION
Read only

former_member784222
Active Participant
0 Likes
1,623

Hi Manoj,

1. Have a flag field in your internal table which identifies a row as newly added.

2. When the user presses 'Add', append a dummy line in the internal table with the flag field value 'X'.

3. In PBO, inside the LOOP, ENDLOOP, you need to insert a MODULE, which will make all fields in table control row enabled for which the flag field value 'X'.

Hope this helps.

For better solution and understanding, you can try to debug simple standard SAP transaction which has a table control.

Thanks and regards,

S. Chandramouli.

8 REPLIES 8
Read only

Former Member
0 Likes
1,623

When you click the button to add a line, increment the field TC-LINES by 1.

TC-LINES = TC-LINES + 1.

where TC is your table control.

one line will be added in editable mode.

regards,

Jinson

Read only

0 Likes
1,623

Hi Jinson,

When I use the statement 'TC-LINES = TC-LINES + 1' it is adding a line to the table control but

that is non editable. I want that to be editable...

Regards,

Manoj Kumar P

Read only

0 Likes
1,623

>

> Hi Jinson,

> When I use the statement 'TC-LINES = TC-LINES + 1' it is adding a line to the table control but

> that is non editable. I want that to be editable...

>

>

> Regards,

> Manoj Kumar P

Write it in the PBO.

You can have a flag var and update it whenever the ADD button is pressed.

And in PBO if that flag is set, add 1 to TC-LINES, and clear the add flag.

regards,

Jinson

Read only

former_member784222
Active Participant
0 Likes
1,624

Hi Manoj,

1. Have a flag field in your internal table which identifies a row as newly added.

2. When the user presses 'Add', append a dummy line in the internal table with the flag field value 'X'.

3. In PBO, inside the LOOP, ENDLOOP, you need to insert a MODULE, which will make all fields in table control row enabled for which the flag field value 'X'.

Hope this helps.

For better solution and understanding, you can try to debug simple standard SAP transaction which has a table control.

Thanks and regards,

S. Chandramouli.

Read only

0 Likes
1,623

Hi,

Thanks for the input.

As you have mentioned I have created a flag and it is set for newly added line.

Now how can I make the particular row editable (ie. how to make screen input as 1) when the flag is set?

Regards,

Manoj Kumar P

Read only

0 Likes
1,623

>

> Hi,

> Thanks for the input.

> As you have mentioned I have created a flag and it is set for newly added line.

> Now how can I make the particular row editable (ie. how to make screen input as 1) when the flag is set?

>

>

> Regards,

> Manoj Kumar P

Have a look at program DEMO_DYNPRO_TABCONT_LOOP_AT.

Also check [;

regards,

Jinson

Read only

0 Likes
1,623

In PBO, inside loop at internal table using table_control, introduce a module.

Loop at internal_table using tc.

Module make_input.

endloop.

In your includes for PBO.

Module make_input.

loop at screen.

if internal_table-flag = 'X'.

screen-input = 1.

modify screen.

endif.

endloop.

endmodule.

regards,

S. Chandramouli.

Read only

0 Likes
1,623

Hi Chandramouli,

Thanks a lot.

I used

LOOP AT itab WITH CONTROL tctrl.
  Module make_input.
 ENDLOOP.

Regards,

Manoj Kumar P