‎2007 May 28 11:15 AM
‎2007 May 28 11:24 AM
Hi nag,
The Control Tables are used to Store your data's from your screen or program. you can also Retrieve the data's From your tables.
The control table is the one which specifies how your data changes in the table and how you want your table to be maintained.:
The following are the delivery classes:
A: Application table.
C: Customizing table, maintenance by customer only.
L: Table for storing temporary data.
G: Customizing table, entries protected against overwriting.
E: Control table.
S: System table, maintenance only by SAP.
W: System table, contents can be transported via own TR objects.
The Control Tables specify that it is the table where data is not changed frequently and pertains to information for the flow of the system.
Reward if useful.
Thanks
suresh babu aluri
‎2007 May 28 11:18 AM
‎2007 May 28 11:18 AM
It is used to display a table in the screen. Ex:
report z_82235_tablecontrol .
types: begin of t_mara,
matnr type matnr,
meins type meins,
matkl type matkl,
col_sel(1) type c,
end of t_mara.
data: it_mara type table of t_mara,
wa_mara like line of it_mara.
select matnr meins matkl from mara
into table it_mara
up to 10 rows.
call screen 100.
*&spwizard: declaration of tablecontrol 'TABLE_CONTROL' itself
controls: table_control type tableview using screen 0100.
*&spwizard: lines of tablecontrol 'TABLE_CONTROL'
data: g_table_control_lines like sy-loopc.
data: ok_code like sy-ucomm.
*&spwizard: output module for tc 'TABLE_CONTROL'. do not change this lin
*&spwizard: update lines for equivalent scrollbar
module table_control_change_tc_attr output.
describe table it_mara lines table_control-lines.
endmodule.
*&spwizard: output module for tc 'TABLE_CONTROL'. do not change this lin
*&spwizard: get lines of tablecontrol
module table_control_get_lines output.
g_table_control_lines = sy-loopc.
endmodule.
*&spwizard: input module for tc 'TABLE_CONTROL'. do not change this line
*&spwizard: modify table
module table_control_modify input.
modify it_mara
from wa_mara
index table_control-current_line.
endmodule.
*&spwizard: input modul for tc 'TABLE_CONTROL'. do not change this line!
*&spwizard: mark table
module table_control_mark input.
data: g_table_control_wa2 like line of it_mara.
if table_control-line_sel_mode = 1.
loop at it_mara into g_table_control_wa2
where col_sel = 'X'.
g_table_control_wa2-col_sel = ''.
modify it_mara
from g_table_control_wa2
transporting col_sel.
endloop.
endif.
modify it_mara
from wa_mara
index table_control-current_line
transporting col_sel.
endmodule.
*&spwizard: input module for tc 'TABLE_CONTROL'. do not change this line
*&spwizard: process user command
module table_control_user_command input.
ok_code = sy-ucomm.
perform user_ok_tc using 'TABLE_CONTROL'
'IT_MARA'
'COL_SEL'
changing ok_code.
sy-ucomm = ok_code.
endmodule.
*----------------------------------------------------------------------*
* INCLUDE TABLECONTROL_FORMS *
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form USER_OK_TC *
*&---------------------------------------------------------------------*
form user_ok_tc using p_tc_name type dynfnam
p_table_name
p_mark_name
changing p_ok like sy-ucomm.
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
data: l_ok type sy-ucomm,
l_offset type i.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*
*&SPWIZARD: Table control specific operations *
*&SPWIZARD: evaluate TC name and operations *
search p_ok for p_tc_name.
if sy-subrc <> 0.
exit.
endif.
l_offset = strlen( p_tc_name ) + 1.
l_ok = p_ok+l_offset.
*&SPWIZARD: execute general and TC specific operations *
case l_ok.
when 'INSR'. "insert row
perform fcode_insert_row using p_tc_name
p_table_name.
clear p_ok.
when 'DELE'. "delete row
perform fcode_delete_row using p_tc_name
p_table_name
p_mark_name.
clear p_ok.
when 'P--' or "top of list
'P-' or "previous page
'P+' or "next page
'P++'. "bottom of list
perform compute_scrolling_in_tc using p_tc_name
l_ok.
clear p_ok.
* WHEN 'L--'. "total left
* PERFORM FCODE_TOTAL_LEFT USING P_TC_NAME.
*
* WHEN 'L-'. "column left
* PERFORM FCODE_COLUMN_LEFT USING P_TC_NAME.
*
* WHEN 'R+'. "column right
* PERFORM FCODE_COLUMN_RIGHT USING P_TC_NAME.
*
* WHEN 'R++'. "total right
* PERFORM FCODE_TOTAL_RIGHT USING P_TC_NAME.
*
when 'MARK'. "mark all filled lines
perform fcode_tc_mark_lines using p_tc_name
p_table_name
p_mark_name .
clear p_ok.
when 'DMRK'. "demark all filled lines
perform fcode_tc_demark_lines using p_tc_name
p_table_name
p_mark_name .
clear p_ok.
* WHEN 'SASCEND' OR
* 'SDESCEND'. "sort column
* PERFORM FCODE_SORT_TC USING P_TC_NAME
* l_ok.
endcase.
endform. " USER_OK_TC
*&---------------------------------------------------------------------*
*& Form FCODE_INSERT_ROW *
*&---------------------------------------------------------------------*
form fcode_insert_row
using p_tc_name type dynfnam
p_table_name .
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
data l_lines_name like feld-name.
data l_selline like sy-stepl.
data l_lastline type i.
data l_line type i.
data l_table_name like feld-name.
field-symbols <tc> type cxtab_control.
field-symbols <table> type standard table.
field-symbols <lines> type i.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*
assign (p_tc_name) to <tc>.
*&SPWIZARD: get the table, which belongs to the tc *
concatenate p_table_name '[]' into l_table_name. "table body
assign (l_table_name) to <table>. "not headerline
*&SPWIZARD: get looplines of TableControl *
concatenate 'G_' p_tc_name '_LINES' into l_lines_name.
assign (l_lines_name) to <lines>.
*&SPWIZARD: get current line *
get cursor line l_selline.
if sy-subrc <> 0. " append line to table
l_selline = <tc>-lines + 1.
*&SPWIZARD: set top line *
if l_selline > <lines>.
<tc>-top_line = l_selline - <lines> + 1 .
else.
<tc>-top_line = 1.
endif.
else. " insert line into table
l_selline = <tc>-top_line + l_selline - 1.
l_lastline = <tc>-top_line + <lines> - 1.
endif.
*&SPWIZARD: set new cursor line *
l_line = l_selline - <tc>-top_line + 1.
*&SPWIZARD: insert initial line *
insert initial line into <table> index l_selline.
<tc>-lines = <tc>-lines + 1.
*&SPWIZARD: set cursor *
set cursor line l_line.
endform. " FCODE_INSERT_ROW
*&---------------------------------------------------------------------*
*& Form FCODE_DELETE_ROW *
*&---------------------------------------------------------------------*
form fcode_delete_row
using p_tc_name type dynfnam
p_table_name
p_mark_name .
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
data l_table_name like feld-name.
field-symbols <tc> type cxtab_control.
field-symbols <table> type standard table.
field-symbols <wa>.
field-symbols <mark_field>.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*
assign (p_tc_name) to <tc>.
*&SPWIZARD: get the table, which belongs to the tc *
concatenate p_table_name '[]' into l_table_name. "table body
assign (l_table_name) to <table>. "not headerline
*&SPWIZARD: delete marked lines *
describe table <table> lines <tc>-lines.
loop at <table> assigning <wa>.
*&SPWIZARD: access to the component 'FLAG' of the table header *
assign component p_mark_name of structure <wa> to <mark_field>.
if <mark_field> = 'X'.
delete <table> index syst-tabix.
if sy-subrc = 0.
<tc>-lines = <tc>-lines - 1.
endif.
endif.
endloop.
endform. " FCODE_DELETE_ROW
*&---------------------------------------------------------------------*
*& Form COMPUTE_SCROLLING_IN_TC
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_TC_NAME name of tablecontrol
* -->P_OK ok code
*----------------------------------------------------------------------*
form compute_scrolling_in_tc using p_tc_name
p_ok.
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
data l_tc_new_top_line type i.
data l_tc_name like feld-name.
data l_tc_lines_name like feld-name.
data l_tc_field_name like feld-name.
field-symbols <tc> type cxtab_control.
field-symbols <lines> type i.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*
assign (p_tc_name) to <tc>.
*&SPWIZARD: get looplines of TableControl *
concatenate 'G_' p_tc_name '_LINES' into l_tc_lines_name.
assign (l_tc_lines_name) to <lines>.
*&SPWIZARD: is no line filled? *
if <tc>-lines = 0.
*&SPWIZARD: yes, ... *
l_tc_new_top_line = 1.
else.
*&SPWIZARD: no, ... *
call function 'SCROLLING_IN_TABLE'
exporting
entry_act = <tc>-top_line
entry_from = 1
entry_to = <tc>-lines
last_page_full = 'X'
loops = <lines>
ok_code = p_ok
overlapping = 'X'
importing
entry_new = l_tc_new_top_line
exceptions
* NO_ENTRY_OR_PAGE_ACT = 01
* NO_ENTRY_TO = 02
* NO_OK_CODE_OR_PAGE_GO = 03
others = 0.
endif.
*&SPWIZARD: get actual tc and column *
get cursor field l_tc_field_name
area l_tc_name.
if syst-subrc = 0.
if l_tc_name = p_tc_name.
*&SPWIZARD: et actual column *
set cursor field l_tc_field_name line 1.
endif.
endif.
*&SPWIZARD: set the new top line *
<tc>-top_line = l_tc_new_top_line.
endform. " COMPUTE_SCROLLING_IN_TC
*&---------------------------------------------------------------------*
*& Form FCODE_TC_MARK_LINES
*&---------------------------------------------------------------------*
* marks all TableControl lines
*----------------------------------------------------------------------*
* -->P_TC_NAME name of tablecontrol
*----------------------------------------------------------------------*
form fcode_tc_mark_lines using p_tc_name
p_table_name
p_mark_name.
*&SPWIZARD: EGIN OF LOCAL DATA-----------------------------------------*
data l_table_name like feld-name.
field-symbols <tc> type cxtab_control.
field-symbols <table> type standard table.
field-symbols <wa>.
field-symbols <mark_field>.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*
assign (p_tc_name) to <tc>.
*&SPWIZARD: get the table, which belongs to the tc *
concatenate p_table_name '[]' into l_table_name. "table body
assign (l_table_name) to <table>. "not headerline
*&SPWIZARD: mark all filled lines *
loop at <table> assigning <wa>.
*&SPWIZARD: access to the component 'FLAG' of the table header *
assign component p_mark_name of structure <wa> to <mark_field>.
<mark_field> = 'X'.
endloop.
endform. "fcode_tc_mark_lines
*&---------------------------------------------------------------------*
*& Form FCODE_TC_DEMARK_LINES
*&---------------------------------------------------------------------*
* demarks all TableControl lines
*----------------------------------------------------------------------*
* -->P_TC_NAME name of tablecontrol
*----------------------------------------------------------------------*
form fcode_tc_demark_lines using p_tc_name
p_table_name
p_mark_name .
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
data l_table_name like feld-name.
field-symbols <tc> type cxtab_control.
field-symbols <table> type standard table.
field-symbols <wa>.
field-symbols <mark_field>.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*
assign (p_tc_name) to <tc>.
*&SPWIZARD: get the table, which belongs to the tc *
concatenate p_table_name '[]' into l_table_name. "table body
assign (l_table_name) to <table>. "not headerline
*&SPWIZARD: demark all filled lines *
loop at <table> assigning <wa>.
*&SPWIZARD: access to the component 'FLAG' of the table header *
assign component p_mark_name of structure <wa> to <mark_field>.
<mark_field> = space.
endloop.
endform. "fcode_tc_mark_lines
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module user_command_0100 input.
case sy-ucomm.
when 'EXIT'.
leave program.
endcase.
endmodule. " USER_COMMAND_0100 INPUT<b>
SCreen 100</b>
process before output.
*&spwizard: pbo flow logic for tablecontrol 'TABLE_CONTROL'
module table_control_change_tc_attr.
*&spwizard: module TABLE_CONTROL_change_col_attr.
loop at it_mara
into wa_mara
with control table_control
cursor table_control-current_line.
module table_control_get_lines.
*&spwizard: module TABLE_CONTROL_change_field_attr
endloop.
* MODULE STATUS_0100.
*
process after input.
*&spwizard: pai flow logic for tablecontrol 'TABLE_CONTROL'
loop at it_mara.
chain.
field wa_mara-matnr.
field wa_mara-meins.
field wa_mara-matkl.
module table_control_modify on chain-request.
endchain.
field wa_mara-col_sel
module table_control_mark on request.
endloop.
module table_control_user_command.
*&spwizard: module TABLE_CONTROL_change_tc_attr.
*&spwizard: module TABLE_CONTROL_change_col_attr.
module user_command_0100.
‎2007 May 28 11:19 AM
Hi
It is a concept of module pool program. Using this you can display data in rows and columns wise.
Regards
Haritha.
‎2007 May 28 11:21 AM
Table Control is used in Module Pool Programming.
Table Control is used to display data of any internal table of ur program or the data from dictionary table directly ino a table format.
Using table control with the help of screen painter, data can be easily displayed.
It can be created manually through coding or using Table Control Wizard given in the sreen painter.
Cheers,
Harsha
‎2007 May 28 11:22 AM
HI,
table control we will use for displaying a data in the the form of a table.table control is very easy to configure.this we will use in dialogue programming.
see the system defined programs <b>demo_dynpro_tabcont_loop</b> and <b>demo_dynpro_tabcont_loop_at</b> for more help.
rgds,
bharat.
‎2007 May 28 11:24 AM
Hi nag,
The Control Tables are used to Store your data's from your screen or program. you can also Retrieve the data's From your tables.
The control table is the one which specifies how your data changes in the table and how you want your table to be maintained.:
The following are the delivery classes:
A: Application table.
C: Customizing table, maintenance by customer only.
L: Table for storing temporary data.
G: Customizing table, entries protected against overwriting.
E: Control table.
S: System table, maintenance only by SAP.
W: System table, contents can be transported via own TR objects.
The Control Tables specify that it is the table where data is not changed frequently and pertains to information for the flow of the system.
Reward if useful.
Thanks
suresh babu aluri
‎2007 May 28 12:23 PM