05-09-2011 10:59 AM
I am not able to fill data from database in TABLE CONTROL.The table is displayed with columns(which i added in layout using dict option) but on runtime there is no data in it.I am trying this for the first time so kindly guide me.
Here is PBO and PAI code.
PROCESS BEFORE OUTPUT.
LOOP AT ITAB WITH CONTROL EMPTABLE CURSOR EMPTABLE-CURRENT_LINE.
ENDLOOP.
MODULE STATUS_0001.
*
PROCESS AFTER INPUT.
LOOP AT ITAB.
ENDLOOP.
MODULE USER_COMMAND_0001.
And here is Main Code.
REPORT ZDATA_FORM1.
TABLES: ZEMPLOYEE_MASTER.
CONTROLS EMPTABLE TYPE TABLEVIEW USING SCREEN 0001.
data: begin of itab occurs 0,
emp_no like zemployee_master-emp_no,
name like zemployee_master-name,
city like zemployee_master-city,
end of itab.
select emp_no name city from zemployee_master into table itab.
*&---------------------------------------------------------------------*
*& Module STATUS_0001 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0001 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0001 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0001 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0001 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0001 INPUT
05-10-2011 6:42 AM
Hi
How have you made fields on table control using Get from program or get from dictionary ?
Make it using get from program
05-09-2011 12:00 PM
Hi,
e.g. directly after line "PROCESS BEFORE OUTPUT" and before line "LOOP AT..." implement a module "MODULE set_data".
Within this module select your information from dtab and fill your <table-control-itab> with lines...
Basically, move your select-statement from report ZDATA_FORM1 to the PBO section of your screen!
Kind regards
Frank
05-09-2011 12:59 PM
@Frank : I did exactly the way u said but still the table does not show any data. I checked in the database table , the records are there
05-09-2011 1:03 PM
05-09-2011 1:58 PM
05-09-2011 2:30 PM
How is the setup of your table-contlol columns and fields? (active, input, output, invisible)
Do you "MODIFY SCREEN" anything?
Have also a look into report "RSDEMO02"... Good example!
Good Luck
Frank
Edited by: Frank Zoor on May 9, 2011 3:34 PM
05-10-2011 5:30 AM
@ Frank : All properties are default only.I m not using MODIFY SCREEN either . I have just an EXIT button and a table control and whatever code i have written above is all what i have written in my program.
I wil try to look into the example code u have given.Till then if you have any suggestions please let me know
THANKS
05-09-2011 12:20 PM
Hi,
1. Check wether entries are there in itab.
2. table control column name should be as below
itab-emp_no
itab-name.
3. set table control property as below
EMPTABLE-lines = 10.
notes: 10 is number of lines in itab
05-09-2011 1:13 PM
Hi,
Please check the below code, MODULE should be in between Loop and End loop.
PROCESS BEFORE OUTPUT.
LOOP AT ITAB WITH CONTROL EMPTABLE CURSOR EMPTABLE-CURRENT_LINE.
MODULE STATUS_0001.
ENDLOOP.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0001.
LOOP AT ITAB.
ENDLOOP.
Thanks,
Sriram.
05-10-2011 6:42 AM
Hi
How have you made fields on table control using Get from program or get from dictionary ?
Make it using get from program
05-10-2011 6:54 AM
@Akanksha : Thanks for your reply. I m using get from dict because i actually want to get the fields automatically from data dict. I m sure there must be a way to bring data into the table control by "getting fields from dict".
THANKS a lot
05-10-2011 7:17 AM
Yes, You can do it with dictionary also
use this statement instead of your statement in flow logic :---
LOOP at <internal-table name> into < dictionary table name > WITH CONTROL <table control name>.
ENDLOOP.
05-10-2011 7:30 AM
05-10-2011 7:43 AM
05-10-2011 8:06 AM
Just 1 more problem. There are some 20 records in the database.But in the table control only some 7 are shown and there is no vertical scrollbar to show the remaining records. (Although there is a horizontal scrollbar which works fine).
THANKS
05-10-2011 9:34 AM
Hi,
You have to pass the number of lines of data in the table control to the LINES attribute of table control.
Try this:
DESCRIBE TABLE <internal table name> LINES <table control name>-lines.
Regards,
rahul Muraleedharan.
05-10-2011 9:36 AM
05-10-2011 12:50 PM
Do two things:-
1. check the Resizing option in table control properties (horizontal and vertical)
2 add this code
< table_control_namel-v_scroll = 'X'.
DESCRIBE TABLE <internal table>.
< table_control_name>-lines = sy-tfill .