(我是菜鸟,知道的少)

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. 第一章(欢迎进入node.js世界)

    本章内容 1:Node.js是什么 2:服务器端javascript 3:node的异步和事件触发本质 4:node为谁而生 5:node程序示例 1.1 node.js他的首次亮相是在2009年,非 ...

  2. mysql分区分表讲解

    为什么要分表和分区? 日常开发中我们经常会遇到大表的情况,所谓的大表是指存储了百万级乃至千万级条记录的表.这样的表过于庞大,导致数据库在查询和插入的时候耗时太长,性能低下,如果涉及联合查询的情况,性能 ...

  3. gawk命令详解

    GNU awk: sort.cut.uniq.wc等参考: https://blog.csdn.net/lk07828/article/details/46324807 https://blog.cs ...

  4. StringBuilder的三种删除方法比较

    分别用一千万次循环来比较StringBuilder的三种删除方法所用时间 未避免偶然性,再循环一百次来比较总时间 --主类 public class StringBuilderRemove { pub ...

  5. 将实体类、匿名对象转换为SqlParameter列表

    /// <summary> /// <remarks> /// <para>将实体类/匿名对象转换为SqlParameter列表</para> /// ...

  6. centos6.6 安装MariaDB

    参考文章:yum安装MariaDB(使用国内镜像快速安装,三分钟安装完毕) 安装环境: virtualbox下CentOS6.6(32位) 遇到的问题: 通过Maria官方提供的安装方式,源是国外的源 ...

  7. 【测试工程师面试】面试官热衷询问的N个问题

    1. 数据库中左连接右连接的区别 2.JAVA中continue和break的区别 3.Linux中查看某一个进程并且杀死 1.数据库中多表连接,根据不同的表的某一个字段进行关联, 左连接是将左边表全 ...

  8. 求1000以内的质数c语言

    之前在做求1000以内的质数的时候,我们一般能想到的就是从3~(根号)no,逐一和no除,如果存在某个i使得  i|no成立的话,说明no不是质数(“i|no”是i整除除no的意思): 在<明解 ...

  9. nRF52832的SAADC

    SAADC部分思维导图 1ADC原理 1.1主要特点 1)8/10/12分辨率,使用过采样可达到14位分辨率 2)多达8个通道 单端输入时使用1个通道,2个通道可组成差分输入 单端和差分输入时均可配置 ...

  10. (转载)Attempting to add QLayout "" to MainWindow "", which already has a layout

    给QWidget或者QDialog设置布局的时候方式很简单.创建好一个布局:mainLayout,然后不停地把各个控件往mainLayout里面放,最后调用setLayout(mainLayout)就 ...