0% found this document useful (0 votes)
533 views10 pages

Automatically Trigger OnEnter Event After Selec..

Automatically Trigger OnEnter Event After Selec

Uploaded by

abhilash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
533 views10 pages

Automatically Trigger OnEnter Event After Selec..

Automatically Trigger OnEnter Event After Selec

Uploaded by

abhilash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

01/04/2016

AutomaticallyTriggeronEntereventafterselec...|SCN

GettingStarted Newsletters

Hi,Guest

LogOn

JoinUs

Products

Services&Support

AboutSCN

Downloads

Industries

Training&Education

Partnership

DeveloperCenter

Activity

LinesofBusiness

UniversityAlliances

Events&Webinars

Innovation

Browse

AutomaticallyTriggeronEntereventafter
selectingvaluefromtheValueHelp(F4Help)

Store

SearchtheCommunity

Communications

Actions

Version1

createdbyKiranKumarValluruon02Aug201313:04,lastmodifiedbyKiranKumarValluruon02Aug201314:39

Share

Tweet

Like

Introduction
ThisdocumenthelpshowtocallonEnteractionhandlerofInputfiledafterselectingvalueintheValueHelp
withoutpressingEnterKey.IntheearlierversionsofNetweaver(beforeNetweaver7.4)youhaveto
manuallypressEnterkeyintheInputfieldafterselectingvaluefromtheF4help.

Prerequisites
SAPNetWeaver7.4

StepbyStepProcess
Step1:CreateaWebDynproComponent.
GototheSE80transactionandcreateaWebDynproComponent.

EnterDescriptionandclickonOK.

http://scn.sap.com/docs/DOC44817

1/10

01/04/2016

AutomaticallyTriggeronEntereventafterselec...|SCN

SaveandActivatetheComponent.

Step2:DataBinding
GototheContexttabofMainViewandcreateanattributeCARRIDoftypeS_CARRID_ID(whichhasdictionary
searchhelp).

http://scn.sap.com/docs/DOC44817

2/10

01/04/2016

AutomaticallyTriggeronEntereventafterselec...|SCN

Step3:LayoutDesign.
NowGotoLayouttab,
CreatelabelUIwithtext'Airlineandinputfield.BindtheValueofInputfiledtothecontextattributeCARRID.

CreateanActionforonEnterofInputfield.

NowgotoMethodstabofMAINviewandwritethebelowcodeONACTIONGET_FLIGHTDATAmethod.

ONACTIONGET_FLIGHTDATA
methodONACTIONGET_FLIGHTDATA.
**GettheAirlineandupdatethedependentinputfields/viewfields
**orGettheFlightData
*ForDemopurposeIamjustdisplayingasuccessmessage
*Reportsuccessmessage
wd_this>wd_get_api()>get_message_manager()>report_success('OnEnterEventTriggered').
endmethod.

Step4:CreateApplication.
SaveandActivatetheWebDynproComponent.CreatetheWebDynproApplicationandSaveit.

http://scn.sap.com/docs/DOC44817

3/10

01/04/2016

AutomaticallyTriggeronEntereventafterselec...|SCN

Enterdescriptionandsaveit.

TestApplication
NowRightclickonWebDynproApplicationandclickonTest.

NowSelecttheF4helpintheinputfield.

http://scn.sap.com/docs/DOC44817

4/10

01/04/2016

AutomaticallyTriggeronEntereventafterselec...|SCN

SelecttheValueintheValueHelpandclickonOK.

AfterselectingthevaluewehavetopressEntertotriggeronEnterevent.

NowwecanseeonEntereventwastriggeredafterpressingEntermanuallyintheInputField.

http://scn.sap.com/docs/DOC44817

5/10

01/04/2016

AutomaticallyTriggeronEntereventafterselec...|SCN

ItispreferablethattheonEnteractionhandlerofanInputFieldsisexecuteddirectlyafteravaluehasbeenselected
fromthevaluehelp.

ToTriggertheonEntereventofInputfieldsautomaticallyafterselectingthevaluefromthevaluehelp,wehavetocall
themethodregister_on_enter_for_f4()ofinterfaceIF_WD_VIEW_CONTROLLER.

WehavetowritethebelowcodeinWDDOINITmethod.

DATAlr_view_controllerTYPEREFTOcl_wdr_view.
lr_view_controller?=wd_this>wd_get_api().

lr_view_controller>if_wd_view_controller~register_on_enter_for_f4(register_on_enter=
abap_true).

WritethebelowcodeinWDDOINITmethod.

WDDOINIT
methodWDDOINIT.
*RegisteronEnterforValueHelp
wd_this>wd_get_api()>register_on_enter_for_f4(register_on_enter=abap_true).
endmethod.

Note:Thissettingcanbemadeforallvaluehelpsforeachviewseparatelybycallingmethod
register_on_enter_for_f4()intheWDDOINITmethodofeachview.

SaveandActivatetheComponent.

Result
NowTesttheWebDynproApplication.

SelecttheF4helpintheinputfield.

SelecttheValueintheValueHelpandclickonOK.

http://scn.sap.com/docs/DOC44817

6/10

01/04/2016

AutomaticallyTriggeronEntereventafterselec...|SCN

AfterselectingthevaluewecanseetheonEnteractionhandleriscalledautomatically.

Conclusion

UsingthisfeaturewecanmakeonEnteractionhandlertocallautomaticallyimmediatelyafterselectingthevaluefrom
theValueHelp.ThisfeatureisusefultoupdatetheotherViewFieldsthataredependentontheinputfieldbycalling
onEnteractionhandleroftheinputfieldsautomaticallyafterselectingthevaluefromtheValueHelp.HereI
demonstratedasimpleWebDynproApplication.Youcanusethisaccordingtoyourrequirements.

FollowmeonGoogle+

8877Views

Topics:abap,web_dynproTags:web_dynpro_abap,netweaver7.4,onenter,register_on_enter_for_f4()

AverageUserRating
(12ratings)

Share

Tweet

Like

17Comments
karthikk25Aug201315:28

Nicedocument.Helpful.Thanksforsharing!

Regards,

http://scn.sap.com/docs/DOC44817

7/10

01/04/2016

AutomaticallyTriggeronEntereventafterselec...|SCN
Karthik
Like(0)

ChrisPaine29Aug201309:01

Forthosewhoaren'tyetat7.4levelhere'sablogIwrote3yearsagowhichbasicallyshowshowto
dothesamethingona7.1stack

FiringaWDAeventonusingaSearchHelphowtodoit,withoutanNDA

Cheers,
Chris
Like(1)

VRV02Feb201522:09(inresponsetoChrisPaine)

HiChris,

WillthisbeapplicabletoDatefieldalso...
Like(0)

ChrisPaine02Feb201523:22(inresponsetoVRV)

Hi,amafraidI'mnotsure.IalwaysfollowedthepatternofusingdatenavigatorifI
neededanimmediateeventondateselection.Althoughitislikelythatbyslightly
changingthecodeImentioninmyblogthatyouwouldbeabletogetthedateto
event.However,usingthedatenavigatorwouldbeamuchsimpleroption.
Like(0)

VRV03Feb201515:48(inresponsetoChrisPaine)

ButcanweasssignDateNavigatortoSearchHelpofInputfield.

AsofnowiamusingSYDATUMasfieldtypeforInputfieldsoits
populatingcalendarinthesearhhelp.

DateNavigatorfunctionalityworksinthesimilarway
Like(0)

ChrisPaine04Feb201502:00(inresponsetoVRV)

No,notassignassearchhelp,useinsteadofinputfield.Asit
throwsaneventondateselection.
Like(0)

BhanuMalik29Aug201316:49

HiKiran,
NiceDocument.Onequestionwillitbepossibletotriggeredtheeventoncustomsearchhelpstoo?
Like(0)

KiranKumarValluru29Aug201320:27(inresponsetoBhanuMalik)

HiBhanu,

Whatdoyoumeanbycustomsearchhelps?DidyoumeanDDICZsearchhelps!Ifso,the
answerisyes.ForallDDICsearchhelpsthiswillwork.

ForOVSsearchhelp,thiswon'ttriggerautomatically.ForOVSintheevenhandlerofOVS
youcancallthemethodexplictly.

Regards,
Kiran
Like(0)

KatriceHawkins21Sep201311:54

Hello KiranKumarValluru,
IfollowedyoudocumenttoregisteraneventonI/Pfield.BelowisthecodeiwritteninmyWDDOINIT(
)ofmyViewcontrollerwhichishavingoneI/Pfield.

DATAlr_view_controllerTYPEREFTOcl_wdr_view.
lr_view_controller?=wd_this>wd_get_api().
lr_view_controller>if_wd_view_controller~register_on_enter_for_f4(register_on_enter=abap_true
).

Buti'mgettingerror"IF_WD_VIEW_CONTROLLER~REGISTER_ON_EVENT_FOR_F4isnot
declaredorinheritedinclass"CL_WDR_VIEW".Plsguideme.

http://scn.sap.com/docs/DOC44817

8/10

01/04/2016

AutomaticallyTriggeronEntereventafterselec...|SCN
Thanks
Katrice

Like(0)

KiranKumarValluru22Sep201305:01(inresponsetoKatriceHawkins)

Hi,

Pleaseseetheprerequisite.YoushouldbeonNetweaver7.4tousethementionedmethod.
IfyouareonlowerNetweaverversionyoucanfollowtheblogwhichChisPainehas
mentionedaboveinthecomments.

Cheers,
Kiran
Like(1)

NallasivamBalu13Oct201414:52(inresponsetoKiranKumarValluru)

HiKiran,

WillitworkfortheStandardDateinputfield?

IhaveanOn_EntermethodfortheDateinputfield.Willthesamemethodwill
triggerthemethodwhileselectingtehdatefromthecalendar.

Itriedbutitdidntgottriggered.Pleasegiveyoursuggestion.

Thanks
NallaB.
Like(0)

KiranKumarValluru13Oct201415:02(inresponsetoNallasivamBalu)

Hi,

No,TheonEntereventwillnotbecalledautomaticallyfordatefieldsas
thereisnoscreenrenderwhenyouselectthedatefromdatevaluehelp.

Regards,
Kiran
Like(1)

NallasivamBalu13Oct201415:02(inresponsetoKiranKumarValluru)

Thankskiran.

ButIhaveadropdownvaluewhichhastobeloadedbasedon
thedatesintheinputfield?

WhatisthepossibilityotherthanOn_Enterorgoingforacustom
buttontoloadthevalues?

Kindlygivesomesuggestions.

Thanks,
NallaB.
Like(0)

KiranKumarValluru13Oct201415:14(inresponseto
NallasivamBalu)

Hi,

Asmentionedearlier,youcannottriggerEnterevent
automaticallyfordatefields.Youneedtopress
Enter(orsomeaction)afterenteringdates.Or,remove
thedatefieldandcreateaDateNavigatorwithevents
associatedwithit.OrcreatingaFreelyprogrammed
valuehelpforcalendarhelpwhichistricky.

Regards,
Kiran
Like(0)

KatriceHawkins01Feb201408:25

HiKiran,
Itisveryuseful.Itireditoninputfieldsanditworked.ButhowtotriggerthesameinALVtablehaving
inputfields?.

Because,ihaveToDatefieldinmyALVtable,ifweselecttodateaspastdateandonpressonenter
only,Itistriggeringtheevent.Iwanttoachievethesameasperyourdocument.

http://scn.sap.com/docs/DOC44817

9/10

01/04/2016

AutomaticallyTriggeronEntereventafterselec...|SCN

Thanks
Katrice
Like(0)

SRIKANTHD07Nov201406:22

Its'veryuseful.Thanks

Srikanth
Like(0)

SameerDhuke22Apr201516:58

HiKiran,

Thanksfortheblog.

Iamfacingoneissuewithit.Theactionistriggeringtwiceinmycase.Iamselectingthevaluefrom
F4helpanditscallingthesameactiontwice.

Iamshowinginonepopupinthisactionanditscomingtwice.

Isthereanywaytostopthis?

ThanksinAdvance.

Regards,
Sameer
Like(0)

SiteIndex
Privacy

ContactUs
TermsofUse

http://scn.sap.com/docs/DOC44817

SAPHelpPortal
LegalDisclosure

Copyright

FollowSCN

10/10

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy