您好,欢迎访问三七文档
WebDynproABAPFrameworkallowsyoutocreateyourowninputhelpcomponents.AcomponenttobeusedasvaluehelpmustimplementinterfaceIWD_VALUE_HELP(seeWorkingwithWebDynproComponentInterfaces).Oncethefreelyprogrammedvaluehelphasbeenlinkedtoacontextattribute,thevaluehelpisautomaticallyavailableforeveryInputFieldlinkedtothisattribute.ForDetails::CreateaWebdynproComponentwithname'ZWDC_HELP_1'.PressEnter.DeclaretheIWD_VALUE_HELPinImplementedInterfaceslistinyourWDcomponentasshownbelow.PressEnter.AfterpressingReimplementbutton,youwillseeasshownbelow.GotothepropertiestabofCOMPONENTCONTROLLERandpressCreateControllerUsage..AfterpressingtheCreateControllerUsagebutton,thecomponentwillbeshownasSelectthefirstcomponenti.e.WD_VALUE_HELPGotocontexttabtocreateanodeND_TEXTanditspropertiesareasshownbelowi.e.InterfacenodeasYES...Createanattribute...AttributenameINPUT_1anddeclaretypeasSTRING...GotoAttributestabandcreateanattributefortheinterfaceIF_WD_VALUE_HELP_LISTENERasVALUE_HELP_LISTENER(asshownbelow)GotoEventstab,youwillseetwoeventswhichareautomaticallycreatedassoonasyouaddthecontrollerWD_VALUE_HELPinthepropertiestabandtothataddanothereventVH_DATA_SELECTEDandcheckthatinterfacecheckbox..GotoMethodstabandthereyouwillseeamethodSET_VALUE_HELP_LISTENERwhichisautomaticallygenerated...Doubleclickonthatmethodandwritethefollowingcodeasshownbelow...WD_THIS-VALUE_HELP_LISTENER=LISTENER.ThengototheviewV_MAINandcreatethreeelementsLABEL,INPUTFIELDandBUTTON...GotocontexttabofthatviewanddraganddroptheinterfacenodeND_TEXTfromthecomponentcontroller...BindtheINPUTFIELDwiththeattributeINPUT_1...WriteOnActioneventforthebuttoncreatedasshownbelow...WritethefollowingcodeinthatOnActionbuttoneventhandlermethod...WD_COMP_CONTROLLER-FIRE_VH_DATA_SELECTED_EVT().WD_COMP_CONTROLLER-VALUE_HELP_LISTENER-CLOSE_WINDOW().GotothewindowcontrollerandtherewillbeawindownamedWD_VALUE_HELP...DraganddroptheViewV_MAINtothatwindow...NowtheabovecomponentwilldisplayassoonasF4buttonispressedinthefollowingcomponent.CreateanothercomponentZWDC_HELP_RESULTCreateviewV_MAINasshownbelowGotoUsedComponentstabandincludethecomponentcreatedpreviouslyZWDC_HELP_1andnameitasFREEasshownbellow...GotoCOMPONENTCONTROLLERandfurthertopropertiestab...IncludethatUsedComponentFREEasshownbelow...GototheContextoftheCOMPONENTCONTROLLERandthereyouwillseetheInterfacenodeND_TEXTwhichyouhavecreatedinthepreviouscomponent...Draganddropit...CreateanotherNodeND_RESULTandanAttributeRESTEXTwithTypeasSTRING,InputHelpModeasFreelyProgrammedandincludethecomponentnamewhichyouhavedefinedasshownbelow...GotoMethodstabandcreateanEventHandlerMethodTESTandincludetheeventVH_DATA_SELECTEDinthecomponentuseFREEasshown...DoubleclickthatEventHandlerMethodTESTandwritethefollowingcodingforgettingtheInputfieldvaluefromFREEcomponentandsettingthatvaluetotheAttributewhichyouhavecreatedinthiscomponent...(GetcodingfromtheReadContextinWizard)DATALO_ND_ND_TEXTTYPEREFTOIF_WD_CONTEXT_NODE.DATALO_EL_ND_TEXTTYPEREFTOIF_WD_CONTEXT_ELEMENT.DATALS_ND_TEXTTYPEWD_THIS-ELEMENT_ND_TEXT.DATALV_INPUT_1LIKELS_ND_TEXT-INPUT_1.DATALO_ND_ND_RESULTTYPEREFTOIF_WD_CONTEXT_NODE.DATALO_EL_ND_RESULTTYPEREFTOIF_WD_CONTEXT_ELEMENT.DATALS_ND_RESULTTYPEWD_THIS-ELEMENT_ND_RESULT.DATALV_RESTEXTLIKELS_ND_RESULT-RESTEXT.*navigatefromCONTEXTtoND_TEXTvialeadselectionLO_ND_ND_TEXT=WD_CONTEXT-GET_CHILD_NODE(NAME=WD_THIS-WDCTX_ND_TEXT).*getelementvialeadselectionLO_EL_ND_TEXT=LO_ND_ND_TEXT-GET_ELEMENT().*getsingleattributeLO_EL_ND_TEXT-GET_ATTRIBUTE(EXPORTINGNAME=`INPUT_1`IMPORTINGVALUE=LV_INPUT_1).*navigatefromCONTEXTtoND_RESULTvialeadselectionLO_ND_ND_RESULT=WD_CONTEXT-GET_CHILD_NODE(NAME=WD_THIS-WDCTX_ND_RESULT).*getelementvialeadselectionLO_EL_ND_RESULT=LO_ND_ND_RESULT-GET_ELEMENT().LV_RESTEXT=LV_INPUT_1.*SetsingleattributeLO_EL_ND_RESULT-SET_ATTRIBUTE(EXPORTINGNAME=`RESTEXT`VALUE=LV_RESTEXT).NowgototheviewV_MAINandfurthertotheContexttab..DraganddroptheCreatednodeND_RESULTfromthecontextofCOMPONENTCONTROLLERtothisviewcontext..GototheLayoutoftheViewandcreateaLabelandInputfieldBindthevaluefortheinputfieldtotheattributeRESTEXTasshownbelow...NowcreatetheApplicationforthiscomponent..RuntheApplication..TheresultwillbeAssoontheuserpresstheF4button,youwillseeasshownbelowPressApplyButtonandthevaluepassestotheInputfield...
本文标题:Freely Programmed Value Help in the WebDynpro appl
链接地址:https://www.777doc.com/doc-3970233 .html