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: 

Table control

Former Member
0 Kudos

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.....!!!!

7 REPLIES 7

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

0 Kudos

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...?

0 Kudos

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...?

0 Kudos

Hi,

can u explain me ur problem in detail? and which fields u have taken?