您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > Simple-BSP-application-to-Create
SimpleBSPapplicationtoCreate,ModifyandDeletethedatabaseentriesBeforebuildingaBSPapplication,you’llhavetohavedatabasetable.STEP1:CalltransactionSE11;createadatabasetableusingpredefinedtypes.STEP2:Pushsomeentriesinthetable;Enterabunchofemployee-ids,correspondingdate-of-birth,date-of-joiningandsalary.STEP3:CalltransactionSE80;createaBSPapplication.STEP4:Right-clicktheobjectnameandcreateapagewithflow-logic.STEP5:ChoosetheTypeDefinitionstabandcreateatype-definition.STEP6:ChoosethetabPageAttributesanddefinetheworkvariables,whichyouaregoingtouseinyourapplication.Besidesdefiningwork-variables,youhavetodefineaninternaltableandafieldstring.Todefineafield-string,usetypes:ff_progmr.Andtodefineaninternaltable,usetable-typeof‘ZART_PROGRAMMER’table.OpentableusingSE11,pressCtrl+Shift+F3(Where-Used-List),orclicktheicon,deselectothercheckboxesandselectTable-Types,pursedownthetable-typenameforthetableZART_PROGRAMMER.Orcreateanewtable-type,ifthereexistsnotable-type.CalltransactionSE11-Datatype-Create-TableType-LineType:ZART_PROGRAMMER-SaveandActivate.fl_flagTYPEINT4fs_progmrTYPEFF_PROGMRt_progmrTYPEZART_TTw_dobTYPEDATSw_dojTYPEDATSw_emnoTYPEZART_PROGRAMMER-EMNOw_ext_dobTYPECHAR10w_ext_dojTYPECHAR10w_indexTYPEINT4w_salaryTYPEZART_PROGRAMMER-SALARYSTEP7:ChoosethetabLayoutanddesignaweb-pagethatshouldcontainatable-viewandtable-view-columns.Table-Viewchoosestheinternaltablefromwhichthedatahastobefetchedanddisplaysitinformattedmanner.Table-View-Column.Togetatable-view,chooseTag-Browserfromtheleft-handpane;pulldownBSPExtensions-Transportable-HTMLB.Hereyougetalotofhtmlbcontrols,dragTable-Viewcontrolanddropitinthelayout(Foradditionaldetailsaboutit,right-clickthetagandgothroughdocumentation).Whenyouactivatethispageandchoicetoviewtheoutput,itcan’thappensinceinternaltablecontainsnodata.STEP8:Topopulatedataininternaltable,chooseEventHandlertabandselectOnInitialization,thiseventistriggerednosoonerthepagegetsrefreshedorcalledforthefirsttime.OnInitialization:SELECT*FROMzart_programmerINTOTABLEt_progmr.Save,activateandtestthepage:Selection-Modeforthetable-viewhasbeendefinedas‘SINGLESELECT’,thisselectsdesiredrow.Now,weneedSelected-Row-Index,whicheasesourtasktoplayaroundwithanykindofmanipulationwedesire.STEP8:ChoosetabEventHandlerandselectOnInputProcessing.OnInputProcessinghandlestheeventsforcheckingandprocessinguserinputandfordefiningnavigation.CodethefollowinginOnInputProcessingevent;DATA:w_eventTYPEREFTOcl_htmlb_event,w_eventidTYPEstring,w_objectTYPEREFTOobject,w_fieldidTYPEstring,w_in_fieldTYPEREFTOcl_htmlb_inputfield,w_in_valueTYPEstring,w_employeeTYPEzart_programmer-emno,w_dofbTYPEchar10,w_dofjTYPEchar10,w_esalaryTYPEzart_programmer-salary.CALLMETHODcl_htmlb_manager=get_eventEXPORTINGrequest=runtime-server-request*fast_exit_event_id=*fast_exit_event_class=RECEIVINGevent=w_event.w_eventid=w_event-id.IFw_eventidEQ'Programmer_Data'.CLASScl_htmlb_managerDEFINITIONLOAD.CASEevent_id.WHENcl_htmlb_manager=event_id.DATA:eventTYPEREFTOif_htmlb_data,selrowTYPEREFTOcl_htmlb_tableview.event=cl_htmlb_manager=get_event_ex(request).selrow?=cl_htmlb_manager=get_data(request=requestname='tableView'id='Programmer_Data).DATA:tv_dataTYPEREFTOcl_htmlb_event_tableview.tv_data=selrow-data.w_index=tv_data-selectedrowindex.ENDCASE.w_eventidcontainstheidofbutton,table-view,etc.w_indexcontainsselected-row-indexvalue.Tocatchtheevent,wemakeuseofClasscl_htmlb_managerandmethodget_event.Similarly,tocatchdatafrominput-fields,get_datamethodisused.STEP10:Ontheclickofcreatebutton,wesetthefl_flagas2,thatcanbeusedtodisplaycreatelayoutwithaninsertbuttononthesamepage.Further,onclickofinsertbutton,valuesofallinputfieldsareprocessedandinsertedintodatabaseusingasimpleINSERTquery.AddthefollowingcodeinOnInputProcessing;ELSEIFw_eventidEQ'create'.fl_flag=2.Now,addthispieceofcodeinthelayout;%elseiffl_flageq2.%centertablebgcolor=ivorytrtdhtmlb:labelfor=ip_emnolabelType=MEDIUMtext=EmployeeNumber//tdtdhtmlb:inputFieldid=ip_emno”disabled=FALSE//td/trtrtdhtmlb:labelfor=ip_doblabelType=MEDIUMtext=DateofBirth//tdtdhtmlb:inputFieldid=ip_dob//td/trtrtdhtmlb:labelfor=ip_dojlabelType=MEDIUMtext=DateofJoining//tdtdhtmlb:inputFieldid=ip_doj//td/trtrtdhtmlb:labelfor=ip_salarylabelType=MEDIUMtext=Salary//tdtdhtmlb:inputFieldid=ip_salary//td/trtrtdcolspan=2centerhtmlb:buttonid=inserttooltip=CreateaNewRecordtext=INSERTonClick=OnInputProcessing()//center/td/tr/table
本文标题:Simple-BSP-application-to-Create
链接地址:https://www.777doc.com/doc-5685247 .html