‎2007 Aug 30 11:49 AM
Hi all,
here's my prob......
I am working with table control in a module pool program, i have got the data into my internal table, but
1. How to get that data from internal table to my table control.?
2. After creating the table control on the screen painter, as i click on activate, it shows an error that the table control is created without any columns.? what to do for that.?
If any one could explain me how to proceed, through algorithm or psuedo code.
Please do not give code samples. Detailed step by step explanation would help.....!!!!
‎2007 Aug 30 11:53 AM
Hi,
We have demo programs in SAP itself, look at the below programs then you will understand it clearly ..
DEMO_DYNPRO_TABLE_CONTROL_1
DEMO_DYNPRO_TABLE_CONTROL_2
Regards
Sudheer
‎2007 Aug 30 11:56 AM
HI,
u need to place the fields in that table control,that which u want to see.to place the fields like the fields in any data dictionary structure or table fields click on the second button from last in the application tool bar and give the table name and press the button get fields button.select the fields u can want to display and drag them on to the table control.
see this code.
TABLES: LFA1, EKKO.
DATA: OKCODE1 LIKE SY-UCOMM,
OKCODE2 LIKE SY-UCOMM.
CONTROLS TABC TYPE TABLEVIEW USING SCREEN 1001.
DATA: BEGIN OF ITAB OCCURS 0,
MANDT LIKE EKKO-MANDT,
EBELN LIKE EKKO-EBELN,
BSTYP LIKE EKKO-BSTYP,
BSART LIKE EKKO-BSART,
END OF ITAB.
MODULE USER_COMMAND_1000 INPUT.
CASE OKCODE1.
WHEN 'BACK'.
SET SCREEN 0.
WHEN 'NEXT'.
SET SCREEN 1001.
SELECT * FROM EKKO INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE
LIFNR = LFA1-LIFNR.
ENDCASE.
ENDMODULE. " USER_COMMAND_1001 INPUT
MODULE MOVE_DATA OUTPUT.
EKKO-MANDT = ITAB-MANDT."<b>here ekko fields are from *screen painter which u need to place them in table control</b>
EKKO-EBELN = ITAB-EBELN.
EKKO-BSTYP = ITAB-BSTYP.
EKKO-BSART = ITAB-BSART.
ENDMODULE. " MOVE_DATA OUTPUT
MODULE USER_COMMAND_1001 INPUT.
CASE OKCODE2.
WHEN 'BACK'.
SET SCREEN 1000.
ENDCASE.
ENDMODULE. " USER_COMMAND_1001 OUTPUT
MODULE STATUS_1001 OUTPUT.
SET PF-STATUS 'MENU'.
SET TITLEBAR 'TIT'.
ENDMODULE. " STATUS_1001 OUTPUT
MODULE STATUS_1000 OUTPUT.
SET PF-STATUS 'DMENU'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_1000 OUTPUT
<b>FLOW LOGIC:</b>
PROCESS BEFORE OUTPUT.
MODULE STATUS_1000.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1000.
PROCESS BEFORE OUTPUT.
MODULE STATUS_1001.
LOOP AT ITAB WITH CONTROL TABC CURSOR TABC-TOP_LINE.
MODULE MOVE_DATA.
ENDLOOP.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1001.
LOOP AT ITAB.
ENDLOOP.
<b>reward if helpful</b>
rgds,
bharat.
‎2007 Aug 30 11:57 AM
DATA: BEGIN OF FS_SPFLI,
MANDT TYPE SPFLI-MANDT,
CARRID TYPE SPFLI-CARRID,
CONNID TYPE SPFLI-CONNID,
COUNTRYFR TYPE SPFLI-COUNTRYFR,
END OF FS_SPFLI.
DATA: BEGIN OF FS_SFLIGHT,
MANDT TYPE SFLIGHT-MANDT,
CARRID TYPE SFLIGHT-CARRID,
CONNID TYPE SFLIGHT-CONNID,
FLDATE TYPE SFLIGHT-FLDATE,
END OF FS_SFLIGHT.
data:
t_spfli like standard table of fs_spfli,
t_sflight like standard table of fs_sflight,
ok_code type sy-ucomm.
controls:
c_tabstrip type tabstrip.
select *
from spfli
into corresponding fields of table t_spfli.
select *
from sflight
into corresponding fields of table t_sflight.
call screen 101.
*call screen 102.
*call screen 103.
&----
*& Module STATUS_0101 OUTPUT
&----
text
----
MODULE STATUS_0101 OUTPUT.
SET PF-STATUS 'TABSTRIP'.
SET TITLEBAR 'TABSTRIP'.
ENDMODULE. " STATUS_0101 OUTPUT
&----
*& Module USER_COMMAND_0101 INPUT
&----
text
----
MODULE USER_COMMAND_0101 INPUT.
case ok_code.
when 'BACK' or 'EXIT'.
leave program.
clear ok_code.
when 'SPFLI'.
leave to list-processing.
loop at t_spfli into fs_spfli.
write:/
fs_spfli.
endloop.
clear ok_code.
when 'SFLIGHT'.
leave to list-processing.
loop at t_sflight into fs_sflight.
write:/
fs_sflight.
endloop.
clear ok_code.
endcase.
ENDMODULE. " USER_COMMAND_0101 INPUT
<b>When you double click on call screen 101.....</b>
Copy paste the code in the flow logic............
PROCESS BEFORE OUTPUT.
MODULE STATUS_0101.
call subscreen spfli_ref1 including sy-repid '102'.
call subscreen sflight_ref1 including sy-repid '103'.
*
PROCESS AFTER INPUT.
call subscreen: spfli_ref1, sflight_ref1.
MODULE USER_COMMAND_0101.
And in the layout, create TAB STRIP CONTROL................
Regards,
Pavan
‎2007 Aug 30 12:10 PM
Hi,
Are u making executable report or module pool ?
First u create one internal table with same fields which u want in table control and than create table control with the help of wizard..
and than u have to make one module in PBO like fetch_data.
write simple query of select............ into <ur internal table>
data will automatically display in table control.
‎2007 Aug 30 2:53 PM
Thanks a lot all of u , it really helped, but theres one more prob...the program is running fine for first two fields, but when i include other fields it gives an error saying
<b>data objects in a unicode program are not convertible.</b>
what to do now...?
‎2007 Aug 30 2:54 PM
Thanks a lot all of u , it really helped, but theres one more prob...the program is running fine for first two fields, but when i include other fields it gives an error saying
<b>data objects in a unicode program are not convertible.</b>
what to do now...?
‎2007 Aug 31 10:31 AM
Hi,
can u explain me ur problem in detail? and which fields u have taken?