09-03-2008 9:50 PM
Hi,
I have a table contol in my module pool program. In my processing I am filling an internal table & then in my PBO I am linking the internal table to table control. The issue is that even though the internal table is getting filled correctly (found through debugging), the data is not getting populated in table control. Nothing is populated on screen. I am writing part of code below
Declaration:
Types: begin of ty_control,
SELECTED TYPE C,
TEXT TYPE DPR_CAUSE_T-TEXT,
end of ty_control.
CONTROLS : TBL_CONT TYPE TABLEVIEW USING SCREEN '9001'.
DATA: lt_table_cont type TABLE OF ty_control with header line.
Fields in TBL_CONT:
TBL_CONT-SELECTED
TBL_CONT-TEXT
PBO Flow Logic:
MODULE STATUS_9001.
MODULE fill_data.
LOOP AT lt_table_cont WITH CONTROL TBL_CONT cursor TBL_CONT-top_line.
ENDLOOP.
PAI Flow Logic:
Loop at lt_table_cont.
MODULE UPDATE_DATA.
endloop.
MODULE USER_COMMAND_9001.
PLZ let me know what might be the problem. I have been trying to figure out but cant.
Thanks.
09-04-2008 5:26 AM
Hi,
Please check, whether the table control column name and the internal table field names are same.
Sharin.
09-03-2008 9:53 PM
Hi SOnali
Instead of using
cursor TBL_CONT-top_line
try cursor TBL_CONT-current_line
rgds
Sameer
09-03-2008 10:33 PM
Hi Sameer,
I tried as you mentioned but even that has not helped. No data is getting populated.
Regards,
Sonali.
09-04-2008 5:12 AM
hi,
try adding the module for fill_data inside the loop in the PBO..
Regards,
09-04-2008 5:26 AM
Hi,
Please check, whether the table control column name and the internal table field names are same.
Sharin.
09-04-2008 5:48 AM
Hi Sonali,
When ever you need to do anything with the table control, i mean if u want to display data in table control or you want to validate the data entered in table control Should be done within Loop and Endloop.(PBO or PAI's which ever is appropriate)
Here the data is not bieng displayed in ur table control because you have not used the MODULE fill_data between
LOOP AT lt_table_cont WITH CONTROL TBL_CONT cursor TBL_CONT-top_line.
ENDLOOP.
****************************************
so do it like this
LOOP AT lt_table_cont WITH CONTROL TBL_CONT cursor TBL_CONT-top_line.
MODULE fill_data
ENDLOOP.
*********************************
this will solve your problem.
Regards,
Syed
09-04-2008 5:50 AM
Hi Sonali,
Replace the PBO MODULE fill_data inside the loop and try. Hope it will work.
Regards,
Santosh
09-04-2008 2:06 PM
Hi All,
Thanks for your replies. The module fill_data actually fills the internal table. So before the loop statement the internal table is already filled with the required data.
Now with the loop statement I just want that internal table data to get displayed in the table control. n this is not happening. Any clue as to why??
09-04-2008 2:13 PM
u have to fill the values in the internal table to the table control and this has to be done inside the ' loop-endloop' statement. So try adding a new module inside the loop endloop. eg. module read_table..
and in pbo.. module read_table..
add .
if your table control screen field name is the name of your workarea,
read table 'internal-tablename' index tablecontrol-current_line into work-area.
or
if your table control screen field name is the name of your internal table (with header line ),
read table 'internal-tablename' index tablecontrol-current_line .
09-04-2008 4:32 PM
Hi Suzie,
Thanks. But it works even if you dont write an explicit readstatement within the loop endloop.
I have finally found out what the issue was.
My field names on Screen were tablecontrolname-fieldname, where as they should have been internaltablename-fieldname.
Thanks,
Sonali.