• CRM WEB UI 01 BOL向导创建的搜索


    创建BOL的步骤就不说了,自己找,学习这个之前,需要自己先找个SAP CRM资料预习一下

    T-CODE:BSP_WD_CMPWB

    1.创建组件:输入组件名:ZLYTEST03,点击创建按钮,回车,选择包和请求。。。回车,回车,回车,知道创建成功,进入组件里。

    2.加入BOL:点击运行时资源库编辑器,点击修改右键'MODEL',添加自建的或者标准的BOL。保存,F3退出一下,再进入,会带出BOL浏览器按钮。

    3.创建视图:点击组件结构浏览器,选择视图,右键,‘创建搜索页面’,选择搜索节点和结果节点(此节点需要在BOL中添加)。单选或者多选。。选择需要做链接的字段(如无,则下一步),如果需要结果视图中增加按钮,可自行添加,点击继续,完成。

    4.配置SEARCH界面和RESULT界面,需要那些字段自己加。

    5.运行,会出现上面配置的搜索条件和搜索界面界面(如果是自己一个个建的,需要将查询和结果视图加到视图集中,将视图集加到WINDOWS中)

    6.搜索代码实现:在查询视图的事件处理器中,重定义查询(如果已经在BOL里写了查询代码的,自行解决)

    DATA:
          LR_QUERY_SERVICE   TYPE REF TO   CL_CRM_BOL_DQUERY_SERVICE,
          LR_MESSAGE_SERVICE TYPE REF TO   CL_BSP_WD_MESSAGE_SERVICE,
          LV_MESSAGE         TYPE          STRING,
          LR_SEL_PARAMS      TYPE REF TO   IF_BOL_BO_COL,
          LR_COL             TYPE REF TO   IF_BOL_BO_COL,
          LR_PARAM           TYPE REF TO   IF_BOL_BO_PROPERTY_ACCESS,
          LR_ITERATOR        TYPE REF TO   IF_BOL_BO_COL_ITERATOR,
          LS_SELECTION       TYPE          GENILT_SELECTION_PARAMETER,
          LT_PARAMS          TYPE          GENILT_SELECTION_PARAMETER_TAB,
          LV_MAX_HITS        TYPE          I,
          LR_VALUENODE       TYPE REF TO   CL_BSP_WD_VALUE_NODE,
          GS_CLAUSE          TYPE STRING,
          GT_CLAUSE          TYPE TABLE OF STRING,
          GT_EKKO            TYPE TABLE OF EKKO,
          GW_EKKO            TYPE EKKO..
    
        "获取当前查询节点
        LR_QUERY_SERVICE ?= ME->TYPED_CONTEXT->SEARCHQUERYNODE->COLLECTION_WRAPPER->GET_CURRENT( ).
    
        "检查查询节点实例化
        CHECK LR_QUERY_SERVICE IS BOUND.
    
        "清空结果节点内容
        ME->TYPED_CONTEXT->SEARCHRESULTNODE->COLLECTION_WRAPPER->CLEAR( ).
    
        "获取查询对象
        LR_SEL_PARAMS = LR_QUERY_SERVICE->GET_SELECTION_PARAMS( ).
    
        "获取最大值
        LR_QUERY_SERVICE->GET_PROPERTY_AS_VALUE( EXPORTING IV_ATTR_NAME = 'MAX_HITS'
                                                 IMPORTING EV_RESULT = LV_MAX_HITS ).
    
        "获取查询对象的BOL迭代器^_^
        LR_ITERATOR   = LR_SEL_PARAMS->GET_ITERATOR( ).
    
        "迭代器循环获取查询对象的值
        LR_PARAM      = LR_ITERATOR->GET_FIRST( ).
    
    
        WHILE LR_PARAM IS BOUND.
          LR_PARAM->GET_PROPERTIES( IMPORTING ES_ATTRIBUTES = LS_SELECTION ).
          IF LS_SELECTION-LOW IS NOT INITIAL OR LS_SELECTION-HIGH IS NOT INITIAL."选择条件有值
            IF LS_SELECTION-LOW IS NOT INITIAL AND LS_SELECTION-HIGH IS NOT INITIAL AND LS_SELECTION-OPTION = 'BT'.
              CONCATENATE LS_SELECTION-ATTR_NAME 'BETWEEN' LS_SELECTION-LOW 'AND' LS_SELECTION-HIGH INTO GS_CLAUSE SEPARATED BY ' '.
            ENDIF.
            IF LS_SELECTION-LOW IS NOT INITIAL.
    IF LS_SELECTION-OPTION <> 'EQ' AND LS_SELECTION-OPTION <> 'NE'.
                REPLACE ALL OCCURRENCES OF '*' IN LS_SELECTION-LOW WITH '%'.
                CONCATENATE '''' LS_SELECTION-LOW '''' INTO LS_SELECTION-LOW.
                CONCATENATE LS_SELECTION-ATTR_NAME 'LIKE' LS_SELECTION-LOW INTO GS_CLAUSE SEPARATED BY ' '.
                ELSE.
                  CONCATENATE LS_SELECTION-ATTR_NAME LS_SELECTION-OPTION LS_SELECTION-LOW INTO GS_CLAUSE SEPARATED BY ' '.
              ENDIF.
    ENDIF.

    APPEND GS_CLAUSE TO GT_CLAUSE.
    ENDIF.
    *      APPEND LS_SELECTION TO LT_PARAMS.
          LR_PARAM = LR_ITERATOR->GET_NEXT( ).
        ENDWHILE.
    
    
        SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_EKKO
            FROM EKKO WHERE (GT_CLAUSE).
    
    
        DATA:  LR_REF_ANY    TYPE REF TO DATA,
               LR_VALUE_NODE TYPE REF TO CL_BSP_WD_VALUE_NODE.
    
        CREATE OBJECT LR_COL TYPE CL_CRM_BOL_BO_COL.
    
        LOOP AT GT_EKKO INTO GW_EKKO.
          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.
          LR_COL->ADD( LR_VALUE_NODE ).
    
    
        ENDLOOP.
    
        ME->TYPED_CONTEXT->SEARCHRESULTNODE->COLLECTION_WRAPPER->ADD_COLLECTION( LR_COL ).

    好了,到这里,搜索视图搞定了。。。可以运行起来看看了

  • 相关阅读:
    J2那几个E和Web基础
    PHP开发人员对JAVA的WEB开发入门(初版-基础知识)
    一个处理大数据的后台服务(已废弃)
    一个请求过来都经过了什么
    请一定记得升级java虚拟机
    面向对象之 结构体和类的区别
    Swift 结构体的使用
    iOS 波浪效果的实现
    iOS 常用三方(持续更新)
    Xshell 链接 Could not connect to '192.168.80.129' (port 22): Connection failed
  • 原文地址:https://www.cnblogs.com/sapSB/p/6340237.html
Copyright © 2020-2023  润新知