2006 Sep 18 3:58 PM
Hi,
I've searched the forums for an answer, but didn't find something clear enough for me to understand the whole thing (the SAP documentation on this is just foggy).
What I want to know is:
- When I create a Table control in the screen painter without using the Wizzard, how do I link this table control to an internal table of my program? Is putting fields of this internal table into the table control enough?
- How do I know which rows were selected by the user?
Thanks you for your reading and/or answering.
2006 Sep 18 4:05 PM
Hi,
If u see the properties of table there will be a check box w/Selcolumn. Check that check box. Declare a field in the internal table for example "sel type c". Give that field name in the box near to that check box "ITAB-SEL".
In the PAI of the sceen write the code like:
*pai flow logic for tablecontrol 'MPRN'
LOOP AT i_tab.
MODULE tabctrl_modify.
ENDLOOP.
&----
*& Module tabctrl_modify INPUT
&----
text
----
MODULE tabctrl_modify INPUT.
MODIFY i_tab INDEX mprn-current_line
TRANSPORTING mprn post_code dm_ndm sel.
IF sy-subrc EQ 4.
APPEND i_tab.
ENDIF.
ENDMODULE. " tabctrl_modify INPUT
Hope it is helpful.
Regards,
Prakash.
Hi,
I've searched the forums for an answer, but didn't find something clear enough for me to understand the whole thing (the SAP documentation on this is just foggy).
What I want to know is:
- When I create a Table control in the screen painter without using the Wizzard, how do I link this table control to an internal table of my program? Is putting fields of this internal table into the table control enough?
- How do I know which rows were selected by the user?
Thanks you for your reading and/or answering.
2006 Sep 18 4:03 PM
Refer the sample programs:
DEMO_DYNPRO_TABLE_CONTROL_1
DEMO_DYNPRO_TABLE_CONTROL_2
RSDEMO_TABLE_CONTROL
if you haven't done it already.
Regards,
ravi
2006 Sep 18 4:05 PM
Hi,
If u see the properties of table there will be a check box w/Selcolumn. Check that check box. Declare a field in the internal table for example "sel type c". Give that field name in the box near to that check box "ITAB-SEL".
In the PAI of the sceen write the code like:
*pai flow logic for tablecontrol 'MPRN'
LOOP AT i_tab.
MODULE tabctrl_modify.
ENDLOOP.
&----
*& Module tabctrl_modify INPUT
&----
text
----
MODULE tabctrl_modify INPUT.
MODIFY i_tab INDEX mprn-current_line
TRANSPORTING mprn post_code dm_ndm sel.
IF sy-subrc EQ 4.
APPEND i_tab.
ENDIF.
ENDMODULE. " tabctrl_modify INPUT
Hope it is helpful.
Regards,
Prakash.
2006 Sep 18 4:06 PM
Hi,
1) In the flow logic and in the PBO when you do the LOOP AT itab..you can specify the table control name using the WITH addition..
LOOP AT ITAB WITH TC_CONTROL.
...
ENDLOOP.
2) In the table control attributes "Selection col. name" update it with a field name 'SELECTED'.
Update the internal table with the same field 'SELECTED'.
When the user selects the row the table control structure and in the field SELECTED the field will be updated with 'X'..
Thanks,
Naren
2006 Sep 18 4:10 PM
Hi
- You can put the internal table fields or other fields:
a) If you use internal table fields the table control fields are automatically filled while looping it in PBO
PROCESS PBO
LOOP AT ITAB WITH CONTROL .....
ENDLOOP.
b) If you use the fields of other structure u need to create a module to fill the fields of tc:
PROCESS PBO
LOOP AT ITAB WITH CONTROL .....
MODULE SHOW_DATA.
ENDLOOP.
MODULE SHOW_DATA.
FIELD1 = ITAB-FIELD1.
FIELD2 = ITAB-FIELD2.
.....................
FIELDN = ITAB-FIELDN.
ENDMODULE.
- You have to use a MARK field to know which field is selected, or if you need to select only one field u can use the command GET CURSOR
Max
2006 Sep 18 4:11 PM
Hi,
See the Below link for a Program, it is a good example for table controal. the links will show the screen shots also
http://www.planetsap.com/online_pgm_main_page.htm
http://www.sapdevelopment.co.uk/dialog/tabcontrol/tc_basic.htm
Regards
Sudheer
2006 Sep 18 4:17 PM
Hello,
While designing / creating the columns fields for table control , use the options "Get from program" button on the top. Now a dialog box will appear asking you to select the fields from the internal table that you have defined in the report program. You can select the desired fields and click enter.
So automatically the table control gets the value from the internal table when program is executed (in PBO event).
Regs,
Venkat Ramanan N
Message was edited by: Venkat Ramanan Natarajan
2006 Sep 18 4:24 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |