(我是菜鸟,知道的少)

1.有HTML页面代码的,可以编辑

<%@page language="abap" %>
<%@extension name="thtmlb" prefix="thtmlb" %>
<%@extension name="chtmlb" prefix="chtmlb" %>
<%@extension name="bsp" prefix="bsp" %>
<%--<thtmlb:toolbar buttons = "<%= controller->IF_BSP_WD_DYN_BTN_CONTROL~GET_LOCAL_TOOLBAR_BUTTONS( ) %>"
id = "toolbar"
maxButtonNumber = "<%= controller->IF_BSP_WD_DYN_BTN_CONTROL~GET_NO_OF_VISIBLE_TOOLBAR_BTNS( ) %>" />--%>
<%--<chtmlb:config displayMode = " "
mode = "RUNTIME"
xml = "<%= controller->configuration_descr->get_config_data( ) %>" />--%> <chtmlb:configGrid columnSize="16" rowSize="3" width="100%">
<chtmlb:configGridCell colSpan="5" columnIndex="1" rowIndex="1" rowSpan="1" >
<thtmlb:label id = "upload_label"
for = "upload"
design = "LABELRIGHT"
text = "<%= page->otr_trim( 'CRM_UIU_GS_CM/UPLOAD_DOC' ) %>"
tooltip = "<%= page->otr_trim( 'CRM_UIU_GS_CM/UPLOAD_DOC' ) %>"
width = "100%"/>
</chtmlb:configGridCell> <chtmlb:configGridCell colSpan="11" columnIndex="6" rowIndex="1" rowSpan="1" >
<thtmlb:fileUpload id = "upload"
size = "45" />
</chtmlb:configGridCell> <chtmlb:configGridCell colSpan="16" columnIndex="1" rowIndex="3" rowSpan="1" >
<thtmlb:button id = "attach"
onClick = "ATTACH"
enabled = "TRUE"
text = "<%=otr(CRM_UIU_GS_CM/UPLOAD)%>" /> <thtmlb:button id = "cancel"
onClick = "cancel"
enabled = "TRUE"
text = "<%=otr(CRM_UIU_GS_CM/CANCEL)%>" />
</chtmlb:configGridCell> </chtmlb:configGrid>

这种是在页面对应位置加按钮,并把按钮对应到相应事件,然后在事件中实现按钮功能

2.普通的页面可以在工具栏相关方法GET_BUTTONS中

METHOD IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS.
DATA: LS_BUTTON TYPE CRMT_THTMLB_BUTTON_EXT.
DATA: LV_URL TYPE STRING,
LV_URL2 TYPE STRING,
LV_OBJECT_ID TYPE CRMT_OBJECT_ID,
LV_SRV_TYPE TYPE ZDTEL00003Y,
LV_SMARTFORM_NAME TYPE TDSFNAME. DATA: LR_ENTITY TYPE REF TO CL_CRM_BOL_ENTITY,
LR_COLL TYPE REF TO IF_BOL_ENTITY_COL,
LR_CURRENT TYPE REF TO IF_BOL_BO_PROPERTY_ACCESS,
LR_ENTITY_ORG TYPE REF TO CL_CRM_BOL_ENTITY,
LV_PROCESS_TYPE TYPE STRING,
LS_ORGSET_BTIL TYPE CRMST_ORGSET_BTIL. FIELD-SYMBOLS: <FS_OBJECT_ID> TYPE CRMT_OBJECT_ID. CALL METHOD SUPER->IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS
RECEIVING
RT_BUTTONS = RT_BUTTONS. DELETE RT_BUTTONS WHERE ON_CLICK = 'OUTPUT'.
DELETE RT_BUTTONS WHERE ON_CLICK = 'PRINT_PREVIEW'. LR_ENTITY ?= ME->ZTYPED_CONTEXT->BTADMINH->COLLECTION_WRAPPER->GET_CURRENT( ).
IF LR_ENTITY IS BOUND.
TRY.
LV_PROCESS_TYPE = LR_ENTITY->GET_PROPERTY_AS_STRING( IV_ATTR_NAME = 'PROCESS_TYPE').
CALL METHOD LR_ENTITY->IF_BOL_BO_PROPERTY_ACCESS~GET_PROPERTY_AS_VALUE
EXPORTING
IV_ATTR_NAME = 'OBJECT_ID'
IMPORTING
EV_RESULT = LV_OBJECT_ID.
LR_COLL = LR_ENTITY->GET_RELATED_ENTITIES( IV_RELATION_NAME = 'BTHeaderOrgmanSet' ). "
LR_CURRENT = LR_COLL->GET_CURRENT( ).
IF LR_CURRENT IS BOUND.
LR_ENTITY_ORG ?= LR_CURRENT.
LR_ENTITY_ORG->IF_BOL_BO_PROPERTY_ACCESS~GET_PROPERTIES( IMPORTING ES_ATTRIBUTES = LS_ORGSET_BTIL ).
ENDIF.
CATCH CX_CRM_CIC_PARAMETER_ERROR.
ENDTRY.
ENDIF. CHECK LV_OBJECT_ID IS NOT INITIAL. CHECK LV_PROCESS_TYPE = 'ZSR2' OR LV_PROCESS_TYPE = 'ZSR3' OR LV_PROCESS_TYPE = 'ZSV1' OR LV_PROCESS_TYPE = 'ZSV2' OR LV_PROCESS_TYPE = 'ZSV3' OR LV_PROCESS_TYPE = 'ZWO4'. CASE LV_PROCESS_TYPE.
WHEN 'ZSR2'.
LV_SMARTFORM_NAME = 'ZEXCH'.
CONCATENATE 'javascript:window.open( "/sap/bc/webdynpro/sap/ZCRM_PRINT' '?object_id=' LV_OBJECT_ID '&smartform_name=' LV_SMARTFORM_NAME '");' INTO LV_URL. WHEN 'ZSR3'.
LV_SMARTFORM_NAME = 'ZREFUND'.
CONCATENATE 'javascript:window.open( "/sap/bc/webdynpro/sap/ZCRM_PRINT' '?object_id=' LV_OBJECT_ID '&smartform_name=' LV_SMARTFORM_NAME '");' INTO LV_URL. WHEN 'ZSV1'.
IF LS_ORGSET_BTIL-SALES_ORG = 'O 50000178'.
LV_SMARTFORM_NAME = 'ZSRV_ORD'.
ELSEIF LS_ORGSET_BTIL-SALES_ORG = 'O 50000192' OR LS_ORGSET_BTIL-SALES_ORG = 'O 50000194'.
LV_SMARTFORM_NAME = 'ZSRV_ORD_ZA'.
ELSE.
LV_SMARTFORM_NAME = 'ZSRV_ORD_N'.
ENDIF.
* lv_smartform_name = 'ZSERVICE_ORD'.
CONCATENATE 'javascript:window.open( "/sap/bc/webdynpro/sap/ZCRM_PRINT' '?object_id=' LV_OBJECT_ID '&smartform_name=' LV_SMARTFORM_NAME '");' INTO LV_URL. * lv_smartform_name = 'ZSRV_ORD_N'.
* CONCATENATE 'javascript:window.open( "/sap/bc/webdynpro/sap/ZCRM_PRINT' '?object_id=' lv_object_id '&smartform_name=' lv_smartform_name '");' INTO lv_url2. WHEN 'ZSV2'.
IF LS_ORGSET_BTIL-SALES_ORG = 'O 50000192' OR LS_ORGSET_BTIL-SALES_ORG = 'O 50000194'.
LV_SMARTFORM_NAME = 'ZSERVICE_ORD_ZA'.
ELSE.
LV_SMARTFORM_NAME = 'ZSERVICE_ORD'.
ENDIF.
CONCATENATE 'javascript:window.open( "/sap/bc/webdynpro/sap/ZCRM_PRINT' '?object_id=' LV_OBJECT_ID '&smartform_name=' LV_SMARTFORM_NAME '");' INTO LV_URL. WHEN 'ZSV3'.
IF LS_ORGSET_BTIL-SALES_ORG = 'O 50000131'.
LV_SMARTFORM_NAME = 'ZSERVICE_ORD_AU'.
ELSEIF LS_ORGSET_BTIL-SALES_ORG = 'O 50000192' OR LS_ORGSET_BTIL-SALES_ORG = 'O 50000194'.
LV_SMARTFORM_NAME = 'ZSERVICE_ORD_ZA'.
ELSE.
LV_SMARTFORM_NAME = 'ZSERVICE_ORD'.
ENDIF.
CONCATENATE 'javascript:window.open( "/sap/bc/webdynpro/sap/ZCRM_PRINT' '?object_id=' LV_OBJECT_ID '&smartform_name=' LV_SMARTFORM_NAME '");' INTO LV_URL. WHEN 'ZWO4'.
LV_SMARTFORM_NAME = 'ZSERVICE_ORD'.
CONCATENATE 'javascript:window.open( "/sap/bc/webdynpro/sap/ZCRM_PRINT' '?object_id=' LV_OBJECT_ID '&smartform_name=' LV_SMARTFORM_NAME '");' INTO LV_URL. WHEN OTHERS.
ENDCASE. * CONCATENATE 'javascript:window.open( "/sap/bc/webdynpro/sap/ZCRM_PRINT' '?object_id=' lv_object_id '&smartform_name=' lv_smartform_name '");' INTO lv_url.
*
CLEAR LS_BUTTON.
LS_BUTTON-TEXT = CL_WD_UTILITIES=>GET_OTR_TEXT_BY_ALIAS( 'ZCRM/PDFPRINT' ). "#EC NOTEXT
LS_BUTTON-ON_CLIENT_CLICK = LV_URL.
LS_BUTTON-ENABLED = ABAP_TRUE. "#EC NOTEXT
INSERT LS_BUTTON INTO RT_BUTTONS INDEX . CALL METHOD LR_ENTITY->IF_BOL_BO_PROPERTY_ACCESS~GET_PROPERTY_AS_VALUE
EXPORTING
IV_ATTR_NAME = 'ZZFLD00000N'
IMPORTING
EV_RESULT = LV_SRV_TYPE. CLEAR:LV_URL,LS_BUTTON.
LV_SMARTFORM_NAME = 'ZREPAIR_REP01'.
CONCATENATE 'javascript:window.open( "/sap/bc/webdynpro/sap/ZCRM_PRINT' '?object_id=' LV_OBJECT_ID '&smartform_name=' LV_SMARTFORM_NAME '");' INTO LV_URL.
LS_BUTTON-TEXT = 'Repair Rep Print'. "#EC NOTEXT
LS_BUTTON-ON_CLIENT_CLICK = LV_URL.
LS_BUTTON-ENABLED = ABAP_TRUE. "#EC NOTEXT
INSERT LS_BUTTON INTO RT_BUTTONS INDEX . IF LV_PROCESS_TYPE = 'ZSV1'.
CLEAR:LV_URL,LS_BUTTON.
LV_SMARTFORM_NAME = 'ZCRM_SERVICE_01'.
CONCATENATE 'javascript:window.open( "/sap/bc/webdynpro/sap/ZCRM_PRINT' '?object_id=' LV_OBJECT_ID '&smartform_name=' LV_SMARTFORM_NAME '");' INTO LV_URL.
LS_BUTTON-TEXT = 'Repair Follow Print'. "#EC NOTEXT
LS_BUTTON-ON_CLIENT_CLICK = LV_URL.
LS_BUTTON-ENABLED = ABAP_TRUE. "#EC NOTEXT
INSERT LS_BUTTON INTO RT_BUTTONS INDEX .
ENDIF. * CLEAR ls_button.
* ls_button-text = cl_wd_utilities=>get_otr_text_by_alias( 'ZCRM/DELIVPRT' ). "#EC NOTEXT
* ls_button-on_client_click = lv_url2.
* ls_button-enabled = abap_true. "#EC NOTEXT
* INSERT ls_button INTO rt_buttons INDEX 10. ENDMETHOD.

这个就相当与DIALOG中的SET_PF_STATUS

3.申请处理的DO_PREPARE_OUTPUT方法,这个相当于PBO

  METHOD do_prepare_output.
CALL METHOD super->do_prepare_output
EXPORTING
iv_first_time = abap_false.
*初始化按钮-Begin
do_init_button( ).
*初始化按钮-End
ENDMETHOD.
  METHOD do_init_button.
DATA:
lv_enabled TYPE abap_bool,
ls_button TYPE crmt_thtmlb_button,
lv_script TYPE string,
lv_true_false TYPE string,
lv_smartform_name TYPE tdsfname VALUE 'ZCRM_SERVICE_02',
lv_zserialno TYPE zserialno,
lv_zstatus TYPE zsrve_status,
lv_object TYPE crmt_object_id_db,
lv_url TYPE string,
lv_index TYPE i VALUE .
DATA:lv_bol TYPE REF TO if_bol_bo_col,
lv_access TYPE REF TO if_bol_bo_property_access.
* 导入
CLEAR:ls_button .
READ TABLE gt_button INTO ls_button WITH KEY on_click = 'ZUPLOAD'.
IF sy-subrc <> .
CLEAR ls_button.
ls_button-type = cl_thtmlb_util=>gc_icon_new.
ls_button-tooltip = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_MKTRRG/IMPORT' ).
ls_button-text = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_MKTRRG/IMPORT' ).
ls_button-on_click = 'ZUPLOAD' . "#EC NOTEXT
ls_button-enabled = abap_true .
APPEND ls_button TO gt_button .
ENDIF.
* 下载模板
CLEAR:ls_button .
READ TABLE gt_button INTO ls_button WITH KEY on_click = 'DOWNLOAD'.
IF sy-subrc <> .
CLEAR :
lv_url, lv_script,ls_button .
lv_url = '../../sap/ZCRM_EXCEL_IMP/ZSRVS_QUERY_002_RESULT_UI.xlsx' .
* CONCATENATE `thtmlbExcelExportGen('`
CONCATENATE `javascript:window.open('`
lv_url
`',`
'false'
`)`
INTO lv_script .
***模版下载另类处理方式 CONCATENATE `javascript:window.open('`
ls_button-type = cl_thtmlb_util=>gc_icon_file_spreadsheet.
ls_button-tooltip = text- .
ls_button-text = text- .
ls_button-on_click = 'DOWNLOAD' . "#EC NOTEXT
ls_button-on_client_click = lv_script .
ls_button-enabled = abap_true .
APPEND ls_button TO gt_button .
ENDIF. "ADD BY LY 20170220 FRO PRINT
lv_bol = me->typed_context->searchresultnode->collection_wrapper->get_marked( ).
IF lv_bol IS BOUND.
lv_access = lv_bol->get_current( ).
IF lv_access IS BOUND.
lv_access->get_property_as_value(
EXPORTING
iv_attr_name = 'ZSTATUS'
IMPORTING
ev_result = lv_zstatus ).
IF lv_zstatus = ''.
lv_access->get_property_as_value(
EXPORTING
iv_attr_name = 'ZSERIALNO'
IMPORTING
ev_result = lv_zserialno ).
ENDIF.
ENDIF.
ENDIF.
CLEAR:ls_button .
READ TABLE gt_button INTO ls_button WITH KEY id = 'PRNT'.
IF sy-subrc <> .
CLEAR :
lv_url, lv_script,ls_button .
CONCATENATE 'javascript:window.open( "/sap/bc/webdynpro/sap/ZCRM_PRINT' '?object_id=' lv_object '&smartform_name=' lv_smartform_name
'&zserialno=' lv_zserialno '");' INTO lv_url.
ls_button-id = 'PRNT'.
ls_button-text = text-.
ls_button-on_client_click = lv_url .
ls_button-enabled = abap_false .
APPEND ls_button TO gt_button.
ELSE.
lv_index = sy-tabix.
CLEAR:lv_script,ls_button .
IF lv_zstatus = ''.
CONCATENATE 'javascript:window.open( "/sap/bc/webdynpro/sap/ZCRM_PRINT' '?object_id=' lv_object '&smartform_name=' lv_smartform_name
'&zserialno=' lv_zserialno '");' INTO lv_url.
ls_button-enabled = abap_true .
ELSE.
ls_button-enabled = abap_false .
ENDIF. ls_button-on_client_click = lv_url . MODIFY gt_button FROM ls_button INDEX lv_index TRANSPORTING on_client_click enabled .
ENDIF.
ENDMETHOD.

UI界面按钮增强的更多相关文章

  1. Android开发1:基本UI界面设计——布局和组件

    前言 啦啦啦~本学期要开始学习Android开发啦~ 博主在开始学习前是完完全全的小白,只有在平时完成老师要求的实验的过程中一步一步学习~从此篇博文起,博主将开始发布Android开发有关的博文,希望 ...

  2. 单据UI界面设计开发

    1.新建单据界面数据 2.创建数据模型,包括单据.单据行.设置应用缺省特性,每个模型树下只有一个红色项 3.新增动作,系统默认没有弃审支作按钮事件 4. 新增UI Form,选择对应的模型树及表单类别 ...

  3. 使用AsyncTask异步更新UI界面及原理分析

    概述: AsyncTask是在Android SDK 1.5之后推出的一个方便编写后台线程与UI线程交互的辅助类.AsyncTask的内部实现是一个线程池,所有提交的异步任务都会在这个线程池中的工作线 ...

  4. 在Android中实现service动态更新UI界面

    之前曾介绍过Android的UI设计与后台线程交互,据Android API的介绍,service一般是在后台运行的,没有界面的.那么如何实现service动态更新UI界面呢?案例:通过service ...

  5. QT共享库的创建与调用(初级)(附:UI界面不能被改变的其中一个原因)

    背景: 最近在做的一个项目其中一部分既是实现PC与下位机的USB通信.windows平台下已经完成,现需移植到linux平台下. 在linux系统中,通过一段时间的工作,设备已被配置成hid类(后续再 ...

  6. BCG界面库下的Windows8 UI界面样式www.webui8.com

    BCG界面库下的Windows8 UI界面样式(Metro风格)控件主要有以下一些功能: 规则的大块磁贴 支持完整键盘导航 Tile组 标题(Caption) 标题按钮(Caption buttons ...

  7. WPF--Dispatcher.BeginInvoke()方法使用不当导致UI界面卡死的原因分析

    原文地址: http://www.tuicool.com/articles/F7reem http://blog.csdn.net/yl2isoft/article/details/11711833 ...

  8. NGUI 学习笔记实战——制作商城UI界面

    http://www.cnblogs.com/chongxin/p/3876575.html Unity3D的uGUI听说最近4.6即将推出,但是目前NGUI等UI插件大行其道并且已经非常成熟,所以我 ...

  9. Android——控制UI界面

    一.使用XML布局文件控制UI界面 res\layout\activity_main.xml代码如下: <FrameLayout xmlns:android="http://schem ...

随机推荐

  1. ffmpeg 下载安装和简单应用

    一.ffmpeg下载 先到http://ffmpeg.org/下载ffmpeg安装文件 二.ffmpeg安装 1.解压下载完的ffmpeg-20190319-f8075b2-win64-shared. ...

  2. C语言调用Python 混合编程

    导语 Python有很多库,Qt用来编写界面,自然产生C++调用Python的需求.一路摸索,充满艰辛 添加头文件搜索路径,导入静态库 我的python头文件搜索路径:C:\Python27amd64 ...

  3. 【AT1219】历史研究

    Problem Description \(IOI\)国历史研究的第一人--\(JOI\)教授,最近获得了一份被认为是古代\(IOI\)国的住民写下的日记.\(JOI\)教授为了通过这份日记来研究古代 ...

  4. Java—网络编程基础

    URL的应用: 获得网页源代码可以用字节流.字符流,流的获取可以用url.openStream(),也可以用con.getInputStream(): 字节流: URL url = new URL(& ...

  5. python 目录切换

    #- * -coding: utf - - * - import os, sys path = "c:\\" # 查看当前工作目录 retval = os.getcwd() pri ...

  6. sql 中常见的控制流语句

    控制流语句:1 begin .....end  2 if ...else  例如:if exists (select * from 表名称 ) begin selct * from  表名称 end  ...

  7. Vue 中 export及export default的区别

    相信很多人都在vue使用过export.export default.import,然而它们到底有什么区别呢? 在ES6中,export与export default均可用于导出常量.函数.文件.模块 ...

  8. Python全栈开发-Day1-Python基础1

    目录 Python介绍 Python 2 or 3? 安装 Hello World程序 变量 用户输入 模块初识 .pyc是个什么鬼? 数据类型初识 数据运算 表达式if ...else语句 表达式f ...

  9. Interval 间隔问题

    2018-09-07 09:03:14 一.Merge Intervals 问题描述: 问题求解: public List<Interval> merge(List<Interval ...

  10. Linux 各种软件的安装-mediawiki + wordpress篇

    php apache mysql 三剑客安装好后,可以愉快地安装一些成熟的web应用啦,比如wordpress可以当做自己的笔记本,mediawiki整理知识库. 首先是mediawiki,网上说不错 ...