SAP+WebDynpro.docx

上传人:b****4 文档编号:24192619 上传时间:2023-05-25 格式:DOCX 页数:21 大小:401.53KB
下载 相关 举报
SAP+WebDynpro.docx_第1页
第1页 / 共21页
SAP+WebDynpro.docx_第2页
第2页 / 共21页
SAP+WebDynpro.docx_第3页
第3页 / 共21页
SAP+WebDynpro.docx_第4页
第4页 / 共21页
SAP+WebDynpro.docx_第5页
第5页 / 共21页
点击查看更多>>
下载资源
资源描述

SAP+WebDynpro.docx

《SAP+WebDynpro.docx》由会员分享,可在线阅读,更多相关《SAP+WebDynpro.docx(21页珍藏版)》请在冰豆网上搜索。

SAP+WebDynpro.docx

SAP+WebDynpro

WebDynproForABAP

SAP标准文件:

...2b5f68/frameset.htm

...155106/frameset.htm

SDNSAPBlogForWebDynporABAP多看看这里.

...0-10a0-f1cf47e8c943

这个是牛人,有VIDEO可以参考.好东西.

我们内部的很多同事都看这个人的BLOG.

不过有的讲解的不够深刻.

-------------------------------------------------------------------------------------

WebDynproForJava

Help文件(内附教程,照着学就好了)

...44197a/frameset.htm

SDN文档中心

不管是FORABAP/FORJAVA都很好,根据个人喜好,希望大家

注:

1、在安装时必须选择“ASJAVA”项,示例参见:

2、修改文件:

hosts.txt

3、与WebDynpro的关系是:

BSP相当于结构化的,而WebDynpro相当于面向对象的。

ECC6中如何配置webdynpro

webdynpro是通过域名访问,所以设置一个虚拟域名来指向你的sap服务器

1.在C:

\WINDOWS\system32\drivers\etc\hosts文件中加入条目,

ip(sap服务器的ip)

2.TRANS:

RZ11,系统配置访问地址

3.进入sicf->执行,激活下面的几个服务:

default_host/sap/option/*

default_host/sap/public/bc/*

default_host/sap/bc/wdvd

default_host/sap/bc/webdynpro/*

星号表示激活该节点下的所有服务。

4.系统中自带的例子有很多。

PACEKAGE:

SWDP_TEST、SWDP_DEMO、SWDP_DEMO_TUTORIALS

5.WEBDYNPROABAP功能很强大,比想象的强大的多……

webdynproforabap基础知识

(一)

2009-01-2111:

15

webdynproforabap采用了MVC的设计方法。

一个webdynprocomponent包括window,views和componentcontroller。

window和view主要和UI有关。

windows只是一种容器,在一个component内一个window可以包含任意多个view,而componentcontroller只有一个。

如果一个component不需要view,那么windows也就相应无需存在了。

一个webdynprocomponent可以与一个URL关联,通过浏览器来访问,或者作为另一个webdynprocomponent的sub-component供调用。

webdynprocomponent的controller分为四类:

componentcontroller:

这种类型的controller在一个webdynprocomponent内只存在一个,并且没有visualinterface。

customcontroller:

这类controller是可选的,用于封装componentcontroller的sub-function。

viewcontroller:

每一个view都有一个对应的viewcontroller,负责与视图有关的逻辑,如检查用户的输入和处理useraction。

windowcontroller:

一个window内只存在一个windowcontroller,用于通过inboundplugs传递数据。

webdynpro中有两个常提到的概念是contextmapping和databinding。

每个controller内部都会有一个context,用于存储controller所用的数据。

contextmapping提供了一种机制,供不同的controller之间交换数据。

contextmapping分为internal和extern两种。

如果同一个component内的不同controller之间共享数据,这被成为internalcontextmapping;共享数据的controller不在同一个component之内,这被称为externcontextmapping。

要注意的是viewcontroller一类不能作为contextmapping的源,否则就违背了MVC的设计原则。

databinding为数据在contex和UI元素之间自动(双向)传递提供支持。

接下来再看看context这个东西。

context是一个包含node和attribute的结构。

每个context都有一个默认的rootnode,这个rootnode不能被修改或删除。

一个node可以包含子元素(node和attribute),而attribute只能依附于其他node或contextrootnode而存在。

在同一个context内,每个node的名字必须是唯一的。

一个node连同其子元素被合称为一个element。

context中的每个node都有两个重要的property:

cardinality:

这个属性给出了当前nodecollection在运行时(runtime)包含的元素数目的最小值和最大值。

这个属性的取值包括0..1(仅允许0或1个元素),0..n(允许0或更多元素),1..1(仅允许一个元素),1..n(允许一个或多个元素)。

singleton:

这个属性决定了子节点在实例化时是singleton还是不是singleton,因此它的值就是布尔值。

在课程中在讲singleton时还提到了supplyfunction,两者常在一起使用以实现lazydatainstantiation。

比如在加载一个包含多行的表时,每一行包含的更详细数据不会被首先加载,而只有在用户选中并查特定行时,与该行相关的数据在会被读取。

有些UIelements是不可见的,如TransparentContainer,ViewUIElementsContainer。

这类元素用于组织其他的可见元素,如Button,Label,InputField,Table,Tree等。

所有的UIelements被组织成一个树状结构,根节点名为RootUIElement,类型为TransparentContainer。

RootUIElement下的每个containerelement都有一个属性Layout,它规定了在container内元素的布局。

4种layoutmanager可供layout属性选择:

FlowLayout

Rowlayout

MatrixLayout

GridLayout

如果一个UIelement被绑定到了一个context内的node或attribute,那么这个node/attribute的值就会被赋给这个UIelement。

当UIelement的值发生变化时,这种变化也会自动反映到context中的node/attribute上。

这就是前面已经提及的databinding。

这种绑定只能发生在同一个view的context和viewcontroller之间。

当想改变一个UIelement的行为时,只需修改与这个UIelement绑定的node/attribute。

UIelements如TextView,Label,Caption被用于显示文字。

当这类UIelements被绑定到attribute,而attribute是与datadictionary中dataelement有关。

这时这个dataelement的相应文字会被用于这个UIelement。

另一种情况是,aLabelisrelatedtoaInputField,andtheTextpropertyoftheLabelisleftblank.ThelabeltextthenoriginatesfromthedataelementrelatedtotheInputField.

CompositeUIElements

有的UIelement由多个基本的UIelements组成,如Table(由多个TableColumn构成)。

每个TableColumn又由一个Caption和一个Celleditor(默认为TextView这种类型的UI)组成。

Table这类UIelement只能被绑定到cardinality为0..n或1..n的node。

每个Table有一个属性selectionMode,有6个不同的值来控制行的选择,具体参见文档第86-87页。

在webdynpro中每个controller都有两个默认的方法:

wddoinit():

这是一个controller内第一个被调用的方法,常用于初始化数据。

wddoexit():

这是一个controller内最后一个被调用的方法,用于做收尾工作。

这两个方法在controller被创建时自动生成,并且都是空的方法。

对于componentcontroller还有两外两个重要的方法:

wddobeforenavigation():

Thismethodiscalledaftertheactionmethodhasbeenprocessedandjustbeforethewebdynproframeworkprocessestheeventsinthenavigationqueque.

viewcontroller也有自己的两个方法:

wddobeforeaction():

Afterthewebdynproapplicationhasbeenstartedandtheuserhasraisedaclientevent,thefirstmethodstobeprocessedinthewdaarethewddobeforeaction()methodsofallviewcontrollersofthepreviousrenderedviewassembly,beforetheactionhandlermethodtotheeventprocessed.

webdomodifyview():

用于动态修改UIElement。

对于各类controller,用户都可以创建自己的methods。

在创建method时,有三种类型可选:

method,eventhandler和supplyfunction。

双击方法名就可以打开一个编辑器,书写实现代码。

在一个component内,一个controller可以调用其他controller的方法,只要在这个controller内声明使用了另一个controller即可。

如果要让一个controller的自定义方法能被位于component内的另外一个controller调用,那么需要设置该方法的Interface属性。

前面提到了controller的methods,现在轮到controller的attributes。

除了interfacecontroller和interfaceviewcontroller外每个controller都有两个预定义好的attribute:

WD_THIS和WD_CONTEXT。

WD_THIS指向当前的controllerinterface,IF_;WD_CONTEXT指向controllercontext下的rootnode。

访问context内的其他node/attribute就是借助它来完成的。

如果一个controller声明使用componentcontroller,那么一个标准attributeWD_COMP_CONTROLLER会被自动创建,以指向componentcontroller,这样componentcontroller内的methods和publicattributes就能被调用,wd_comp-controller->methodname。

如果一个controllerA声明使用其他类型的controllerB(不是componentcontroller),这时在controllerA中不会自动生成一个指向controllerB的引用。

为了得到指向B的引用需要下面的办法:

DATA:

lo_ctrlTYPEREFTOig_.

lo_ctrl=wd_this->get__ctrl().

用户也可以自定义attribute。

如果attribute的publicflag被设置,那么这个attribute对于同一个component内的其他controller也是可见的。

访问其他controller的publicattribute的方式与访问method一样。

对于每一个controller,系统都会为其自动创建一个interface,名为IF_

在这个interface中,对于每一个contextnode都会有一个相应的WDCTX_存在。

访问rootnode直接使用

WD_CONTEXT,访问rootnode的子node使用get_child_node()方法,要注意的是方法名作为参数被传递时必须是大写!

方法返回指向指定node的引用,类型为IF_WD_CONTEXT_NODE。

这个方法还有一个可选参数,是要访问的element在父node中的索引编号。

访问一个nodeelement

获得一个指向node的引用后就可以使用get_element()方法来获得指向elementatselection的引用,类型为IF_WD_CONTEXT_ELEMENT。

DATA:

lo_nd_flightsTYPEREFTOlf_wd_context_node.

DATA:

lo_el_flightsTYPEREFTOif_wd_context_element.

lo_wd_flights=wd_context->get_child_node(name=wd_this->wdctx_flights).

*getelementatleadselection

lo_el_flight=lo_flight_flights->get_element().

*ifleadselectionisnotset,ELEM_FLIGHTSwillbeinitial

IF(lo_el_flightsISINITIAL).

...

ENDIF.

要获得索引为n的element,使用方法get_element(index=n)。

get_element_count()方法返回一个collection中的element的数目。

访问单个node的attribute

一旦获得了指向一个nodeelement的引用,就可以使用下面两个方法来访问这个node的attribute。

get_attribute()可以访问任意一个attribute,所需的参数是要访问的attribute的名字。

另一个方法是get_static_attributes(),用于访问staticdefinedattributes(此处不明白)。

DATA:

lo_nd_flightsTYPEREFTOlf_wd_context_node.

DATA:

lo_el_flightsTYPEREFTOif_wd_context_element.

DATA:

lv_connidTYPEwd_this->element_flights-connid.

lo_wd_flights=wd_context->get_child_node(name=wd_this->wdctx_flights).

lo_el_flight=lo_flight_flights->get_element().

*getsingleattribute

lo_el_flights->get_attribute(

EXPORTING

name='CONNID'

IMPORTING

value=lv_connid).

controllercontext中的每个node在interfaceIF_中都有一个隐含的名为element_structure和名为elements_的standardinternaltable,其linetype是element_

这个internaltable用于存放multiplenodeelements的attributes。

(此处不明白,既然每个node都有一个这样对应的internaltable,为什么还说存放multiplenodeelements的attributes?

一个使用get_static_attributes()访问一个node的staticattributes的例子:

DATA:

lo_nd_flightsTYPEREFTOlf_wd_context_node.

DATA:

lo_el_flightsTYPEREFTOif_wd_context_element.

DATA:

ls_flightsTYPEwd_this->element_flights.

lo_nd_flights=wd_context->get_child_node(name=wd_this->wdctx_flights).

lo_el_flights=lo_nd_flights->get_elements

*getallstaticdeclaredattributes

lo_el_flights->get_static_attributes(

IMPORTING

static_attributes=ls_flights).

获取所有nodeelements的staticattribues:

DATA:

lo_nd_flightsTYPEREFTOlf_wd_context_node.

DATA:

lt_flightsTYPEwd_this->element_flights.

lo_nd_flights=wd_context->get_child_node(name=wd_this->wdctx_flights).

*getallstaticdeclaredattributesforallnodeelement

lo_nd_flights->get_static_attributes_table(

IMPORTING

table=lt_flights).

一个方法:

ThisblogisabouthowtogetthesamplesolutionsandthedatageneratoroftheEnterpriseSalesModelintoyourlocalNetweaver2004sABAPTrialVersion.Thesearetheessentialpartsofthehands-onsessionforWebDynproABAPheldatTechEd2007.Havealookatthedownloadwhereyou'llfind3transportsandthedocumentation(CD255.doc)fortheexercises.

YoucanfindabriefintroductiontohowtogettransportsinandoutoftheABAPTrialVersioninpart8andpart9oftheblogseriesabouttheABAPTrialVersion.Downloadtheallobjectandunzipthetransports.SharetheSAPfolderoninstallationlevel(seepart8,thefirsttwoscreenshotsatthebeginning).CopytheR/K-tothefilesfromthetransportstotheappropriatefolderinthetransportsystem(seebelow).    

StarttheABAPTrialVersionandlogontothesystem.Openthetransportmanagmentsystemwithtransaction'STMS'.

Clickthe'truck'iconinthemenubartogototheimportqueue.

Selectthe'NSP'queueandopenmenu'Extras>>OtherRequests>>Add'.

Clicktheinputhelp.Threerequestsaredisplayed.Itisnecessarytoimporttheobjectsinthefollowingorder:

1.Y7AK068639

2.BCEK179792

3.NWRK900015

Select'Y7AK068639'andpressthe'OK'button.

Pressthe

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 工程科技 > 信息与通信

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1