Application Development and Automation 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: 
Read only

Table Control Example

Former Member
0 Likes
7,328

Hi,

I am looking for a good Table Control Example.I have never worked on Table Controls,I am not clear of the exact procedure.

Please help me with this doubt.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,743

Hi,

Data is displayed in the form of table.

Table control gives user the feeling of an actual table.

You can scroll through the table vertically as well as horizontally.

You can select rows and columns.

You can resize the with of columns.

You can have separator lines between rows and columns.

Automatic resizing of the table when the user resizes the window.

You can update information in the table control and it can be updated in the database table by writing code for it.

Steps for creating table control

Declaration of table control in module pool program.

Designing of table controls on the screen.

Passing data to table control in flow logic.

Declaration of TC in modulepool program

syntax:

controls <name of table control> type tableview using screen <‘screen no.’>.

Designing Table control on screen

Click on Table in Control bar and place it on the screen. You can adjust the length and width of the Table Control.

Name the table control.(same name as given in data declaration).

From dictionary object OR from program fields select the fields and place them in the table control

Passing data to table control

Usually transfer of data from program to screen is automatic.

In case of TC, you need to explicitly transfer the data to table control.

ABAP/4 provides Loop statement, which is associated with flow logic to transfer the data.

Passing of data contd.

PBO.

Loop at <name of internal table> with control <name of table control> cursor <scroll variable>.

module…….

Endloop.

PAI.

Loop at < name of internal table>.Endloop.

Scroll variables

Top_line : the row of table where the screen display starts.

Current_line : the row currently being processed inside a loop.

Transfer of data from prg to TC.

With ‘Loop at …’ statement, the first row is placed in the header of internal table.

If any module is specified between Loop and End loop, it will be executed. In this module, generally we will be assigning this internal table fields to table control screen fields.

The row in internal table is transferred to the TC as stated in the ‘Loop at…..’ statement.

The system encounters the ‘Endloop’ statement and control is passed back to the next line of internal table.

and

just refer....

http://help.sap.com/saphelp_nw04/helpdata/en/d1/801c7b454211d189710000e8322d00/content.htm

http://www.sapgenie.com/abap/controls/htmlviewer.htm

Regards

suresh.D

6 REPLIES 6
Read only

Former Member
0 Likes
1,743

Hi

syntax:

CONTROLS .

if you only want to determine the row of the table control. SY´-SUBRC allows you to check if the cursor is placed in a row of a table control.

u need to comment the performs of table control fields and write ur own perform statements. And u have to declare the table control fields as separate internal tables.

Go through this urls.

www.saptechnical.com

www.sap-img.com

Check the below links.

http://www.planetsap.com/howdo_a.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbac5135c111d1829f0000e829fbfe/content.htm

http://sap.niraj.tripod.com/id25.html

Reward points for useful Answers

Regards

Anji

Read only

Former Member
0 Likes
1,743

Hello,

Have alook at these sample reports:

<b>


DEMO_DYNPRO_TABCONT_LOOP       Table Control with LOOP - ENDLOOP
DEMO_DYNPRO_TABCONT_LOOP_AT    Table Control with LOOP AT ITAB
DEMO_DYNPRO_TABLE_CONTROL_1    Table Control with LOOP Statement
DEMO_DYNPRO_TABLE_CONTROL_2    Table Control with LOOP AT ITAB

</b>

Vasanth

Read only

Former Member
0 Likes
1,744

Hi,

Data is displayed in the form of table.

Table control gives user the feeling of an actual table.

You can scroll through the table vertically as well as horizontally.

You can select rows and columns.

You can resize the with of columns.

You can have separator lines between rows and columns.

Automatic resizing of the table when the user resizes the window.

You can update information in the table control and it can be updated in the database table by writing code for it.

Steps for creating table control

Declaration of table control in module pool program.

Designing of table controls on the screen.

Passing data to table control in flow logic.

Declaration of TC in modulepool program

syntax:

controls <name of table control> type tableview using screen <‘screen no.’>.

Designing Table control on screen

Click on Table in Control bar and place it on the screen. You can adjust the length and width of the Table Control.

Name the table control.(same name as given in data declaration).

From dictionary object OR from program fields select the fields and place them in the table control

Passing data to table control

Usually transfer of data from program to screen is automatic.

In case of TC, you need to explicitly transfer the data to table control.

ABAP/4 provides Loop statement, which is associated with flow logic to transfer the data.

Passing of data contd.

PBO.

Loop at <name of internal table> with control <name of table control> cursor <scroll variable>.

module…….

Endloop.

PAI.

Loop at < name of internal table>.Endloop.

Scroll variables

Top_line : the row of table where the screen display starts.

Current_line : the row currently being processed inside a loop.

Transfer of data from prg to TC.

With ‘Loop at …’ statement, the first row is placed in the header of internal table.

If any module is specified between Loop and End loop, it will be executed. In this module, generally we will be assigning this internal table fields to table control screen fields.

The row in internal table is transferred to the TC as stated in the ‘Loop at…..’ statement.

The system encounters the ‘Endloop’ statement and control is passed back to the next line of internal table.

and

just refer....

http://help.sap.com/saphelp_nw04/helpdata/en/d1/801c7b454211d189710000e8322d00/content.htm

http://www.sapgenie.com/abap/controls/htmlviewer.htm

Regards

suresh.D

Read only

Former Member
0 Likes
1,743

hi

good

REPORT demo_dynpro_tabcont_loop.

CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.

DATA: ok_code TYPE sy-ucomm,

save_ok TYPE sy-ucomm.

DATA: itab TYPE TABLE OF demo_conn,

fill TYPE i.

TABLES demo_conn.

DATA: lines TYPE i,

limit TYPE i.

SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.

CALL SCREEN 100.

MODULE status_0100 OUTPUT.

SET PF-STATUS 'SCREEN_100'.

DESCRIBE TABLE itab LINES fill.

flights-lines = fill.

ENDMODULE.

MODULE fill_table_control OUTPUT.

READ TABLE itab INTO demo_conn INDEX flights-current_line.

ENDMODULE.

MODULE cancel INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE read_table_control INPUT.

lines = sy-loopc.

MODIFY itab FROM demo_conn INDEX flights-current_line.

ENDMODULE.

MODULE user_command_0100 INPUT.

save_ok = ok_code.

CLEAR ok_code.

CASE save_ok.

WHEN 'NEXT_LINE'.

flights-top_line = flights-top_line + 1.

limit = fill - lines + 1.

IF flights-top_line > limit.

flights-top_line = limit.

ENDIF.

WHEN 'PREV_LINE'.

flights-top_line = flights-top_line - 1.

IF flights-top_line < 0.

flights-top_line = 0.

ENDIF.

WHEN 'NEXT_PAGE'.

flights-top_line = flights-top_line + lines.

limit = fill - lines + 1.

IF flights-top_line > limit.

flights-top_line = limit.

ENDIF.

WHEN 'PREV_PAGE'.

flights-top_line = flights-top_line - lines.

IF flights-top_line < 0.

flights-top_line = 0.

ENDIF.

WHEN 'LAST_PAGE'.

flights-top_line = fill - lines + 1.

WHEN 'FIRST_PAGE'.

flights-top_line = 0.

ENDCASE.

ENDMODULE.

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac4435c111d1829f0000e829fbfe/content.htm

thanks

mrutyun^

Read only

Former Member
0 Likes
1,743

Hi,

Table control is used to maintain set of records in tabular form:

report demo_dynpro_table_control_1 message-id sabapdocu.

data: begin of itab occurs 10,

mark,

col1 type i,

col2 type i,

end of itab.

data ok_code type sy-ucomm.

data ok_save type sy-ucomm.

data tab_lines type i.

data step_lines type i.

data offset type i.

controls table type tableview using screen 100.

call screen 100.

module init output.

set pf-status 'BASIC'.

endmodule.

module fill_itab output.

describe table itab lines tab_lines.

if tab_lines = 0.

do 40 times.

itab-col1 = sy-index.

itab-col2 = sy-index ** 2.

append itab.

enddo.

describe table itab lines tab_lines.

table-lines = tab_lines.

endif.

endmodule.

module transp_itab output.

read table itab index table-current_line.

endmodule.

module lines output.

step_lines = sy-loopc.

endmodule.

module exit input.

leave program.

endmodule.

module check_pai input.

ok_save = ok_code. clear ok_code.

message s888 with 'TOP_LINE: ' table-top_line

', LINES: ' step_lines.

endmodule.

module check_table input.

case ok_save.

when 'MARK'.

if itab-mark = 'X'.

message i888 with 'Zeile' table-current_line 'markiert'.

endif.

when 'SETM'.

modify itab index table-current_line.

endcase.

endmodule.

module check_all input.

case ok_save.

when 'ALLM'.

loop at itab.

if itab-mark = 'X'.

message i888 with 'Zeile' sy-tabix 'markiert'.

endif.

endloop.

when 'DELE'.

loop at itab.

if itab-mark = 'X'.

itab-mark = ' '.

modify itab.

endif.

endloop.

endcase.

endmodule.

module scroll input.

case ok_save.

when 'PGDO'.

offset = table-lines - step_lines.

if table-top_line lt offset.

table-top_line = table-top_line + step_lines.

endif.

when 'PGUP'.

offset = step_lines.

if table-top_line gt offset.

table-top_line = table-top_line - step_lines.

else.

table-top_line = 1.

endif.

when 'PGLA'.

table-top_line = table-lines - step_lines + 1.

when 'PGTO'.

table-top_line = 1.

endcase.

endmodule.

For More Info,

<b>Table Control Scrolling:</b>

<b>Table Control with Wizard :</b>

http://help.sap.com/saphelp_nw04/helpdata/en/6d/150d67da1011d3963800a0c94260a5/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/frameset.htm

<b>Table control in BDC</b>

http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm

Regards,

Padmam.

Read only

Former Member
0 Likes
1,743

Hi,

Features:

Data is displayed in the form of table.

Table control gives user the feeling of an actual table.

You can scroll through the table vertically as well as horizontally.

You can select rows and columns.

You can resize the with of columns.

You can have separator lines between rows and columns.

Automatic resizing of the table when the user resizes the window.

You can update information in the table control and it can be updated in the database table by writing code for it.

here is a step by step example. you can learn by following the steps:

http://www.planetsap.com/online_pgm_main_page.htm

Check out these demo programs

RSDEMO_TABLE_CONTROL

DEMO_DYNPRO_TABLE_CONTROL_1

DEMO_DYNPRO_TABLE_CONTROL_2

Check

http://www.sap-img.com/ab031.htm

through this link

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/content.htm

table control scrolling:

https://www.sdn.sap.com/sdn/collaboration.sdn?contenttype=url&content=https%3A//forums.sdn.sap.com/t...

table control with wizard

http://help.sap.com/saphelp_nw04/helpdata/en/6d/150d67da1011d3963800a0c94260a5/content.htm

Have a look at below link:

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/frameset.htm