项目上看到的,感觉很厉害的样子,所以要存档。。。

说一下思路:画的SF,然后在WDA里调用SF,产生PDF数据流,然后在WDA里用PDF展示出来,UI调用。。。

COMPONENTCONTROLLER:

NODE:PDF

ATTRBUTE:SOURCE type XSTRING.

NODE:ORDER

ATTR:OBJECT_ID TYPE CRMT_OBJECT_ID

SMARTFORM_NAME TYPE TDSFNAME

wda VIEW:

METHOD wddomodifyview .
* variable declarations
DATA:
w_form_name TYPE tdsfname,
w_fmodule TYPE rs38l_fnam,
w_cparam TYPE ssfctrlop,
w_outoptions TYPE ssfcompop,
w_bin_filesize TYPE i, " Binary File Size
w_bin_file TYPE xstring,
w_filename TYPE string,
w_file_path TYPE string,
w_full_path TYPE string.
DATA:gv_zzafld000018 TYPE zadtel00006a.
DATA:lv_case TYPE c. DATA lo_nd_order TYPE REF TO if_wd_context_node.
DATA lo_el_order TYPE REF TO if_wd_context_element.
DATA ls_order TYPE wd_this->element_order.
DATA lo_nd_pdf TYPE REF TO if_wd_context_node.
DATA lo_el_pdf TYPE REF TO if_wd_context_element.
DATA ls_pdf TYPE wd_this->element_pdf.
DATA lv_source TYPE wd_this->element_pdf-source. lo_nd_order = wd_context->get_child_node( name = wd_this->wdctx_order ).
lo_el_order = lo_nd_order->get_element( ).
lo_el_order->get_static_attributes( IMPORTING static_attributes = ls_order ). "ADD BY LY 20170224
"维修完工报告单打印向用户收费的值为空 case 1 否则弹窗 case 2 3
IF first_time = abap_true AND ls_order-smartform_name = 'ZCRM_SERVICE_03'.
SELECT SINGLE zzafld000018 INTO gv_zzafld000018
FROM crmd_orderadm_h
WHERE object_id = ls_order-object_id.
IF gv_zzafld000018 = ''.
ELSE.
popup( ).
EXIT.
ENDIF.
ELSE.
ENDIF. zcl_crm_attributes=>gv_zcrm_print = abap_true. CALL FUNCTION 'ZSRV_PRINT_TO_PDF'
EXPORTING
iv_samrtform = ls_order-smartform_name "'ZREFUND'
iv_object_id = ls_order-object_id "'0074000104'
iv_zserialno = ls_order-zserialno "'0074000104'
iv_case = ls_order-gv_case "'0074000104'
IMPORTING
file = w_bin_file. CHECK w_bin_file IS NOT INITIAL. lo_nd_pdf = wd_context->get_child_node( name = wd_this->wdctx_pdf ).
lo_el_pdf = lo_nd_pdf->get_element( ).
lv_source = w_bin_file.
lo_el_pdf->set_attribute( name = `SOURCE` value = lv_source ).
ENDMETHOD.

VIEW布局中:

加INTERACTIVE_FORM

pdfsource 绑定source

wda WINDOW:Inbound Plugs(属性中勾选interface)

DEFAULT

WDEVENT type ref to  CL_WD_CUSTOM_EVENT
OBJECT_ID                 CRMT_OBJECT_ID
SMARTFORM_NAME     TDSFNAME

METHOD HANDLEDEFAULT .
DATA LO_ND_ORDER TYPE REF TO IF_WD_CONTEXT_NODE. DATA LO_EL_ORDER TYPE REF TO IF_WD_CONTEXT_ELEMENT.
DATA LS_ORDER TYPE WD_THIS->ELEMENT_ORDER. LO_ND_ORDER = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_ORDER ).
LO_EL_ORDER = LO_ND_ORDER->GET_ELEMENT( ).
LO_EL_ORDER->GET_STATIC_ATTRIBUTES( IMPORTING STATIC_ATTRIBUTES = LS_ORDER ). LS_ORDER-OBJECT_ID = OBJECT_ID.
LS_ORDER-SMARTFORM_NAME = SMARTFORM_NAME.
LS_ORDER-ZSERIALNO = ZSERIALNO."ADD BY LY 20170220
IF SMARTFORM_NAME = 'ZCRM_SERVICE_03'.
LS_ORDER-GV_CASE = ''.
ENDIF. LO_EL_ORDER->SET_STATIC_ATTRIBUTES( STATIC_ATTRIBUTES = LS_ORDER ).
ENDMETHOD.

UI

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.
"ADD BY LY 20170224
"对于销售组织为O 50000231的维修工单(单据类型为ZSV1),在点击抬头的“Repair Rep Print”按钮时,
"判断如果维修工单抬头的量贩店延保是否向用户收费的值为空,则打印完工报告PDF,取值逻辑为Case 1。
IF LV_PROCESS_TYPE = 'ZSV1' AND LS_ORGSET_BTIL-SALES_ORG = 'O 50000231'..
LV_SMARTFORM_NAME = 'ZCRM_SERVICE_03'.
ELSE.
LV_SMARTFORM_NAME = 'ZREPAIR_REP01'.
ENDIF.
* 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.

WEB UI 界面打印PDF的更多相关文章

  1. 随心所欲导出你的 UI 界面到 PDF 文件

    使用 C1PDF 控件可以导出文件到 PDF 文件,结合 .NET 平台特性你可以在任何客户端生成自定义报表.你可以打印任何 UI 界面,例如 DataGrid 导出到 PDF. 在本篇文章中我们将阐 ...

  2. HiveServer2的WEB UI界面

    1.hive-site.xml配置如下: <property>    <name>hive.server2.webui.host</name>    <val ...

  3. azkaban web ui界面出现异常诡异“丑”界面的问题解决(图文详解)

    前期博客 启动azkaban时出现User xml file conf/azkaban-users.xml doesn't exist问题解决(图文详解) 问题详情 [hadoop@master co ...

  4. kafka自带没web ui界面,怎么办?安装个第三方的

    见 基于Web的Kafka管理器工具之Kafka-manager的编译部署详细安装 (支持kafka0.8.0.9和0.10以后版本)(图文详解)(默认端口或任意自定义端口)  

  5. Hbase配置WEB UI界面

    1 找到各个节点下面的Hbase-site.xml文件,添加如下配置 <property> <name>hbase.master.info.port</name> ...

  6. 免费素材:25套免费的 Web UI 设计的界面元素(转)

    Web 元素是任何网站相关项目都需要的,质量和良好设计的元素对于设计师来说就像宝贝一样.如果您正在为您的网站,博客,Web 应用程序或移动应用程序寻找完美设计的网页元素,那么下面这个列表会是你需要的. ...

  7. CRM UI 打印PDF

    这是项目上看到的绝技^_^ 1.画SF.这步就不说了 2.确定参数,写SF打印PDF函数 FUNCTION zsrv_print_to_pdf . *"------------------- ...

  8. Eureka Web UI URL(eureka显示主界面路径设定)

    http://stackoverflow.com/questions/30200988/spring-cloud-with-eureka-eureka-web-ui-url ************* ...

  9. 免费后台管理UI界面、html源码推荐

    一个好的UI应该满足的条件应该达到如下几个: 1.美观.大方.简洁 2.兼容IE8.不考虑兼容IE6/IE7,因为现在还有很多公司在使用Win7系统,系统内置了IE8 3.能通过选项卡打开多个页面,不 ...

随机推荐

  1. mysql表分区存储过程

    本文为博主原创,未经允许不得转载: 由于数据库一张表数据量有几千万条,而且在不断增长,看见公司前辈写了一个创建表分区的存储过程,感觉 甚是牛逼,在此供自己保留学习. /*PROCEDURE creat ...

  2. 《机器学习实战》之k-近邻算法(手写识别系统)

    这个玩意和改进约会网站的那个差不多,它是提前把所有数字转换成了32*32像素大小的黑白图,然后转换成字符图(用0,1表示),将所有1024个像素点用一维矩阵保存下来,这样就可以通过knn计算欧几里得距 ...

  3. BZOJ 2809: [Apio2012]dispatching(左偏树)

    http://www.lydsy.com/JudgeOnline/problem.php?id=2809 题意: 思路:最简单的想法就是枚举管理者,在其子树中从薪水低的开始选起,但是每个节点都这样处理 ...

  4. Python 网页解析器

    Python 有几种网页解析器? 1. 正则表达式 2.html.parser (Python自动) 3.BeautifulSoup(第三方)(功能比较强大) 是一个HTML/XML的解析器 4.lx ...

  5. JavaSE习题 第七章 常用实用类

    问答题 1.怎样实例化一个Calendar对象? Calendar ca=Calendar.getInstance(); 2.Calendar对象调用set(1949,9,1)设置的年月日分别是多少? ...

  6. Oracle(限定查询2)

    3.2 对数据进行限定查询 在标准SQL之中定义了许多的运算符. 3.2.1.关系运算符 范例: 范例: 范例: 在使用关系运算符判断字符数据的时候注意大小写的编写问题.因为Oracle是区分大小写的 ...

  7. MATLAB数据类型

    数据类型 1数值类型 @整数 *浮点型转整数型的转换函数,将数值转换为最为接近的整数值,若分数部分为0.5时,转换为最接近的两个整数中绝对值较大的一个. *取整函数: floor(x)向下取整 cei ...

  8. python模块(4)

    re正则 re.match 从头开始匹配 re.search 匹配包含 re.findall 把所有匹配到的字符放到以列表中的元素返回(没有group()方法) re.splitall 以匹配到的字符 ...

  9. 主动触发事件 自定义事件 trigger 及其用法

    1. 触发自定义事件方式 js.jq 2. jq 触发 2.1 默认支持的事件 $('#h').on('click',function(){ $(this).append('<p>p< ...

  10. Ubuntu16.04 上安装MySQL5.7

    Ubuntu版本:16.04.4 1.先更新最新的源 sudo apt-get update 2.查看是否已经安装过mysql sudo netstat -tap | grep mysq 如果没有安装 ...