下载

0下载券

加入VIP
  • 专属下载特权
  • 现金文档折扣购买
  • VIP免费专区
  • 千万文档免费下载

上传资料

关闭

关闭

关闭

封号提示

内容

首页 AVL event handling

AVL event handling.pdf

AVL event handling

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

简介:本文档为《AVL event handlingpdf》,可适用于IT/计算机领域

ALVObjectModel–SimpleDTable–EventHandlingSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGALVObjectModel–SimpleDTable–EventHandlingAppliesto:NetweaverandNetweaversSummaryThistutorialwillshowhowtoimplementeventhandlingwhenusingthenewALVobjectmodelFormoreexamples,seeanyprogramwhichbeginswithSALV*inyourNetweaverABAPSystemAuthor(s):RichHeilmanCompany:YorktowneCabinetryCreatedon:SeptemberRichHeilmanisanABAPJEESoftwareEngineerAnalystforYorktowneCabinetry,IncbasedinRedLion,Pennsylvania,USAHehasatotalofnineyearsexperienceintheITindustryHehasspentthepastfiveyearsstudyingABAPandJavaALVObjectModel–SimpleDTable–EventHandlingSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGTableofContentsAppliesto:SummaryTheBasicProgramSettheGuiStatusEventHandlersEventADDEDFUNCTIONEventHandlersEventDOUBLECLICKRelatedContentDisclaimerandLiabilityNoticeALVObjectModel–SimpleDTable–EventHandlingSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGTheBasicProgramStartingwiththeprogrambelow,wewilladdcodingtohandlesomeeventsfortheALVGridInthisexampletheeventsDOUBLECLICKandADDEDFUNCTIONwillbehandledreportzalvomdemodata:ispflitypetableofspflidata:xspflitypespflidata:grtabletypereftoclsalvtabledata:grselectionstypereftoclsalvselectionsstartofselectionselect*intocorrespondingfieldsoftableispflifromspfliuptorowscallmethodclsalvtable=>factoryimportingrsalvtable=grtablechangingttable=ispfli*Setupselectionsgrselections=grtable>getselections()grselections>setselectionmode()"Single*Displaygrtable>display()ALVObjectModel–SimpleDTable–EventHandlingSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGSettheGuiStatusNext,gotofunctiongroupSALVMETADATASTATUSandcopytheguistatusSALVTABLESTANDARDintotheZALVOMDEMOprogramThisisthestandardguistatusfortheDimensionalTableALVgridOnceyouhavecopiedthestatus,setthescreenstatususingtheappropriatemethodoftheobjectGRTABLEGototheguistatusandaddanewbuttonontheapplicationtoolbarandnameitas“MYFUNCTION”reportzalvomdemodata:ispflitypetableofspflidata:xspflitypespflidata:grtabletypereftoclsalvtabledata:grselectionstypereftoclsalvselectionsstartofselectionselect*intocorrespondingfieldsoftableispflifromspfliuptorowscallmethodclsalvtable=>factoryimportingrsalvtable=grtablechangingttable=ispfligrtable>setscreenstatus(pfstatus='SALVTABLESTANDARD'report=syrepidsetfunctions=grtable>cfunctionsall)*Setupselectionsgrselections=grtable>getselections()grselections>setselectionmode()"Single*Displaygrtable>display()ALVObjectModel–SimpleDTable–EventHandlingSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGEventHandlersEventADDEDFUNCTIONNext,createalocalclasswhichwillactastheeventhandler,definetheeventhandlermethodfortheADDEDFUNCTIONeventDefineanobjectreferencevariableforthelocalclassRetrievetheeventsobjectfromtheGRTABLE,createtheeventhandlerobjectandsetthehandlermethodfortheeventFinally,addtheimplementationfortheONUSERCOMMANDeventhandlermethodreportzalvomdemodata:ispflitypetableofspflidata:xspflitypespflidata:grtabletypereftoclsalvtabledata:greventstypereftoclsalveventstabledata:grselectionstypereftoclsalvselections***CLASSlclhandleeventsDEFINITION*****classlclhandleeventsdefinitionpublicsectionmethods:onusercommandforeventaddedfunctionofclsalveventsimportingesalvfunction,endclass"lclhandleeventsDEFINITIONdata:eventhandlertypereftolclhandleeventsstartofselectionselect*intocorrespondingfieldsoftableispflifromspfliuptorowscallmethodclsalvtable=>factoryimportingrsalvtable=grtablechangingttable=ispfligrtable>setscreenstatus(pfstatus='SALVTABLESTANDARD'report=syrepidsetfunctions=grtable>cfunctionsall)grevents=grtable>getevent()createobjecteventhandlersethandlereventhandler>onusercommandforgrevents*SetupselectionsALVObjectModel–SimpleDTable–EventHandlingSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGgrselections=grtable>getselections()grselections>setselectionmode()"Single*Displaygrtable>display()***CLASSlclhandleeventsIMPLEMENTATION*****classlclhandleeventsimplementationmethodonusercommand*Gettheselectionrowsdata:lrselectionstypereftoclsalvselectionsdata:ltrowstypesalvtrowdata:lsrowstypeidata:messagetypestringcaseesalvfunctionwhen'MYFUNCTION'lrselections=grtable>getselections()ltrows=lrselections>getselectedrows()readtableltrowsintolsrowsindexreadtableispfliintoxspfliindexlsrowsconcatenatexspflicarridxspfliconnidxspflicityfromxspflicitytointomessageseparatedbyspacemessagei()with'Youpushedthebutton!'messageendcaseendmethod"onusercommandendclass"lclhandleeventsIMPLEMENTATIONALVObjectModel–SimpleDTable–EventHandlingSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGRuntheprogram,selectarowbysingleclickingonitandclicktheiconforthenewfunctionthatyouaddedNoticethatsomeofthedataintherowthatwasclickedisnowshowinginthemessageALVObjectModel–SimpleDTable–EventHandlingSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGEventHandlersEventDOUBLECLICKDefinetheeventhandlermethodforDOUBLECLICKeventandaddtheimplementationfortheONDOUBLECLICKeventhandlermethodRemembertosetthehandlerfortheeventreportzalvomdemodata:ispflitypetableofspflidata:xspflitypespflidata:grtabletypereftoclsalvtabledata:grfunctionstypereftoclsalvfunctionslistdata:greventstypereftoclsalveventstabledata:grselectionstypereftoclsalvselections***CLASSlclhandleeventsDEFINITION*****classlclhandleeventsdefinitionpublicsectionmethods:onusercommandforeventaddedfunctionofclsalveventsimportingesalvfunction,ondoubleclickforeventdoubleclickofclsalveventstableimportingrowcolumnendclass"lclhandleeventsDEFINITIONdata:eventhandlertypereftolclhandleeventsstartofselectionselect*intocorrespondingfieldsoftableispflifromspfliuptorowscallmethodclsalvtable=>factoryimportingrsalvtable=grtablechangingttable=ispfligrtable>setscreenstatus(pfstatus='SALVTABLESTANDARD'report=syrepidsetfunctions=grtable>cfunctionsall)grevents=grtable>getevent()createobjecteventhandlersethandlereventhandler>onusercommandforgreventsALVObjectModel–SimpleDTable–EventHandlingSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGsethandlereventhandler>ondoubleclickforgrevents*Setupselectionsgrselections=grtable>getselections()grselections>setselectionmode()"Single*Displaygrtable>display()***CLASSlclhandleeventsIMPLEMENTATION*****classlclhandleeventsimplementationmethodonusercommand*Gettheselectionrowsdata:lrselectionstypereftoclsalvselectionsdata:ltrowstypesalvtrowdata:lsrowstypeidata:messagetypestringcaseesalvfunctionwhen'MYFUNCTION'lrselections=grtable>getselections()ltrows=lrselections>getselectedrows()readtableltrowsintolsrowsindexreadtableispfliintoxspfliindexlsrowsconcatenatexspflicarridxspfliconnidxspflicityfromxspflicitytointomessageseparatedbyspacemessagei()with'Youpushedthebutton!'messageendcaseendmethod"onusercommandmethodondoubleclickdata:messagetypestringdata:rowc()typecrowc=rowconcatenate'Row'rowc'Column'columnintomessageseparatedbyspacemessagei()with'Youdoubleclickedon'messageendmethod"ondoubleclickendclass"lclhandleeventsIMPLEMENTATIONALVObjectModel–SimpleDTable–EventHandlingSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGRuntheprogram,doubleclickonthefifthrowintheDepartCitycolumn,noticetheinformationmessagecontainstherownumberandcolumnnameofthecellwhichyoudoubleclickedALVObjectModel–SimpleDTable–EventHandlingSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGRelatedContentHelpALVObjectModelUtilizingtheNewALVObjectModelSDNABAPForumALVObjectModel–SimpleDTable–EventHandlingSAPDEVELOPERNETWORK|sdnsapcomBUSINESSPROCESSEXPERTCOMMUNITY|bpxsapcom©SAPAGDisclaimerandLiabilityNoticeThisdocumentmaydiscusssamplecodingorotherinformationthatdoesnotincludeSAPofficialinterfacesandthereforeisnotsupportedbySAPChangesmadebasedonthisinformationarenotsupportedandcanbeoverwrittenduringanupgradeSAPwillnotbeheldliableforanydamagescausedbyusingormisusingtheinformation,codeormethodssuggestedinthisdocument,andanyoneusingthesemethodsdoessoathisherownriskSAPoffersnoguaranteesandassumesnoresponsibilityorliabilityofanytypewithrespecttothecontentofthistechnicalarticleorcodesample,includinganyliabilityresultingfromincompatibilitybetweenthecontentwithinthisdocumentandthematerialsandservicesofferedbySAPYouagreethatyouwillnothold,orseektohold,SAPresponsibleorliablewithrespecttothecontentofthisdocumentAppliesto:SummaryTableofContentsTheBasicProgramSettheGuiStatusEventHandlersEventADDEDFUNCTIONEventHandlersEventDOUBLECLICKRelatedContentDisclaimerandLiabilityNotice

用户评价(0)

关闭

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

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

提示

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

评分:

/12

VIP

在线
客服

免费
邮箱

爱问共享资料服务号

扫描关注领取更多福利