最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 正文

webdynpro abap????

来源:动视网 责编:小OO 时间:2025-09-25 04:51:04
文档

webdynpro abap????

WebDynproforABAPAuthor:ALEXMSN:Opparts@hotmail.comChangedHistoryExampleSystem:WDA/000PackageName:ZTEST_ALEX1ContextBinding32ViewController&ComponentController43Cardinality&Selection44Singleton&Non-singleton55SelectionCardinality75.1LeadSelectionI75.
推荐度:
导读WebDynproforABAPAuthor:ALEXMSN:Opparts@hotmail.comChangedHistoryExampleSystem:WDA/000PackageName:ZTEST_ALEX1ContextBinding32ViewController&ComponentController43Cardinality&Selection44Singleton&Non-singleton55SelectionCardinality75.1LeadSelectionI75.
WebDynpro for ABAP 

Author: ALEX

MSN:Opparts@hotmail.com

Changed History

Example System: WDA/000 

Package Name: ZTEST_ALEX

1    Context Binding    3

2    View Controller & Component Controller    4

3    Cardinality & Selection    4

4    Singleton & Non-singleton    5

5    Selection Cardinality    7

5.1    Lead Selection I    7

5. 2 Lead Selection II    7

6    Node & Attribute Problem    8

6.1    使NODE 无效    8

7    Dynamic Modification    9

8    ALV in Web Dynpro    9

9    ALV Configuration & Model    10

9.1    Implement Interface method    10

9.2    Instantiate the ALV component    10

10    Events and Event Handlers    12

10.1    Cross-Component Events    13

10.2    Parameter of Events    13

10.3    Additional Concepts: Passing Parameters Using an Event Object    14

10.4    Roadmap Example:    15

11    VIEW Lifecycle    16

12    Message Handling    17

13    Changing a property of a UI control    17

14    Table    18

14.1    Header Group    18

14.2    Row Group    19

14.3    List & Check Box & Radio Button    19

14.4    Selection    20

14.5    Summary    20

15    Selection options Usage    20

16    System Demo Example    20

17    ADOBE PDF Print Loop Problem    21

18    Pattern Library    21

18.1    ContextualPanel    21

18.2    FreeContextualArea    22

18.3    NavigationList    22

18.4    View Switch    23

18.4.1    Event onSelect    23

18.5    HorizontalContextualPanel    23

18.5.1    Event onSelect    23

18.6    Navigation List    24

18.6.1    On Click Event    25

19    Hierarchy Table Tree    27

19.1    KEY    27

19.2    NESTING    27

19.3    By KEY    27

20    WebDynpor component & WebDynpro component interface    29

20.1    Difference    29

20.2    How to implement the interface & Definition    30

20.3    Detail Comparison    30

20.4    Working with interface definition    31

20.4.1    WebDynpro component    32

21    Navigation through Window Plugs    34

21.1    Window & view & Interface view Structure    34

21.2    Window Plug    35

21.3    DEMO    37

22    BBS Demo    37

22.1    Login View    37

22.2    Main View    37

22.3    Print List    38

22.4    Post a thread    38

22.5    Message    39

22.5.1    Check mail / mail setting    39

22.5.2    Add a contact person    39

22.6    Register a new user    39

WebDynpro for ABAP

1Context Binding

Context Binding is the association of a UI element property with a node or attribute in a view controller’s context.

The UI element property then uses the context node or attribute as it data source. If the UI element property can be updated by the user, then new value replaces the value in the context.

The order of attributes within a node has no influence on the order in which the data they hold is displayed.

The binding between a UI element and a context attribute is a two-way relationship:

⏹Data from the context is transported to the client during screen rendering

⏹Data entered by the user is transported back to the context when the HTTP round-trip is processed.

2View Controller & Component Controller

3Cardinality & Selection

The Cardinality Property

Every context node has a property called Cardinality. This property is composed of two values that taken together, describe the maximum and minimum number of elements the node collection may hold at runtime.

Cardinality Minimum:    0 or 1

Cardinality Maximum:    1 or n

Therefore, there are four possible cardinality values (specified as ..)

0..1    Zero or one elements permitted

0..n    Zero or more elements permitted

1..1    One and only one element permitted

1..n    One or more elements permitted

Selection 

Set has more than one value can be selected.

Web Dynpro: Selection Cardinality of a Context NodeThe selection cardinality specifies the number of instances of the context node (in a table display of the node) that can be checked or selected for processing at runtime.

The following values are possible:

1..1 : Exactly one instance (table row) must be selected. It is automatically the lead selection.

0..1 : No more than one instance (table row) can be selected. It is automatically the lead selection.

1..n : Any number of instances can be selected, but at least one must be selected. One of them is the lead selection.

0..n : Any number of instances can be selected, but none must be selected. One of the selected ones is the lead selection.

The default is 0..1.

4Singleton & Non-singleton

⏹The Singleton property of a context node

Notice that the context node FLIGHTS has a child node called BOOKINGS. The BOOKINGS node is a distinct node with its own element collection.

The Boolean property called Singleton critically affects the relationship between an dependent node and its parent node!

⏹Node BOOKINGS as a non-singleton (Singleton = false)

If the node BOOKINGS has its Singleton property set to false, then for every element in the parent node collection (FLIGHTS in this case), there will be a distinct instance of the child node BOOKINGS.

The most important thing to understand here is that each instance of node BOOKINGS is related to the respective element in the parent node collection. Notice that the arrows pointing to each of the BOOKINGS node collections originate from each element in the parent node.

Therefore, if there are n elements in the parent node, then there will be n distinct instances of a non-singleton child node.

⏹Node BOOKINGS as a singleton (Singleton = true)

If the node BOOKINGS now has its Singleton property set to true (which is the default), then it does not matter how many elements are present in the parent node collection (FLIGHTS in this case), there will only ever be one instance of the child node BOOKINGS.

⏹Repopulating singleton child nodes

In the above example, there could be many different elements in the FLIGHTS node collection. However, since there is only ever one instance of the singleton child node BOOKINGS, we need to ensure that when this child node is accessed, it contains the correct data for the selected element in the parent node. 

⏹Supply functions

Supply functions are the mechanism to repopulate child nodes when the lead selection in the parent node changes. When a singleton child node is declared, you must also write an accompanying supply function. The Web Dynpro Framework will then automatically call your supply function when the lead selection in the parent node changes.

5Selection Cardinality

5.1Lead Selection I

Each context node can (and should) have a lead selection. The lead selection is set by default to the first element of a context node. It can also be dynamically modified, however. You can easily identify the lead selection element for a table as it is highlighted. If automatic initialization is switched off, you must set the lead selection when you fill the context node. The only exception is that this context node should be displayed in a table only, and no selection should be visible initially. The selection mode should then be set to “NONE” for the table as well.

You can also specify that several elements can be selected for the node. This depends on the lead selection and is also set and queried using other methods.

Important: the “INITIALIZE LEAD_SELECTION” flag should be switched on where possible!

5. 2 Lead Selection II

A node's element collection can be accessed using a 1 based index value. It is possible to flag multiple elements as being selected (controlled by the selection cardinality property), but only one of the selected elements can be processed at any one time. The element being processed is referred to as the lead selection element.

Multiple selection of rows from a table

Before a user is permitted to select multiple rows from a table (by holding down shift, and clicking on the required rows), the context node to which the Table UI element is bound must have a selection cardinality of either 0..n or 1..n. The default selection cardinality setting for any context node is 0..1, meaning that zero or one elements may be selected at any one time.

Finding the context nodes with multiple element selections

Each node provides the method GET_SELECTED_ELEMENTS which returns all selected elements in an internal table (type WDR_CONTEXT_ELEMENT_SET).

Note: A line of a table in a view which is selected with the lead selection will be only part of the result of the method GET_SELECTED_ELEMENTS if the parameter INCLUDING_LEAD_SELECTION of the method is set to true.

6Node & Attribute Problem

If one node has value in attribute, such as sflight, this node couldn’t add attribute

Only node can be added. You can remove it if you want to add new own attribute such as “Status” which has not any element can be referenced.

6.1使NODE 无效

1.你可以读取NODE,然后清空,然后再次绑定.

2.你也可以使用这个方式来使COMPONENT NODE(清空所有的值)无效,前提是,COMPONENT NODE需要MAPPING 到你当前的使用这个无效的方法的VIEW里面,当然这是很白痴的话.

使用CODE-WIZARD取得NODE,删除废的代码(ELEMENT,什么的),然后直接调用即可, 

       

3.另一个可以使用,  使用这个按钮, 你可以看到CONTROLLER的

      INTERFACE CODE, 或者在上面的CODE的IF_FORUM_VIEW上双击,

             同样可以可以看到当前的VIEW INTERFACE. 还可以知道一些系统的命

             名习惯.

     

7Dynamic Modification

Development Principle

only if the required functionality of your application does not permit design time declarations, then uses a dynamic modification approach.

All context node/attribute and UI elements which can be created during design time should be created during design time. 

UI manipulation is only permitted within the wdDoModifyView() method of a view controller.

wdDoModifyView() has a boolean parameter called firstTime. Typically, you will only build a dynamic UI element hierarchy when firstTime == true. This avoids rebuilding the UI element hierarchy unnecessarily.

Do NOT implement any coding in wdDoModifyView() that modifies the context! The context should be considered “read-only” during the execution of this method.

Context binding modification only can be changed/create in WDDOINIT ().

WDDOMODIFYVIEW 

The view is part of the current view assembly and this is the first time the view is required, or

The view is part of the current view assembly and an action belonging to the same view controller has been processed. 

8ALV in Web Dynpro

∙Provide a more advanced display component compared to Table UI element

∙Offer same functionality as common ALV in ABAP

∙ALV realized as WD Component not as UI element 

∙More complex interface

∙Included via Component Usage

∙Data binding by reverse context mapping

9ALV Configuration & Model

 Instantiate ALV component. 

Implement the standard hook method WDDOINIT of the view RESULTVIEW: 

The first step – (Getting the ALV Configuration Model)

If you want to program the ALV component model - is to create an instance of the ALV component. This can easily be done with the help of the Web Dynpro code wizard

9.1Implement Interface method

Method List

Parameters inherit from interface method

9.2Instantiate the ALV component

在动态的ALV的显示情况下, 没有办法把UI CONTAINER对应到ALV的

CONTEXT NODE, 所以在动态的CONTEXT NODE 下, 先要初始化这个ALV

组件, 然后绑定SET_DATA的方法到手动生成的这个CONTEXT NODE 上.

而这个NODE,已经棒定好了数据了.

已经绑定的ALV Interface 

没有绑定的ALV Interface

没有MAPPTING PATH.所以ALV的CONTEXT_NODE 和显示的数据需要调用SET_DATA方法. 这就回到到9.2里面说到的INSTANTIATE ALV COMPONENT.

http://help.sap.com/saphelp_erp2005/helpdata/en/79/002c2a0d43e5a39add662b5f68/frameset.htm  

10 Events and Event Handlers

http://help.sap.com/saphelp_erp2005/helpdata/en/35/447741b0d6157de10000000a155106/frameset.htm

You can define events for a component controller to allow cross-controller communication. These events can then be triggered using the predefined method FIRE__EVT. Once the event is triggered, the corresponding event handler is automatically called in another controller by the runtime.

A usage of the component controller must be entered in the current controller to handle an event of a component controller. (The usage of the component controller within a view controller is automatically created.)      

 The following graphic shows an example in which a method of the component controller triggers the event MY_EVENT. 

The event handler MY_HANDLER of a view controller responds to the event MY_EVENT, because this event of the component controller is assigned to this event handler. It has been assigned on the Methods tab of the view controller.

10.1Cross-Component Events

You can use one or more events of the component controller and use them as cross-component events. Check the Interface checkbox of the Events tab of the component controller in the table. The corresponding event is passed to the component interface and can be accessed by an event handler of another component (see Cross-Component Programming).

10.2Parameter of Events

Events can pass parameters. You can enter these parameters on the Events tab of the component controller and specify the type. When you then create an event handler in a used controller and assign an event of the component controller to it, the corresponding parameters are automatically added to the signature of the event handler method.

 Example:

 

Component Controller

An event is triggered in a method of the component controller and the created parameter is passed.

Events tab

Event

MY_EVENT

Parameter

MY_PARAMETER         type        WDY_BOOLEAN

 
 WDY_BOOLEAN is an ABAP Dictionary type and has the function of a real Boolean variable.

The value of WDY_BOOLEAN is ’X’ for true or ’ ’ for false.

 

Methods tab:

MY_CONTROLLER_METHOD

 

method MY_COMP_CONTROLLER_METHOD .

 

WD_THIS->FIRE_MY_EVENT_EV( MY_PARAMETER = ‘X’ ).

 

endmethod.

 
 

View Controller

An event handler is created in a view controller and assigned to the event MY_EVENT. The response of the event handler is according to parameter MY_PARAMETER 

Methods tab:

Method                       Method Type                      Event                   Controller

MY_EVENT_HANDLER    Event Handler               MY_EVENT             Component Controller

 
MY_EVENT_HANDLER

Parameter                     Declaration Type          Reference Type        

WDEVENT             Importing                     CL_WD_CUSTOM_EVENT

MY_PARAMETER        Importing                     WDY_BOOLEAN

 
 

method MY_EVENT_HANDLER .

.

.

.

endmethod.

 

 

10.3Additional Concepts: Passing Parameters Using an Event Object

Each event handler method is automatically known to parameter WDEVENT of the type CL_WD_CUSTOM_EVENT. The class interface CL_WD_CUSTOM_EVENT contains the attribute PARAMETERS of the type WD_EVENT_PARAMETER and several methods to read this parameter.

Instead of statically specifying a parameter for an event and automatically add this parameter to the signature of the event handler method of the event handler, you can also dynamically specify the parameter using the event object.

This means that if the parameter is not to be statically specified at design time, it can be read from the event object of the event handler method. For more information, see Dynamically Working with Parameter Mappings in the third part of the programming manual.

 

10.4 Roadmap Example:

Component Controller

 

 

View Controller

关于使用ROADMAP的节点的时候, 节点的名字,最好是和VIEW的名字一样.否则会发生一些意外的事情.

俺设置了ROADMAP的两个节点, 然后ROADMAP的节点,方法是为就是以下的这个方法, 前进,后退这两个按钮,都没有问题,但是我想直接选择上面的节点, 却无法到达我想去的VIEW. 因为无法直接知道,因为当前的VIEW是嵌在一个CONTAINER里面的,当前的VIEW的名字.只是这个外面的VIEW的名字.

建议1. VIEW名字于节点一样, 否则, 使用前进, 和后退按钮的时候, 当前的节点, 不会变黄, 这是个问题, 实际上,显示相应的VIEW那个相关的节点,应该变黄的.

11VIEW Lifecycle

如果VIEW的有效其间,是FRAMEWORK, 举个例子, 一旦是输入了一些数据,这些数据是.和某个VIEW的CONEXT NODE (VIEW的, 不是全局COMPONENTD映射过来的.) 绑在一起的, 但是, 第二次进入这个VIEW的时候, 这些数据还会显示出来

设置成WHEN VISIBLE的话, 一旦离开这个VIEW.相应的数据, 就被清空了.

12Message Handling

第一个选项. MESSAGE 总是显示出来. 

 会有MESSAGE CONTAINER显示出来.

第三个选项和结果, 我们仅仅只是希望显示MESSAGE的一些文本和类型.其他的我不需要.

13Changing a property of a UI control

To change a property of a UI control, first you have to get the UI control and then you have to change the attribute accordingly. The easiest way to get the element is using method view->get_element( id ). The ID has to be specified in uppercase. The return has to be “cast” to the correct type, such as: 

data my_inputfield type ref to cl_wd_input_field.

my_inputfield ?= view->get_element( `MYINPUT1` ).

多种方法控制UI Element的属性.

1.绑定NODE. 举个例子, UI 的VISIBLE的属性 可以定一个NODE.里面的DISP是个属性. 绑定起来, 然后在程序中,动态修改着NODE的值. 自然而染,UI也就显示, 不显示.

2.在当前的VIEW CONTROLLER中读取,某个UI ,然后直接修改

当前VIEW有个UI BUTTON,名字是BUTTON_NEXT, 可以直接取出来.

然后调用方法, 如何查找方法, GUI BARPATTERNCL_WD_BUTTON.

怎么知道BUTTON的CLASS类, 需要查看

http://help.sap.com/saphelp_erp2005/helpdata/en/79/002c2a0d43e5a39add662b5f68/frameset.htm

      

3.类似上面,但是却调用的是

      ,而不是SET_VISIBLE.

      参数里面输入的是NODE的ATTRIBUTE, (example: ‘FLIGHT.STEP’).

            

14Table

WDR_TEST_TABLE

14.1Header Group

    

14.2 Row Group

  

14.3 List & Check Box & Radio Button

     

Set Value

14.4Selection

14.5Summary

15Selection options Usage

           

16System Demo Example

PACKAGE: SWDP                                          ROOT,里面包含句多无比的例子.

                     SWDP_DEMO                            包含一些TREE, ROADMAP的例子.

                     SWDP_TEST                               All example

                     SWDP_RUNTIME_COMP        RUNTIME的一些修改例子.

                     SAP_ABAPWD                          用FLIGHT表做的很多的例子.

                     SALV_WD                                  ALV Table

                     WDR_TEST_TABLE                  Table

                     WDT_TABLE                              Table

                     WDR_TEST_EVENTS                UI 的一些例子

                     SALV_WD_TEST                       ALV Display & Icon 

1. SWDP_DEMO_TUTORIALS - Package

2. WD_TUT_TEMPLATE

3. Demo* - WebDynPro Components/Application 

4. Z* - WebDynPro Components/Application

5. Z* - Package

6. SWDP* - Package

7 .SALV* - Very Important ALV Package 

8. /SPE/RET_CONSOLIDATOR Package in QPT 

9.  WDT * Webdynpro Component 

10 .WDR* Webdynpro Component

11. SWDP_Test

12. gen_personal_object_worklist 

13 . GEN_PERSONAL_OBJECT_WORKLIST

14 WDR_POPUP_TO_CONFIRM 

17ADOBE PDF Print Loop Problem

Adobe LiveCycle Designer 7.0

 

新版本的样子就多了很多东西,多层的NODE,拖过来就可以直接变成

TABLE打印了, 爽吧! 7.0设置来设置去, 累死, 然后还循环不出来, 搞死人啊

快点换成7.1吧!

18Pattern Library

18.1ContextualPanel

   ViewSwitch, 只是看上去可以用来PANEL的按钮.

18.2   FreeContextualArea 

(任何东西都可以放)

放图片.

18.3   NavigationList

18.4 View Switch

18.4.1Event onSelect

Action executed when an item is selected in ViewSwitch.

Parameter NameTypeDescription
IDSTRINGStandard Parameter
CONTEXT_ELEMENTIF_WD_CONTEXT_ELEMENTStandard Parameter
INDEXI0-based index of the selected entry
这些参数,需要自己在程序中输入,它不会自己带出来。XXX是VIEW SWITCH连接到的CONTEXT NODE名字

  data node type ref to if_wd_context_node.

  " This has so to be done manually

  node = wd_context->get_child_node( 'XXXXX' ).  

    node->set_lead_selection_index( index ).

在用户选中其中的一个viewswitch的时候, id,string会保存一些值

18.5  HorizontalContextualPanel

18.5.1Event onSelect

Parameter NameTypeDescription
IDSTRINGStandard Parameter
CONTEXT_ELEMENTIF_WD_CONTEXT_ELEMENTStandard Parameter
  data node type ref to if_wd_context_node.

  " This has so to be done manually

  node = wd_context->get_child_node( 'ONE_LEVEL' ).

  node->set_lead_selection( CONTEXT_ELEMENT ).

18.6  Navigation List

要注意的几个地方,属性的设置有点不同

第归自己的节点

最后效果, 但是感觉没有tree做出来好看,所以放弃使用它, 感觉一般般,也不是很豪华,超过三层话,才会有下拉的箭头

18.6.1On Click Event

参数CONTEXT_ELEMENT 要加入进去

ACTION

 data node type ref to if_wd_context_node.

  if context_element is bound.

    node = wd_context->get_child_node( 'NAV_LIST' ).

    cl_wd_dynamic_tool=>set_table_tree_lead_selection( 

    lead_selection = context_element

    data_source    = node ).

  endif.

SUPPLY FUNCTION: SUPPLY_NAV_LIST

DATA entries TYPE string_table.

  DATA entry TYPE string.

  DATA offs TYPE i.

  DATA new_offs TYPE i.

  DATA tab TYPE if_test=>elements_nav_list.

  DATA line TYPE if_test=>element_nav_list.

  DATA parent_node TYPE REF TO if_wd_context_node.

  DATA pattern TYPE string.

  DATA child_pattern TYPE string.

  DATA name TYPE string.

  DATA disabled TYPE wdy_boolean.

  entries = get_list( ).

* Returns Node to Which Element Belongs

* 取得父NODE

  parent_node = parent_element->get_node( ).

* 比较父node是不是根node,是根node的话,就取出根node

* 因为里面已经存在一个递归的node,所以

第一次会把

com.sap.china

com.sap.jp

加入

* 系统会自己递归这个node。然后

第二次就是

com.sap.china.cd

com.sap.china.gs

com.sap.china.bp

  IF parent_node->get_node_info( ) = node->get_node_info( ).

    parent_element->get_attribute( EXPORTING name = 'TEXT'

                                   IMPORTING value = name ).

  ELSE.

    name = 'com.sap'.

  ENDIF.

  CONCATENATE name '.*' INTO pattern.

  offs = STRLEN( name ) + 1.

  LOOP AT entries INTO entry

    WHERE table_line CP pattern.

* 第一次找到com.sap.china然后删除com.sap.( entry+offs.)

* 然后在里面寻找是否出现了‘.’如果找到,就跳过,不把它加入TAB

    FIND FIRST OCCURRENCE OF '.' IN entry+offs.

    CHECK sy-subrc <> 0.

    SPLIT entry AT ',' INTO line-text disabled.

    IF disabled = abap_true.

      line-enabled = abap_false.

    ELSE.

      line-enabled = abap_true.

    ENDIF.

    INSERT line INTO TABLE tab.

  ENDLOOP.

  node->bind_table( tab ).

* 等系统做递归的时候第二次

* Name已经等于com.sap.china

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

append 'com.sap' to entries.

  append 'com.sap.china' to entries.

  append 'com.sap.china.cd' to entries.

  append 'com.sap.china.cd.team1' to entries.

  append 'com.sap.china.cd.team2' to entries.

  append 'com.sap.china.cd.team3' to entries.

  append 'com.sap.china.gs' to entries.

  append 'com.sap.china.bp' to entries.

  append 'com.sap.jp' to entries.

  append 'com.sap.jp.cd' to entries.

  append 'com.sap.jp.ss' to entries.

  append 'com.sap.jp.srm' to entries.

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

19Hierarchy Table Tree

The TreeByNestingTableColumn element allows the integration of a tree structure in a Table. The tree structure has nodes with subordinate leaves, similar to the UI element Tree.

CLASS: TreeByKeyTableColumn

CLASS: TreeByNestingTableColumn

Example Component: 

WDT_TREE_TABLE_BY_NST

WDT_TREE_TABLE_BY_KEY

But, what’s the difference between NST and KEY? See below detail explanation

19.1 KEY

By KEY, the data source is flat node, which means, hierarchy is displayed using the parent to key relationship.

19.2 NESTING

By NST, the data source is recursion context node, whose subnode contains low-level elements.

19.3 By KEY 

其中的一列是

TreeByKeyTableColumn

这种类型, 旁边的图形是它的

结构. 那现在来看看, CONTEXT

NODE, 是如何来构成的.

Cardinality 0..n

Selection    0..1

Supply function 

Rowkey

Parent_row_key

Is_leaf

Expanded 

这几个比较重要, 当然COLUM_TEXT

也很重要的拉.

data:

    lt_rows type if_main=>elements_table_data_source,

    row     like line of lt_rows,

    lvl1_index type string,

    lvl2_index type string,

    lvl3_index type string.

  do 3 times.

*   save the index so that we can use it in deeper levels

    lvl1_index = sy-index.

    condense lvl1_index.

*   create a row

    row-row_key             = lvl1_index.            “

    row-parent_row_key      = ''.

    row-tree_column_text    = lvl1_index.

    row-table_column_1_text = 'some text'.

    row-table_column_2_text = 'some other text'.

    row-is_leaf             = abap_false.

    insert row into table lt_rows.

    do 3 times.

*     save the index so that we can use it in deeper levels

      lvl2_index = sy-index.

      condense lvl2_index.

*     create a row

      concatenate lvl1_index `.` lvl2_index into row-row_key.

      row-parent_row_key      = lvl1_index.

      concatenate lvl1_index `-` lvl2_index into row-tree_column_text.

      row-table_column_1_text = 'some text'.

      row-table_column_2_text = 'some other text'.

      row-is_leaf             = abap_false.

      insert row into table lt_rows.

      do 3 times.

*       save the index so that we can use it in deeper levels

        lvl3_index = sy-index.

        condense lvl3_index.

*       create a row

        concatenate lvl1_index `.` lvl2_index `.` lvl3_index into row-row_key.

        concatenate lvl1_index `.` lvl2_index into row-parent_row_key.

        concatenate lvl1_index`-` lvl2_index `-` lvl3_index into row-tree_column_text. q

        row-table_column_1_text = 'some text'.

        row-table_column_2_text = 'some other text'.

        row-is_leaf             = abap_true.

        insert row into table lt_rows.

      enddo.

    enddo.

  enddo.

  node->bind_table( new_items =  lt_rows ).

    

20WebDynpor component & WebDynpro component interface

20.1 Difference

WebDynpro ComponentWebDynpor Component 

Interface & Definition

NODE

默认就是INTERFACE 的NODE

任何NODE都是.

INTERFACE VIEW

View 没有NODE, 没有METHOD的

METHOD & EVENT & SUPPLY

FUNCTION

没有INTERFACE Checkbox可以选择

因为默认就是INTERFACE级别的

不能被实现, 只有空的定义的方法和参数

Component 级别的

Context node

Method 

Event

才有可能被做成Interface, 类型, 以后在被其他的COMP重复使用的, 才可见

20.2 How to implement the interface & Definition

20.3 Detail Comparison

BeforeAfter
"

Interface View

 

Context Node

Method

这个被定义的INTERFACE DEFINITION可以被每个COMPONENT所实现.

20.4 Working with interface definition

20.4.1WebDynpro component

21Navigation through Window Plugs

21.1Window & view & Interface view Structure

               

TIPS: MESSAGE_FROM_VIEW是默认第显示的.你要不想显示, 可以加入一个EMPTY VIEW,是系统自带的.

MAIN View是一个interface view (在另外一个COMPONENT 里面, MAIN其实是一个WINDOW的名字, 但是在被外面的COMPONENT所EMBEDED以后, 这个WINDOW实际上就变成一个INFERFACE VIEW的名字了, 挺容易让人搞糊涂的.)

最终效果

在ZTEST_ALEX_BBS7_V这个COMPONENT里面 所有的VIEW都被嵌入MAIN这个WINDOW(如果你想的话, 你可以创建三个WINDOW, 一个VIEW一个WINDOW,公平合理, 不用抢来抢去,实际上这样是不方便管理的. ) 为什么呢, 我下面就来解释, 毕竟SAP提供这个WINDOW IN/OUT BOUND PLUG是有原因, PLUG在VIEW 和WINOW上都有, 肯定是有原因的

21.2 Window Plug

如何使用DEFAULT 这个IN PLUG, 做成INTERFACE 的否则,被别人使用的时候, 这个PLUG就看不到了, 默认是INTERFACE的类型的.

多定义一个参数INDEX

然后输入以下的代码, 使用WIZARD.

这个INDEX是用来给外面的COMPONENET使用的. 想知道哪里会使用这个了, 点这里看 , 看看那个黑框没有. 

当用户点这上面的TAB的时候, 下面的这个事件会被触发. 然后

method ONACTIONCLICK_HORIZAL .

  data node    type ref to if_wd_context_node.

  data l_index type i.

  " This has so to be done manually     "ONE_LEVEL"

  node = wd_context->get_child_node( if_message_view=>wdctx_One_Level ).

  node->set_lead_selection( CONTEXT_ELEMENT ).

* Returns Index of Element

* 得到自己的INDEX, 因为有好几个TAB, 要知道第几个被选中了.

  l_index = CONTEXT_ELEMENT->GET_INDEX( ).      

* 然后把让WINDOW显示相关的VIEW.

    wd_this->fire_out_message_view_plg(

      index =  l_index

    ).

endmethod.

21.3 DEMO

ZTEST_ALEX_bbs7                             Application approach

ZTEST_ALEX_bbs7_V                        Message view component.分离数据和VIEW

22BBS Demo

22.1Login View

22.2Main View

22.3Print List

22.4Post a thread

22.5Message

22.5.1Check mail / mail setting

22.5.2Add a contact person

22.6Register a new user

文档

webdynpro abap????

WebDynproforABAPAuthor:ALEXMSN:Opparts@hotmail.comChangedHistoryExampleSystem:WDA/000PackageName:ZTEST_ALEX1ContextBinding32ViewController&ComponentController43Cardinality&Selection44Singleton&Non-singleton55SelectionCardinality75.1LeadSelectionI75.
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top