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

说一下思路:画的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. Mapreduce 历史服务 配置启动查看

    如果没有进行配置的话,那个History是不可以进行点击的,点击进去就会报错!所以需要进行配置一下 使用命令启动HistoryServer 就可以查看任务执行的进度了 命令: sbin/mr-jobh ...

  2. Docker6之Network containers

    how to network your containers. Launch a container on the default network Docker includes support fo ...

  3. mybatis结合mysql批量操作及查询sql

    MySQL数据库 批量操作主要使用的是Mybatis的foreach,遍历参数列表执行相应的操作,所以批量插入/更新/删除的写法是类似的,只是SQL略有区别而已.MySql批量操作需要数据库连接配置a ...

  4. demoshow - webdemo展示助手

    demoshow - web demo展示助手 动态图演示页面: http://www.cnblogs.com/daysme/p/6790829.html 一个用来展示前端网页demo的小“助手”,提 ...

  5. Python数据类型补充2

    四.列表 常用操作+内置的方法: 1.按索引存取值(正向存取+反向存取):即可存也可以取 # li=['a','b','c','d'] # print(li[-1]) # li[-1]='D' # p ...

  6. 8、nginx和tengine简介

    练习: 使用nginx反向代理(rr调度)用户请求至两个以上的后端LAMP(按标准路径部署的有pma,wd),不管用户请求是什么内容都反向代理至后端服务器去,但是如果用户请求的是图片或者是html,就 ...

  7. header 格式

    headers = { 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,* ...

  8. c语言关键字的区分

    const int a;//声明一个常整型数 int const a;//声明一个常整型数 const int *a;//声明指向常整型数的指针,整型数不可修改,指针可以修改 int * const ...

  9. Algorithm 算法基础知识(未完成

    基础概念不讲,记录课上关键部分 时间复杂度(Time Complexity) 算法所需要花的时间 比较时间复杂度(主要看问题的规模) 时间频度(算法执行次数)T(n)和T(n1),如果两个时间频度为等 ...

  10. Golang获得执行文件的当前路径

    运行环境:golang1.9.2+win7x64golang1.9.2+centos6.5×64 /*获取当前文件执行的路径*/ func GetCurPath() string { file, _ ...