首页 > 其他分享 >UI上将BP附件放到BP结果中

UI上将BP附件放到BP结果中

时间:2023-05-06 14:46:01浏览次数:38  
标签:prop lt UI ls 附件 BP phioloios TYPE result

1,取附件内容放到新增的字段里

  METHOD get_attachment.

    DATA: current TYPE REF TO if_bol_bo_property_access.
    DATA: dref    TYPE REF TO data.
    DATA:gv_guid            TYPE crmt_object_guid,
         ls_business_object TYPE sibflporb,
         lt_phioloios       TYPE skwf_lpios,
         ls_phioloios       LIKE LINE OF lt_phioloios,
         lt_ios_prop_result TYPE crm_kw_propst,
         ls_ios_prop_result LIKE LINE OF lt_ios_prop_result,
         lt_prop            TYPE sdokproptls,
         ls_prop            TYPE sdokproptl.


    FIELD-SYMBOLS:
      <nval> TYPE any,
      <oval> TYPE any.

*   get current entity
    IF iterator IS BOUND.
      current = iterator->get_current( ).
    ELSE.
      current = collection_wrapper->get_current( ).
    ENDIF.

    current->get_property_as_value(
      EXPORTING
        iv_attr_name = 'BP_GUID'
       IMPORTING
         ev_result    = gv_guid ).

    CHECK gv_guid IS NOT INITIAL.

    "取出BP对应的附件信息
    ls_business_object-instid = gv_guid.
    ls_business_object-typeid = 'BUS1006'.
    ls_business_object-catid = 'BO'.
    CALL METHOD cl_crm_documents=>get_info
      EXPORTING
        business_object       = ls_business_object
      IMPORTING
        phioloios             = lt_phioloios
        ios_properties_result = lt_ios_prop_result.

    READ TABLE lt_phioloios INTO ls_phioloios INDEX 1.
    IF sy-subrc = 0.
      READ TABLE lt_ios_prop_result INTO ls_ios_prop_result WITH KEY objtype = ls_phioloios-objtypelo
                                                                     class   = ls_phioloios-classlo
                                                                     objid   = ls_phioloios-objidlo.
      IF sy-subrc = 0.
        READ TABLE ls_ios_prop_result-properties INTO ls_prop WITH KEY name = 'KW_RELATIVE_URL'.
        IF sy-subrc = 0.
          value = ls_prop-value.
        ENDIF.
      ENDIF.
    ENDIF.


  ENDMETHOD.

2,设置字段类型

METHOD get_p_attachment.

  CASE iv_property.
    WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
      rv_value = cl_bsp_dlc_view_descriptor=>field_type_event_link.

    WHEN if_bsp_wd_model_setter_getter=>fp_onclick.
      rv_value = 'DISPLAY_DOC'.
      "...
  ENDCASE.

3,设置点击事件

  METHOD eh_ondisplay_doc.
* Added by wizard: Handler for event 'DISPLAY_DOC'
    DATA: lv_index       TYPE int4,
          lr_entity_ext  TYPE REF TO if_bol_bo_property_access,"if_bsp_wd_ext_property_access,
          lr_entity      TYPE REF TO cl_crm_bol_entity,
          lr_coco        TYPE REF TO cl_gs_cm_bspwdcomponent,
          lr_bsp_runtime TYPE REF TO cl_bsp_runtime,
          ls_attributes  TYPE crmt_cmic_doc_attr,
          lr_data        TYPE REF TO data.
    FIELD-SYMBOLS: <fs_key> TYPE string.
    DATA: current TYPE REF TO if_bol_bo_property_access.
    DATA: dref    TYPE REF TO data.
    DATA:gv_guid            TYPE crmt_object_guid,
         ls_business_object TYPE sibflporb,
         lt_phioloios       TYPE skwf_lpios,
         ls_loio            TYPE skwf_io,
         lv_url             TYPE saeuri,
         ls_phioloios       LIKE LINE OF lt_phioloios,
         lt_ios_prop_result TYPE crm_kw_propst,
         ls_ios_prop_result LIKE LINE OF lt_ios_prop_result,
         lt_prop            TYPE sdokproptls,
         ls_prop            TYPE sdokproptl.


* get index of the table
    cl_thtmlb_util=>get_event_info( EXPORTING iv_event = htmlb_event_ex
                                    IMPORTING   ev_index = lv_index ).
* get entity from mixed note
    lr_entity_ext ?= me->typed_context->result->collection_wrapper->find( iv_index = lv_index ).

    CHECK lr_entity_ext IS BOUND.
    lr_entity_ext->get_property_as_value(
  EXPORTING
    iv_attr_name = 'BP_GUID'
   IMPORTING
     ev_result    = gv_guid ).

    CHECK gv_guid IS NOT INITIAL.

    "取出BP对应的附件信息
    ls_business_object-instid = gv_guid.
    ls_business_object-typeid = 'BUS1006'.
    ls_business_object-catid = 'BO'.
    CALL METHOD cl_crm_documents=>get_info
      EXPORTING
        business_object       = ls_business_object
      IMPORTING
        phioloios             = lt_phioloios
        ios_properties_result = lt_ios_prop_result.

    READ TABLE lt_phioloios INTO ls_phioloios INDEX 1.
    IF sy-subrc = 0.
      READ TABLE lt_ios_prop_result INTO ls_ios_prop_result WITH KEY objtype = ls_phioloios-objtypelo
                                                                     class   = ls_phioloios-classlo
                                                                     objid   = ls_phioloios-objidlo.
      IF sy-subrc = 0.
        READ TABLE ls_ios_prop_result-properties INTO ls_prop WITH KEY name = 'KW_RELATIVE_URL'.
        IF sy-subrc = 0.
        ENDIF.
      ENDIF.
      ls_loio-objtype = ls_phioloios-objtypelo.
      ls_loio-class   = ls_phioloios-classlo.
      ls_loio-objid   = ls_phioloios-objidlo.

      CALL METHOD cl_crm_documents=>get_with_url
        EXPORTING
          loio     = ls_loio
          url_type = '2'
        IMPORTING
          url      = lv_url
        EXCEPTIONS
          no_io    = 1
          OTHERS   = 2.

      CHECK lv_url IS NOT INITIAL.

      ls_attributes-url_to_display = lv_url.

      CONCATENATE gv_doc_display_js 'thtmlbSuppressOnLoadKeyboardFocus(); window.open("' ls_attributes-url_to_display '", ' sy-timlo ')' INTO gv_doc_display_js.
    ENDIF.

  ENDMETHOD.

 

效果:

 

标签:prop,lt,UI,ls,附件,BP,phioloios,TYPE,result
From: https://www.cnblogs.com/sapSB/p/17377246.html

相关文章

  • Module build failed (from ./node_modules/css-loader/dist/cjs.js): TypeError: thi
    Modulebuildfailed(from./node_modules/css-loader/dist/cjs.js):TypeError:this.getOptionsisnotafunctionModulebuildfailed(from./node_modules/css-loader/dist/cjs.js):TypeError:this.getOptionsisnotafunction 用了各种办法,没有解决问题,直接把node_m......
  • Material Design UI Widgets
     AndroidL开发者预览支持库提供两个新的Widgets,RecyclerView和CardView。使用这两个Widgets可以显示复杂的Listview和卡片布局,这两个Widgets默认使用Materialdesign。RecyclerView  RecyclerView是一个更高级柔性版本的Listview,RecyclerView是一个能包含很多视图的容器,它能......
  • CHEMKIN算例1:氢气/空气的绝热火焰温度(Equilibrium)
    问题描述本文介绍了使用气相平衡计算来确定氢气/空气系统的绝热火焰温度。绝热火焰温度是在特定条件下燃烧特定气体混合物所能达到的最高温度的量度。在包括热损失、化学动力学和/或质量传输限制的真实系统中,火焰温度可能低于绝热火焰温度。问题分析平衡计算只需要一份物种清单......
  • ABP CORE+EF 批量删除、修改
    //物理删除()//awaitthis.Repository.GetAll().Where(p=>input.Ids.Contains(p.Id)).BatchDeleteAsync();//逻辑删除,批量修改删除字段awaitthis.Repository.GetAll().Where(p=>input.Ids.Contains(p.Id)).BatchUpdateAsync(p=>newShop......
  • element UI 单选框取消勾选选项
    如图:(取消后的样式) (如果选项中有不同的样式)<el-radio-groupv-model="List"><el-radiolabel="绝对测量法"style="margin-bottom:100px;"@click.prevent.native="checkRadio1('绝对测量法')"></el-radio><......
  • 解决element-ui评分组件 半星展示不全的问题
    //解决半星展示不全的问题/deep/.el-rate{display:inline-block;margin-left:20px;&::before{display:inline-block;content:"";width:1px;margin-bottom:-5px;height:14px;margin-right:20px;background:#C9CD......
  • ERROR: Could not find a version that satisfies the requirement cv2 (from version
    现象导入cv2时,报如下的错误ERROR:Couldnotfindaversionthatsatisfiestherequirementcv2(fromversions:none)解决方案win+R打开命令行,输入 pipinstallopencv-python,下载opencv,等待下载完成即可。下载有点慢,耐心等待一下。 ......
  • JAVA中的两个容器StringBuilder和StringJoiner概述
    JAVA中的两个容器StringBuilder和StringJoiner概述StringBuilder可以看成一个容器,创建之后里面的内容是可以修改的方法名说明publicStringBuilderappend(任意类型)添加数据,并返回对象本身publicStringBuilderreverse()反转容器中的内容publicintlength()返......
  • The plugin distribution bundles IDE packages 'com.intellij.uiDesigner.core',
    错误描述:TheplugindistributionbundlesIDEpackages'com.intellij.uiDesigner.core','com.intellij.uiDesigner'.BundlingIDEpackagesisconsideredbadpracticeandmayleadtosophisticatedcompatibilityproblems.Considerexcludingthe......
  • boot-admin整合Liquibase实现数据库版本管理
    Liquibase和Flyway是两款成熟的、优秀的、开源/商业版的数据库版本管理工具,鉴于Flyway的社区版本对Oracle数据库支持存在限制,所以boot-admin选择整合Liquibase提供数据库版本管理能力支持。Liquibase开源版使用Apache2.0协议。Liquibase的适用情形?在你的项目进......