09-11-2007 10:38 AM
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!
09-11-2007 10:55 AM
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
09-11-2007 10:43 AM
Hi Yu,
Did you create the table control using a wizard?
If not try creating it with the wizard.
Thanks and Reagrds,
Ravi
09-11-2007 11:16 AM
09-11-2007 10:49 AM
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
09-11-2007 11:13 AM
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.
09-11-2007 10:52 AM
09-11-2007 10:55 AM
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