Simple BSP application to CreateWord文档格式.docx
《Simple BSP application to CreateWord文档格式.docx》由会员分享,可在线阅读,更多相关《Simple BSP application to CreateWord文档格式.docx(9页珍藏版)》请在冰豆网上搜索。
![Simple BSP application to CreateWord文档格式.docx](https://file1.bdocx.com/fileroot1/2022-11/24/f01ccc2f-fa67-41d9-ab3b-1d022c85bbdb/f01ccc2f-fa67-41d9-ab3b-1d022c85bbdb1.gif)
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_flagTYPEINT4
fs_progmrTYPEFF_PROGMR
t_progmrTYPEZART_TT
w_dobTYPEDATS
w_dojTYPEDATS
w_emnoTYPEZART_PROGRAMMER-EMNO
w_ext_dobTYPECHAR10
w_ext_dojTYPECHAR10
w_indexTYPEINT4
w_salaryTYPEZART_PROGRAMMER-SALARY
STEP7:
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
*
FROM
zart_programmer
INTO
TABLE
t_progmr.
Save,activateandtestthepage:
Selection-Modeforthetable-viewhasbeendefinedas‘SINGLESELECT’,thisselectsdesiredrow.Now,weneedSelected-Row-Index,whicheasesourtasktoplayaroundwithanykindofmanipulationwedesire.
ChoosetabEventHandlerandselectOnInputProcessing.
OnInputProcessinghandles
theeventsfor
checking
and
processing
user
input
andfor
defining
navigation.
CodethefollowinginOnInputProcessingevent;
DATA:
w_event
TYPE
REF
TO
cl_htmlb_event,
w_eventid
string,
w_object
object,
w_fieldid
w_in_field
cl_htmlb_inputfield,
w_in_value
w_employee
zart_programmer-emno,
w_dofb
char10,
w_dofj
w_esalary
zart_programmer-salary.
CALL
METHOD
cl_htmlb_manager=>
get_event
EXPORTING
request
=
runtime->
server->
request
fast_exit_event_id
=
fast_exit_event_class
RECEIVING
event
w_event.
w_event->
id.
IF
EQ
'
Programmer_Data'
.
CLASS
cl_htmlb_manager
DEFINITION
LOAD.
CASE
event_id.
WHEN
if_htmlb_data,
selrow
cl_htmlb_tableview.
get_event_ex(
).
?
get_data(
name
tableView'
id
Programmer_Data).
tv_data
cl_htmlb_event_tableview.
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;
ELSEIF
create'
fl_flag
2.
Now,addthispieceofcodeinthelayout;
<
%
elseif
eq
2.
%>
center>
table
bgcolor="
ivory"
>
tr>
td>
htmlb:
label
for
"
ip_emno"
labelType
MEDIUM"
text
Employee
Number"
/>
/td>
inputField
ip_emno”
disabled
FALSE"
/tr>
ip_dob"
Date
of
Birth"
/>
ip_doj"
Joining"
ip_salary"
Salary"
td
colspan
2"
button
insert"
tooltip
Create
a
New
Record"
INSERT"
onClick
OnInputProcessing()"
/center>
/table>