Application Development 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: 

About table control

Former Member
0 Kudos

Hi all,

I have create a report program, and I call a screen in it:

AT SELECTION-SCREEN.

CALL SCREEN 100.

In the screen 100, I create a table control.

PROCESS BEFORE OUTPUT.

MODULE get_data. " Get data to table it_tab

LOOP AT it_tab TO wa_tab WITH CONTROL tc_ctrl.

MODULE populate_screen.

ENDLOOP.

MODULE populate_screen OUTPUT.

DATA: ld_line TYPE i.

IF sy-stepl = 1.

tc_ctrl-lines = tc_ctrl-top_line + sy-loopc - 1.

ENDIF.

MOVE-CORRESPONDING wa_tab TO ztc_tab.

ENDMODULE. " populate_screen OUTPUT

ztc_tab is the table I used in the table control, but when I check the screen, there is an error message 'The field 'ZTC_TAB-SEL' is not assigned to a loop. 'LOOP...ENDLOOP' must appear in 'PBO' and 'PAI''. I don't know why, can anyone tell me ? Many thanks!

1 ACCEPTED SOLUTION

former_member189629
Active Contributor
0 Kudos

Yu,

First in Screen 100, create a table control and add the fields you need to display in it. Better avoid the wizard.

Second, populate it using the stx:

PROCESS BEFORE OUTPUT.

MODULE get_data. " Get data to table it_tab

  • The below code will set the number of lines to display based on your itab lines DESCRIBE TABLE it_tab LINES tc_ctrl-lines.

  • Use the below code to populate the table control

loop at it_tab into it_tab with control tc_ctrl.

endloop.

This should help. Reward if useful...

Karthik

6 REPLIES 6

Former Member
0 Kudos

Hi Yu,

Did you create the table control using a wizard?

If not try creating it with the wizard.

Thanks and Reagrds,

Ravi

0 Kudos

I create it without a wizard.

Former Member
0 Kudos

hello yu_huali,

You has to loop the table which u had used in the table control.

see the below code.

***IN PBO

loop at ztc_tab

with control tc_ctrl

cursor tc_ctrl-current_line.

endloop.

***IN PAI

loop at ztc_tab.

chain.

field ztc_tab-fieldname

**all the fields that you are displaying in the table control in the ztc_tab must be in chain & endchain

endchain.

Reward if useful.

Regards,

Phani.

Message was edited by:

phani kiran bondada

0 Kudos

You mean I assign it_tab[] to ztc_tab[] first, then loop at ztc_tab?

what should I do in the loop?

loop at ztc_tab

with control tc_ctrl

cursor tc_ctrl-current_line.

endloop.

Former Member
0 Kudos

what is the SEL FIELD IN UR TABLE....

former_member189629
Active Contributor
0 Kudos

Yu,

First in Screen 100, create a table control and add the fields you need to display in it. Better avoid the wizard.

Second, populate it using the stx:

PROCESS BEFORE OUTPUT.

MODULE get_data. " Get data to table it_tab

  • The below code will set the number of lines to display based on your itab lines DESCRIBE TABLE it_tab LINES tc_ctrl-lines.

  • Use the below code to populate the table control

loop at it_tab into it_tab with control tc_ctrl.

endloop.

This should help. Reward if useful...

Karthik