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 controls questions

Former Member
0 Likes
990

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
956

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.

7 REPLIES 7
Read only

Former Member
0 Likes
956

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

Read only

Former Member
0 Likes
957

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.

Read only

Former Member
0 Likes
956

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

Read only

Former Member
0 Likes
956

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

Read only

Former Member
0 Likes
956

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

Read only

Former Member
0 Likes
956

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

Read only

Former Member
0 Likes
956

Thanks very much all of you, problem solved!