webdynpro 增强 - 增强系统的wedynpro

本文介绍SAP WebDynpro应用如何通过创建独立的增强实现来避免直接修改源代码,确保应用程序升级时的兼容性。这些增强实现允许在不改动原有组件的情况下增加新的功能或调整现有行为。

来自SAP online HELP:


Modification-Free Enhancements
In many cases, it will be necessary to change or enhance applications delivered by SAP or
ones that already exist. Unstructured changes to the source code or layout of an application
are called modifications. Modifications can cause conflicts when a new release of the
application programs is to be imported. To avoid such conflicts, you can create enhancement
implementations [external] for existing applications that were implemented using Web Dynpro
for ABAP. These enhancement implementations are independent development objects that
are managed separately from the respective original object. They are part of the
enhancement concept [external] that was integrated into the ABAP Workbench in the Web
Application Server for Release 7.0. The original objects they are based on are not changed by
such an enhancement and can therefore be updated without any problems whenever there is
a release change.


Enhancement Implementations for Web Dynpro for ABAP
ABAP source texts in a Web Dynpro application can be enhanced using BAdIs [external]. For
this purpose, explicit anchor points (called enhancement options [external]) are implemented
in the source code at suitable points during the development of the application. Using these
options, you can insert a separately developed BAdI later on into the flow of the program.
Each BAdI is therefore an explicit enhancement [external]. An implicit enhancement
[external], on the other hand, does not need any advance implementation through the
application development department.
In addition to the source code enhancements described above, you can also perform
enhancements to individual sections of a Web Dynpro component. For example, you can
insert UI elements into a view or suppress them, or you can insert new nodes in a controller
context.


Creating an Enhancement Implementation
To create an enhancement implementation, first open the required component in the object
list in SE80. With double-click, you open the view or the controller in which you wish to
perform the enhancement in the editor.
In the icon toolbar of the Web Dynpro Explorer, you will find the icon for the function
“Create/Change Enhancement Implementation”.
The function „Create/Change an Enhancement Implementation“ will only be
available to you if the original component is available in display mode. If you
switch from display mode to change mode, the original component itself will be
ready for change, so therefore no enhancement implementation can be created
or changed; the icon is grayed out.
By clicking the icon, you open either a creation dialog for a new enhancement implementation
or you get a list of all the enhancement implementations that exist for this component.
It is appropriate to start the names of objects that you have created within
an enhancement implementation with a prefix that uniquely identifies the
assignment to this implementation. This helps to prevent name conflicts with
objects of the original component. Example:
If you create a pushbutton in the enhancement myEnhancement_1, you could
call it myEnhancement_1/button_1.
As soon as you complete the dialog, you can then execute the enhancement or enhancement
changes you have created.

As a rule, several enhancement implementations, all independent of one
another, can be created for a component. The individual changes can be edited
only in the implementation in which they were created.


Implementing Enhancements in a View


If you have chosen a view of the Web Dynpro component as the starting point of your
enhancement implementation, you can now branch to the tab page Layout. If you select, in
the layout, UI elements of the original component that already exist, you will see that you
cannot change these. All fields that are otherwise ready for input or change are grayed out.
Creating New UI Elements
To enhance the layout of the view, you can create new UI elements. This procedure is no
different – from a technical viewpoint – from creating UI elements [page 880] in components
themselves. All UI elements created within the enhancement implementation can then be
processed as usual.
Suppressing Existing UI Elements
UI elements that exist in the original component cannot be deleted.
If you do not wish to display certain UI elements that exist in the layout, you can suppress
such elements in your enhancement. Simply select the respective UI element and then
choose its context menu entry Remove Element. In contrast to processing an original
component, the UI element does not disappear from the hierarchy or the layout preview.
Instead, the properties table of the element gets an additional line with the following
information:
Property Value Binding
Enhancement myEnhancment X
This line records that the respective UI element has been suppressed/hidden in the
enhancement implementation myEnhancement. In the context menu of the UI element, you
will now find the entry for undoing the hidden status. You can use it to return the element to its
original status.
Hiding a UI element means that this element is skipped when the page is
generated. It is not rendered completely "hidden" – like, for example, a UI
element that exists but is not visible. This needs to be taken into consideration in
particular whenever such a UI element was programmed dynamically in the
original component – that is, a UI element that is then not available at runtime.
Actions, Inbound and Outbound Plugs
For each view you can create additional plugs and actions in an enhancement
implementation. The enhancement implementation in question is noted in the respective
management table.

Implementing Enhancements in the Controller
All parts of a Web Dynpro controller can be enhanced. Here, too, the following applies:
Controller parts created in the original component cannot be changed or deleted in an
enhancement implementation.


Context Nodes and Context Attributes
For each existing context, additional nodes and attributes can be created within an
enhancement. However, if you wish to add an attribute to an existing node, there are two
different situations:
Within a node without a dictionary structure, this is possible without restriction.
Within a node with a dictionary structure, one or several attributes from the used structure
can be added through the context menu entry Create Through Wizard->Attributes from
Components of a Structure. If you select an attribute added in this manner, you will see the
name of the implementation for which it was created displayed in its properties table in the
last row Enhancement Implementation.
You may only change or delete a context note or context attribute that was
created for enhancement purposes in exactly that enhancement implementation
in which it was created.
Methods, Pre-Exits, and Post Exits
In accordance with all the steps performed so far, it is possible to create and implement new
methods for a controller in an enhancement. However, to be able to intervene in existing
methods, a so-called pre-exit and post-exit are provided in an enhancement for each method.
These two self-contained, additional methods are run directly before or directly after the
corresponding original method is called.
Pre-Exits:
The pre-exit method automatically provides all the importing and changing parameters of the
corresponding original method.
Post-Exits:
The post-exit method automatically reads the importing parameter of the original method. All
the other parameters of the original method (exporting, changing, and returning parameters)
are provided as changing parameters.
Attributes
Additional attributes can be created within an enhancement implementation.
Implementing Enhancements in a Window
In the navigation structure, too, it is possible to create enhancements within a Web Dynpro
window.
Changing navigation structures using enhancement implementations can
cause inconsistencies. Steps that are technically required for the business logic
can be suppressed in the navigation sequence, which could mean that data
required later is not set.

Navigation Links
● You can create new navigation links.
● Existing navigation links, similar to UI elements in a view, can be suppressed. They are
not deleted then by any means, but remain as part of the original component.
Whenever you edit either the enhancement implementation or the original component,
you will see displayed in the properties table – for example, of a navigation link – to
which development object the enhancing element is assigned.
● A new navigation target can be defined for an existing navigation link. When you select
this step, the existing link is first suppressed, as described above.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值