‎2009 Jan 13 1:27 PM
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
‎2009 Jan 13 1:38 PM
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.
‎2009 Jan 13 1:31 PM
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
‎2009 Jan 13 1:47 PM
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
‎2009 Jan 13 1:53 PM
>
> 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
‎2009 Jan 13 1:38 PM
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.
‎2009 Jan 13 1:59 PM
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
‎2009 Jan 13 2:10 PM
>
> 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.
regards,
Jinson
‎2009 Jan 13 2:13 PM
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.
‎2009 Jan 15 8:14 AM
Hi Chandramouli,
Thanks a lot.
I used
LOOP AT itab WITH CONTROL tctrl.
Module make_input.
ENDLOOP.Regards,
Manoj Kumar P