4

Click here to load reader

Table Control

Embed Size (px)

Citation preview

Page 1: Table Control

7/25/2019 Table Control

http://slidepdf.com/reader/full/table-control 1/4

Table Control Properties in SAP ABAP

Page 2: Table Control

7/25/2019 Table Control

http://slidepdf.com/reader/full/table-control 2/4

CONTROLS - TYPE TABLEVIEW

Syntax

CONTROLS contrl TYPE TABLEVIEW USING SCREEN dynnr.

Effect

Declaration of a Table Control . If the type TABLEVIEW is entered inthe CONTROLS statement, a deep structure is created with the name of the control andthe type CXTAB_CO T!O" of the type #roup CXTAB. Durin# screen processin#, thecomponents of the structure contain the attributes of the table control. $sin# thisstructure you can read and edit the attributes of the rele%ant table control.

At the top le%el, the deep structure CXTAB_CO T!O" contains components for the#eneral attributes of the table control. The component CO"& is an internal table of thestructure CXTAB_CO"$' and contains the attributes of indi%idual columns. Thestructure CXTAB_CO"$' contains a structured component &C!(( , which hasthe same structure as screen and contains the attributes of the screen element of eachcolumn. )ith the e*ception of the component C$!!( T_"I (, all components ofthe structure CXTAB_CO T!O" can be set in the ABA+ pro#ram.

In dynnr , you must specify the number of a screen on which a table control with thename contrl is defined. or dynnr , you can specify a literal or a constant of thetype n and the len#th -. )hen a screen, in which a table control called contrl isdefined, is first called, the start %alues of certain components of the structure areobtained from the definition of the table control whose screen is specified afterthe USING addition.

Structure CXTAB_CONTROL

Com onent !e"cr# t#on

IX(D_CO"& umber of lead columns. &tart %alue is ta en from the definition of the tablecontrol in screen dynnr .

"I (&

Controls the %ertical scroll bar of the table control. If the "OO+ is e*ecuted in thescreen flow lo#ic without reference to an internal table, that start %alue of "I (&is / and must be set in the pro#ram so that the scroll bar can be used. )ithreference to an internal table, "I (& is set to the current number of rows in theinternal table if the table control is bein# processed for the first time. 0owe%er,since this time is not defined, the %alue of "I (& should also be e*plicitly set tothe number of rows of the internal table before the +BO processin# in this case.

TO+_"I ( Topmost displayed row for ne*t +BO +BO . &et at time of +AI by the position ofthe %ertical slider bo*.

C$!!( T_"I ( Current row durin# a LOOP in the screen flow lo#ic. If the FROM addition to

Page 3: Table Control

7/25/2019 Table Control

http://slidepdf.com/reader/full/table-control 3/4

the "OO+ statement is not specified, the %alue of C$!!( T_"I ( correspondsto the result of sy-st !l 1 2TO+_"I ( 3 45.

"( T_CO" umber of first hori6ontally scrollable column displayed after the lead columns.Is set at time of +AI by the position of the hori6ontal slider bo*.

"I (_&("_'OD(!ow selection mode7 8/8 if no rows can be selected , 848 if one row, 898 if se%eralrows. &tart %alue is ta en from the definition of the table control in

screen dynnr .

CO"_&("_'OD(Column selection mode7 8/8 if no columns can be selected , 848 if one column,898 if se%eral columns. &tart %alue is ta en from the definition of the table controlin screen dynnr .

"I (_&("(CTO! la# 28X8 or 8 85 whether there is a selection column. &tart %alue is ta en from the

definition of the table control in screen dynnr .

0_:!IDla# 28X8 or 8 85 whether there are hori6ontal separators. &tart %alue is ta en from

the definition of the table control in screen dynnr .

;_:!IDla# 28X8 or 8 85 whether there are %ertical separators. &tart %alue is ta en from

the definition of the table control in screen dynnr . CO"& Control table for indi%idual columns of structure CXTAB_CO"$' . I ;I&IB"( la# 28X8 or 8 85 whether or not the table control is %isible in the window or not.

Structure CXTAB_COL$%N

Com onent !e"cr# t#on

&C!((&tructure for the attributes of the screen element of the current column. The componentscan be set for the %alues described there either directly or usin# 'ODI < &C!(( .The latter o%erwrites a direct %alue assi#nment.

I D(XCurrent position of the column in the table control. &tart %alue is ta en from thedefinition of the table control in the screen dynnr . Is set to the current %alue at timeof +AI .

&("(CT(D la# 28X8 or 8 85 whether or not column is selected. Is set to current %alue at timeof +AI .

;I&"( :T0;isible len#th of column. &tart %alue is ta en from the definition of the table control inscreen dynnr .

I ;I&IB"( la# 28X8 or 8 85 whether or not the column is %isible in the table control.

Note"

• In a table control, you can scroll %ertically usin# a scroll bar if the component"I (& of the structure CXTAB_CO T!O" was set to the correct row number

before the +BO processin# of the table control. (%ery time you scroll with thescroll bar, the e%ent +AI is tri##ered with an empty function code and thecomponent TO+_"I ( of the structure CXTAB_CO T!O" is automaticallyset to the new topmost row before the time of +BO.

Page 4: Table Control

7/25/2019 Table Control

http://slidepdf.com/reader/full/table-control 4/4

• or pro#ram3controlled scrollin#, it is sufficient to assi#n a %alue to thecomponent TO+_"I ( of the structure CXTAB_CO T!O" durin# +BO

processin#. or pa#e by pa#e scrollin#, the number of pa#es to be scrolled can be obtained from the system field sy-loo!c durin# the loop processin# . sy-

loo!c contains the number of currently displayed rows, while the component"I (& of the structure CXTAB_CO T!O" contains the number of rows inthe entire table control.

Exam &e

If a table control is defined on the screen with the number 4//, whose rows aredefined with reference to the database table &+ "I in the ABA+ Dictionary, thecorrespondin# pro#rammin# of the ABA+ pro#ram can loo as follows. In a +BOmodule !r !"r #t"$ , an internal table s!%l&#t"$ is filled with data from the database

table. The number of rows of s!%l&#t"$ is assi#ned to the component lines of thestructure %l&'(t#t"$ created usin# CONTROLS= this is done to acti%ate the scroll bar ofthe table control. In a +AI module )od&%y#t"$ , the row of the internal table is modifiedwhose table

ey matches that of the interface wor area s!%l& defined usin# TABLES . The +AImodule )od&%y#t"$ is called for e%ery displayed row of the table control. Thecorrespondin# screen flow lo#ic can be seen in the e*ample for "OO+ .

CONTROLS %l&'(t#t"$ TYPE TABLEVIEW USING SCREEN *+,++*.TABLES s!%l&.

ATA s!%l&#t"$ TYPE SORTE TABLE OF s!%l& WIT UNI/UE 0EY c"rr&d conn&d.

... MO ULE !r !"r #t"$ OUTPUT.

IF s!%l&#t"$ IS INITIAL.SELECT 1

FROM s!%l&INTO TABLE s!%l&#t"$.

%l&'(t#t"$-l&n s 2 l&n s3 s!%l&#t"$ 4.EN IF.

EN MO ULE. MO ULE )od&%y#t"$ INPUT.

MO IFY TABLE s!%l&#t"$ FROM s!%l&.

EN MO ULE.