下载

0下载券

加入VIP
  • 专属下载券
  • 上传内容扩展
  • 资料优先审核
  • 免费资料无限下载

上传资料

关闭

关闭

关闭

封号提示

内容

首页 ALV object data model

ALV object data model.pdf

ALV object data model

sophsong
2011-10-27 0人阅读 举报 0 0 0 暂无简介

简介:本文档为《ALV object data modelpdf》,可适用于IT/计算机领域

ALVObjectModel–SimpleDTableTheBasicsSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGALVObjectModel–SimpleDTableTheBasicsAppliesto:NetweaverandNetweaversSummaryThistutorialisthefirstoftheseries,whichdealswiththeALVObjectModelInthistutorial,youwilllearnhowtocreateasimpletwodimensionaltablereportusingtheALVObjectModelAuthor(s):RichHeilmanCompany:YorktowneCabinetryCreatedon:SeptemberAuthorBioRichHeilmanisanABAPJEESoftwareEngineerAnalystforYorktowneCabinetry,IncbasedinRedLion,Pennsylvania,USAHehasatotalofnineyearsexperienceintheITindustryHehasspentthepastfiveyearsstudyingABAPandJavaALVObjectModel–SimpleDTableTheBasicsSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGTableofContentsAppliesto:SummaryAuthorBioMainClass–CLSALVTABLEFunctions–CLSALVFUNCTIONSDisplaySettings–CLSALVDISPLAYSETTINGSColumns–CLSALVCOLUMNSTABLEandCLSALVCOLUMNTABLESorts–CLSALVSORTSAggregations–CLSALVAGGREGATIONSFilters–CLSALVFILTERSLayouts–CLSALVLAYOUTRelatedContentDisclaimerandLiabilityNoticeALVObjectModel–SimpleDTableTheBasicsSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGMainClass–CLSALVTABLEThemainclassusedtocreatethesimpleDtableistheclassCLSALVTABLECreateareferencevariableforthisclassCreateaninternaltableandfillthisinternaltablewithdataasshowbelowREPORTZALVOMDEMOdata:ispflitypetableofspflidata:grtabletypereftoclsalvtablestartofselectionselect*intotableispflifromspfliNextweneedtocreatetheALVobjectfortheDtableTheFACTORYmethodallowsyoutocreatetheALVobjectinwaysYoucancreatetheALVGrid,asaclassicallistdisplay,asafullscreengrid,andfinallyembeddedintoascreencontainerForthisexample,wewillbeworkingwiththefullscreengridCreatethecalltotheFACTORYmethodWeareimportingtheobjectreferenceintoGRTABLEandpassingtheinternaltableISPFLIclsalvtable=>factory(importingrsalvtable=grtablechangingttable=ispfli)Nextweneedtodisplaythegrid,forthisweusetheDISPLAYmethodSimplycallitgrtable>display()ALVObjectModel–SimpleDTableTheBasicsSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGFunctions–CLSALVFUNCTIONSNext,addfunctionstotheapplicationtoolbarForthis,usetheCLSALVFUNCTIONSclassCreatetheobjectreferencevariableandreceivetheobjectusingtheGETFUNCTIONSmethodoftheGRTABLEobjectCallthemethodSETALLtoforcetheALVgridtoshowallstandardfunctionsreportzalvomdemodata:ispflitypetableofspflidata:grtabletypereftoclsalvtabledata:grfunctionstypereftoclsalvfunctionsstartofselectionselect*intotableispflifromspfliclsalvtable=>factory(importingrsalvtable=grtablechangingttable=ispfli)grfunctions=grtable>getfunctions()grfunctions>setall(abaptrue)grtable>display()TheresultisnowyouhavethestandardbuttonsontheapplicationtoolbarDisplaySettings–CLSALVDISPLAYSETTINGSNext,wecanchangesomedisplaysettingsusingtheclassCLSALVDISPLAYSETTINGSCreatetheobjectreferencevariableandreceivetheobjectusingtheGETDISPLAYSETTINGSmethodoftheGRTABLEobjectInthisexample,wearesettingthe“StripedPattern”fortheALVGridrows,andsettingtheheadinginthetitlebarreportzalvomdemoALVObjectModel–SimpleDTableTheBasicsSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGdata:ispflitypetableofspflidata:grtabletypereftoclsalvtabledata:grfunctionstypereftoclsalvfunctionsdata:grdisplaytypereftoclsalvdisplaysettingsstartofselectionselect*intotableispflifromspfliclsalvtable=>factory(importingrsalvtable=grtablechangingttable=ispfli)grfunctions=grtable>getfunctions()grfunctions>setall(abaptrue)grdisplay=grtable>getdisplaysettings()grdisplay>setstripedpattern(clsalvdisplaysettings=>true)grdisplay>setlistheader('Thisistheheading')grtable>display()Columns–CLSALVCOLUMNSTABLEandCLSALVCOLUMNTABLENext,wecanchangesomeoftheattributesofaspecificcolumnintheALVgridInthisexamplewewillchangetheHeadingTextofacolumnaswellasthecolorofacolumnCreatetheobjectreferencevariableandreceivetheobjectusingtheGETCOLUMNSmethodoftheGRTABLEobjectThiswillpassyoutheobjectforallcolumnsoftheALVgridToaccessjustonecolumn,callthemethodGETCOLUMNfromtheGRCOLUMNSobjectInthisexample,weareaccessingtheCITYTOcolumnandtheCITYFROMcolumnreportzalvomdemodata:ispflitypetableofspflidata:grtabletypereftoclsalvtabledata:grfunctionstypereftoclsalvfunctionsALVObjectModel–SimpleDTableTheBasicsSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGdata:grdisplaytypereftoclsalvdisplaysettingsdata:grcolumnstypereftoclsalvcolumnstabledata:grcolumntypereftoclsalvcolumntabledata:colortypelvcscolostartofselectionselect*intotableispflifromspfliclsalvtable=>factory(importingrsalvtable=grtablechangingttable=ispfli)grfunctions=grtable>getfunctions()grfunctions>setall(abaptrue)grdisplay=grtable>getdisplaysettings()grdisplay>setstripedpattern(clsalvdisplaysettings=>true)grdisplay>setlistheader('Thisistheheading')grcolumns=grtable>getcolumns()grcolumn=grcolumns>getcolumn('CITYTO')grcolumn>setlongtext('Thisislongtext')grcolumn>setmediumtext('Thisismedtext')grcolumn>setshorttext('Thisissh')grcolumn=grcolumns>getcolumn('CITYFROM')colorcol=''colorint=''colorinv=''grcolumn>setcolor(color)grtable>display()ALVObjectModel–SimpleDTableTheBasicsSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGALVObjectModel–SimpleDTableTheBasicsSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGSorts–CLSALVSORTSNext,wecanaddsomesortingtotheALVgridCreatetheobjectreferencevariableandreceivetheobjectusingtheGETSORTSmethodoftheGRTABLEobjectNext,addthesortbycallingtheADDSORTmethodoftheGRSORTSobjectreportzalvomdemodata:ispflitypetableofspflidata:grtabletypereftoclsalvtabledata:grfunctionstypereftoclsalvfunctionsdata:grdisplaytypereftoclsalvdisplaysettingsdata:grcolumnstypereftoclsalvcolumnstabledata:grcolumntypereftoclsalvcolumntabledata:grsortstypereftoclsalvsortsdata:colortypelvcscolostartofselectionselect*intotableispflifromspfliclsalvtable=>factory(importingrsalvtable=grtablechangingttable=ispfli)grfunctions=grtable>getfunctions()grfunctions>setall(abaptrue)grdisplay=grtable>getdisplaysettings()grdisplay>setstripedpattern(clsalvdisplaysettings=>true)grdisplay>setlistheader('Thisistheheading')grcolumns=grtable>getcolumns()grcolumn=grcolumns>getcolumn('CITYTO')grcolumn>setlongtext('Thisislongtext')grcolumn>setmediumtext('Thisismedtext')grcolumn>setshorttext('Thisissh')grcolumn=grcolumns>getcolumn('CITYFROM')colorcol=''colorint=''colorinv=''grcolumn>setcolor(color)grsorts=grtable>getsorts()grsorts>addsort'CITYTO')grtable>display()ALVObjectModel–SimpleDTableTheBasicsSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGALVObjectModel–SimpleDTableTheBasicsSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGAggregations–CLSALVAGGREGATIONSSincewesortedbyCITYTO,wecanaddanaggregationtosubtotaltheDISTANCEbyCITYTOCreatetheobjectreferencevariableandreceivetheobjectusingtheGETAGGREGATIONSmethodoftheGRTABLEobjectNext,addtheaggregationbycallingtheADDAGGREGATIONmethodoftheGRSORTSobjectWealsoneedtomodifythecalltoADDSORTtosettheSUBTOTAL=ABAPTRUEreportzalvomdemodata:ispflitypetableofspflidata:grtabletypereftoclsalvtabledata:grfunctionstypereftoclsalvfunctionsdata:grdisplaytypereftoclsalvdisplaysettingsdata:grcolumnstypereftoclsalvcolumnstabledata:grcolumntypereftoclsalvcolumntabledata:grsortstypereftoclsalvsortsdata:graggtypereftoclsalvaggregationsdata:colortypelvcscolostartofselectionselect*intotableispflifromspfliclsalvtable=>factory(importingrsalvtable=grtablechangingttable=ispfli)grfunctions=grtable>getfunctions()grfunctions>setall(abaptrue)grdisplay=grtable>getdisplaysettings()grdisplay>setstripedpattern(clsalvdisplaysettings=>true)grdisplay>setlistheader('Thisistheheading')grcolumns=grtable>getcolumns()grcolumn=grcolumns>getcolumn('CITYTO')grcolumn>setlongtext('Thisislongtext')grcolumn>setmediumtext('Thisismedtext')grcolumn>setshorttext('Thisissh')grcolumn=grcolumns>getcolumn('CITYFROM')colorcol=''colorint=''colorinv=''grcolumn>setcolor(color)grsorts=grtable>getsorts()grsorts>addsort(columnname='CITYTO'subtotal=abaptrue)gragg=grtable>getaggregations()gragg>addaggregation('DISTANCE')ALVObjectModel–SimpleDTableTheBasicsSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGgrtable>display()ALVObjectModel–SimpleDTableTheBasicsSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGFilters–CLSALVFILTERSUsingtheCLSALVFILTERSclasswecansetupsomefiltersforthedatainourALVGRIDCreatetheobjectreferencevariableandreceivetheobjectusingtheGETFILTERSmethodoftheGRTABLEobject,andthensimplycalledthemethodADDFILTERwiththeparametersreportzalvomdemodata:ispflitypetableofspflidata:grtabletypereftoclsalvtabledata:grfunctionstypereftoclsalvfunctionsdata:grdisplaytypereftoclsalvdisplaysettingsdata:grcolumnstypereftoclsalvcolumnstabledata:grcolumntypereftoclsalvcolumntabledata:grsortstypereftoclsalvsortsdata:graggtypereftoclsalvaggregationsdata:grfiltertypereftoclsalvfiltersdata:colortypelvcscolostartofselectionselect*intotableispflifromspfliclsalvtable=>factory(importingrsalvtable=grtablechangingttable=ispfli)grfunctions=grtable>getfunctions()grfunctions>setall(abaptrue)grdisplay=grtable>getdisplaysettings()grdisplay>setstripedpattern(clsalvdisplaysettings=>true)grdisplay>setlistheader('Thisistheheading')grcolumns=grtable>getcolumns()grcolumn=grcolumns>getcolumn('CITYTO')grcolumn>setlongtext('Thisislongtext')grcolumn>setmediumtext('Thisismedtext')grcolumn>setshorttext('Thisissh')grcolumn=grcolumns>getcolumn('CITYFROM')colorcol=''colorint=''colorinv=''grcolumn>setcolor(color)grsorts=grtable>getsorts()grsorts>addsort(columnname='CITYTO'subtotal=abaptrue)gragg=grtable>getaggregations()gragg>addaggregation('DISTANCE')ALVObjectModel–SimpleDTableTheBasicsSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGgrfilter=grtable>getfilters()grfilter>addfilter(columnname='CARRID'low='LH')grtable>display()ALVObjectModel–SimpleDTableTheBasicsSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGLayouts–CLSALVLAYOUTIfyouwanttoallowtheusertomanagelayoutsoftheALVgrid,youmustusetheclassCLSALVLAYOUTCreatetheobjectreferencevariableandreceivetheobjectusingtheGETLAYOUTmethodoftheGRTABLEobjectThensimplycallthemethodSETKEYwiththeparametersandsetthesaverestrictionusingtheSETSAVERESTRICTIONmethodreportzalvomdemodata:ispflitypetableofspflidata:grtabletypereftoclsalvtabledata:grfunctionstypereftoclsalvfunctionsdata:grdisplaytypereftoclsalvdisplaysettingsdata:grcolumnstypereftoclsalvcolumnstabledata:grcolumntypereftoclsalvcolumntabledata:grsortstypereftoclsalvsortsdata:graggtypereftoclsalvaggregationsdata:grfiltertypereftoclsalvfiltersdata:grlayouttypereftoclsalvlayoutdata:colortypelvcscolodata:keytypesalvslayoutkeystartofselectionselect*intotableispflifromspfliclsalvtable=>factory(importingrsalvtable=grtablechangingttable=ispfli)grfunctions=grtable>getfunctions()grfunctions>setall(abaptrue)grdisplay=grtable>getdisplaysettings()grdisplay>setstripedpattern(clsalvdisplaysettings=>true)grdisplay>setlistheader('Thisistheheading')grcolumns=grtable>getcolumns()grcolumn=grcolumns>getcolumn('CITYTO')grcolumn>setlongtext('Thisislongtext')grcolumn>setmediumtext('Thisismedtext')grcolumn>setshorttext('Thisissh')grcolumn=grcolumns>getcolumn('CITYFROM')colorcol=''colorint=''colorinv=''grcolumn>setcolor(color)grsorts=grtable>getsorts()grsorts>addsort(columnname='CITYTO'subtotal=abaptrue)gragg=grtable>getaggregations()ALVObjectModel–SimpleDTableTheBasicsSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGgragg>addaggregation('DISTANCE')grfilter=grtable>getfilters()grfilter>addfilter(columnname='CARRID'low='LH')grlayout=grtable>getlayout()keyreport=syrepidgrlayout>setkey(key)grlayout>setsaverestriction(clsalvlayout=>restrictnone)grtable>display()RelatedContent•HelpALVObjectModel•UtilizingtheNewALVObjectModel•SDNABAPForumALVObjectModel–SimpleDTableTheBasicsSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGDisclaimerandLiabilityNoticeThisdocumentmaydiscusssamplecodingorotherinformationthatdoesnotincludeSAPofficialinterfacesandthereforeisnotsupportedbySAPChangesmadebasedonthisinformationarenotsupportedandcanbeoverwrittenduringanupgradeSAPwillnotbeheldliableforanydamagescausedbyusingormisusingtheinformation,codeormethodssuggestedinthisdocument,andanyoneusingthesemethodsdoessoathisherownriskSAPoffersnoguaranteesandassumesnoresponsibilityorliabilityofanytypewithrespecttothecontentofthistechnicalarticleorcodesample,includinganyliabilityresultingfromincompatibilitybetweenthecontentwithinthisdocumentandthematerialsandservicesofferedbySAPYouagreethatyouwillnothold,orseektohold,SAPresponsibleorliablewithrespecttothecontentofthisdocumentAppliesto:SummaryAuthorBioTableofContentsMainClass–CLSALVTABLEFunctions–CLSALVFUNCTIONSDisplaySettings–CLSALVDISPLAYSETTINGSColumns–CLSALVCOLUMNSTABLEandCLSALVCOLUMNTABLESorts–CLSALVSORTSAggregations–CLSALVAGGREGATIONSFilters–CLSALVFILTERSLayouts–CLSALVLAYOUTRelatedContentDisclaimerandLiabilityNotice

用户评价(0)

关闭

新课改视野下建构高中语文教学实验成果报告(32KB)

抱歉,积分不足下载失败,请稍后再试!

提示

试读已结束,如需要继续阅读或者下载,敬请购买!

评分:

/16

VIP

在线
客服

免费
邮箱

爱问共享资料服务号

扫描关注领取更多福利