Create Table Control Using ABAP ProgrammingWord格式.docx
- 文档编号:15929529
- 上传时间:2022-11-17
- 格式:DOCX
- 页数:10
- 大小:347.07KB
Create Table Control Using ABAP ProgrammingWord格式.docx
《Create Table Control Using ABAP ProgrammingWord格式.docx》由会员分享,可在线阅读,更多相关《Create Table Control Using ABAP ProgrammingWord格式.docx(10页珍藏版)》请在冰豆网上搜索。
SAPHelp
asmainreference,somewebsitesandpresentationslidesfromMichaelAdams,QueenslandUniversityofTechnology.
ATableControlisascreen‘container’orobjectthatallowsdisplayofmultiplerowsofatable(database
or
internaltable)onascreen.Itisgoodfordisplayingaone-to-manyrelationshipontheonescreen.Thetablecontrolobjecthasmanyfeaturesbuiltintoenhancescreendisplayandusability.
TableControlfeaturesallow
∙horizontal&
verticalscrolling
∙columnwidthresizing
∙scrollingwithinafield(wherecontentsarewiderthanthescreenfieldwidth)
∙reorderingthesequenceofcolumns
∙savingthecurrentdisplaysettingsforfutureuse
∙selectionoftablerows&
columns
Formattingfeaturesinclude
∙automatictableresizingonwindowresize
∙separatorlinesbetweenrows&
∙columnheaderfieldsforallcolumns
Herestepstocreatetablecontrol
1.Declarethetablecontrol
Aswellasdrawingthetablecontrolonthescreenitisnecessarytodeclarethetablecontrolasadataitem(intheTOPincludeprogramforthetransaction).
CONTROLSctrlTYPETABLEVIEW
USINGSCREENscr.
∙<
ctrl>
isthenameofthetablecontrolonascreenintheABAPprogram
TABLEVIEW>
correspondstoacomplextype–
(CXTAB_CONTROLdefinedintheABAPdictionary)
scr>
isthescreenfromwhichthetablecontrolwillgetitsinitialvalues
2.Addingtablecontroltoascreen
Inthegraphicalscreeneditorchoosethetablecontrolelementbutton.
Usetheleftmousebuttontopositionandsizethecontrolonthescreen.
Theninputthenameoftablecontrol.
3.AddingFieldtoatablecontrol
Toaddfieldtotablecontrol,wecanretrievefromtableorinternaltable.Clickonicon“dictionary/programfieldwindow”orfunctionkeyF6.
Theretwooptionwhileretrievefield,i.e.basedondatabasetableorinternaltable.Ifwanttoretrievefromdatabasetable,inputthenameoftablethenclickpushbutton“GetfromDictionary”.Ifwanttoretrievefrominternaltable,inputtheinternaltablenamethenclickpushbutton“Getfromprogram”.
Markthefieldtobeaddedtotablecontrol,andthenclickonpushbuttonOK.
Dragselectedfieldsintotablethenreleasethemousebutton.
Herethefieldsweselectedwillbedisplayedinreversedorder.Idonotexactlywhyithappens.Ihavetriedsomewaysandtrickstodisplayincorrectorder,butthefieldsstilldisplayedinreversedorder.Finally,togetthecorrectorderIselectedthefieldsonebyone.
4.Addinglabelforeachcolumn
Labelcolumnistextfield.Toaddit,justclickonthetextfieldicon,dragitontoheaderofthecolumnandthentypethelabel.
TableControlPrinciple
Thereareasetofprogrammingprinciplesthatshouldbeadheredtowhenusingtablecontrolsandsteploops.Datafromthedatabaseshouldbeinitiallyloadedintoaninternaltable.Thismeansthatthedatabaseisaccessedforreadpurposesonlyonceinthetransaction.Nexttherowsoftheinternaltableareloadedintothetablecontrol.Anychangesthataremadetothedataarethensavedbacktotheinternaltable.Attheendofthetransaction,thecontentsoftheinternaltablecanbewrittenbacktothedatabase,againtominimizedatabaseI/O.
PAIlogicforscreen1(seescreenbelow)loadstheinternaltablewithdatafromthedatabaseaccordingtotheentriessuppliedbytheuser.
PBOlogicforscreen2(seescreenbelow)populatesthetablecontrolfromtheinternaltable(buffer).
Useractioninscreen2triggersthePAIlogic.PAIlogicupdatestheinternaltablewithnewvaluesentered(intothetablecontrolscreenfields)bytheuser.
PAIlogicistriggeredbyactionssuchasscrollingdownasinglerowaswellasactionssuchasBACK,EXIT,etc.
Unlesstheuseractioncausesthetransactiontoleavethecurrentscreen,afterthePAImoduleshavebeenexecuted,thePBOmodulesforthescreenareexecutedagain.Thusthetablecontrolfieldsareupdatedorrefreshedaftereveryuseraction.
PBO(ProcessBeforeOutput)
InPBOprocessingfieldsaretransportedfromthemodulepooltothescreeninapredefinedorder.
∙Thetablecontrolsteploopisprocessedrowbyrow.Fieldswithcorrespondingnamesaretransportedfromthemodulepooltothescreen.
∙Afterthesteploophasbeenprocessedallremainingmodulepoolfieldsaretransportedtothescreen.
PAI(ProcessAfterInput)
∙AllscreenfieldsthatdonotbelongtoatablecontrolandarenotspecifiedinaFIELDstatementaretransportedtomodulepoolfields
∙Tabl
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Create Table Control Using ABAP Programming
链接地址:https://www.bdocx.com/doc/15929529.html