这个和上一个差不多,简单说下:
1.因为NEW是在创建搜索界面的时候加的,所以此时只需在结果界面重定义NEW事件:
method EH_ONNEW.
OP_NEW( ).
endmethod.
2.结果界面创建外向插件NEW
METHOD OP_NEW.
DATA: LR_WINDOW TYPE REF TO CL_BSP_WD_WINDOW.
LR_WINDOW = ME->VIEW_MANAGER->GET_WINDOW_CONTROLLER( ).
LR_WINDOW->CALL_OUTBOUND_PLUG( 'NEWTODETAIL' ).
ENDMETHOD.
3.WINDOW界面,创建外向插件NEWTODETAIL
METHOD OP_NEWTODETAIL.
FIRE_OUTBOUND_PLUG( IV_OUTBOUND_PLUG = 'NEWTODETAIL' ).
ENDMETHOD.
查询组件结束,开始明细组件ZLYTEST03_H
1.WINDOW创建内向插件:FROMNEW
METHOD IP_FROMNEW.
VIEW_MANAGER->NAVIGATE( SOURCE_REP_VIEW = REP_VIEW
OUTBOUND_PLUG = 'LINKTODETAIL' ).
ENDMETHOD.
2.WINDOW中创建外向插件:LINKTODETAIL
3.概览页中创建内向插件FROMMAINWD(因为查询没有用BOL的查询,所以都是以VALUE NODE处理的,此处是给个初始化值)
DATA: LR_REF_ANY TYPE REF TO DATA,
GW_EKKO TYPE EKKO,
LR_VALUE_NODE TYPE REF TO CL_BSP_WD_VALUE_NODE.
GET REFERENCE OF GW_EKKO INTO LR_REF_ANY.
CREATE OBJECT LR_VALUE_NODE
TYPE
CL_BSP_WD_VALUE_NODE
EXPORTING
IV_DATA_REF = LR_REF_ANY.
ME->TYPED_CONTEXT->RESULT->COLLECTION_WRAPPER->ADD( LR_VALUE_NODE ).
ENDMETHOD.
如果是BOL,则用下面的:
METHOD IP_FROMMAINWD.
DATA:LR_CORE TYPE REF TO CL_CRM_BOL_CORE.
DATA:LR_FACTORY TYPE REF TO CL_CRM_BOL_ENTITY_FACTORY.
DATA:LR_DETAIL TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LS_PARAMS TYPE CRMT_NAME_VALUE_PAIR,
GW_EKKO TYPE EKKO,
LT_PARAMS TYPE CRMT_NAME_VALUE_PAIR_TAB.
DATA:LR_FOUND TYPE REF TO IF_BOL_BO_PROPERTY_ACCESS. ME->TYPED_CONTEXT->DETAIL2->COLLECTION_WRAPPER->CLEAR( ). LS_PARAMS-NAME = 'EBELN'.
LS_PARAMS-VALUE = ''.
APPEND LS_PARAMS TO LT_PARAMS. LR_CORE = CL_CRM_BOL_CORE=>GET_INSTANCE( ).
LR_FACTORY = LR_CORE->GET_ENTITY_FACTORY( 'ZEKKO' ).
LR_DETAIL = LR_FACTORY->CREATE( LT_PARAMS ). CHECK LR_DETAIL IS BOUND. ME->TYPED_CONTEXT->DETAIL2->COLLECTION_WRAPPER->ADD( IV_ENTITY = LR_DETAIL
IV_SET_FOCUS = ABAP_TRUE ). IF LR_FOUND IS INITIAL.
ME->TYPED_CONTEXT->DETAIL2->COLLECTION_WRAPPER->ADD( IV_ENTITY = LR_DETAIL
IV_SET_FOCUS = ABAP_TRUE ).
ENDIF.
CALL METHOD ME->SET_VIEW_GROUP_CONTEXT
EXPORTING
IV_PARENT_CONTEXT = VIEW_GROUP_CONTEXT
IV_FIRST_TIME = ABAP_TRUE. ME->VIEW_GROUP_CONTEXT->SET_ALL_EDITABLE( ).
ENDMETHOD.
4.运行时中,创建NavigationalLinks LINKTODETAIL 丛WINDOW到概览页。
5.DETAIL的概览页,因为这时候会有空值直接跳转过来,所以需要重定义概览页的SET_VIEW_GROUP_CONTEXT
method SET_VIEW_GROUP_CONTEXT.
IF IV_FIRST_TIME EQ ABAP_TRUE AND VIEW_GROUP_CONTEXT IS INITIAL.
IF IV_PARENT_CONTEXT IS INITIAL.
CREATE OBJECT VIEW_GROUP_CONTEXT TYPE CL_BSP_WD_VIEW_GROUP_CONTEXT.
ELSE.
VIEW_GROUP_CONTEXT ?= IV_PARENT_CONTEXT.
ENDIF.
ENDIF.
endmethod.
到这里,明细组件也完成了。。。取MAIN组件
1.创建NavigationalLink NEWTODETAIL 。。。。
完成。。。