千家信息网

怎样将SAP CRM WebClient UI的表格导出成PDF

发表于:2026-11-03 作者:千家信息网编辑
千家信息网最后更新 2026年11月03日,这期内容当中小编将会给大家带来有关怎样将SAP CRM WebClient UI的表格导出成PDF,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。在WebClient
千家信息网最后更新 2026年11月03日怎样将SAP CRM WebClient UI的表格导出成PDF

这期内容当中小编将会给大家带来有关怎样将SAP CRM WebClient UI的表格导出成PDF,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

在WebClient for configTable控件中,有一个将整个表内容导出为excel的功能。

Only simple steps are necessary to support export with PDF format as well.
The achievement would be: a new button is added to table toolbar.

Once pressed, a new PDF with all table records are displayed.

Required steps are briefly listed below.

(1) Create a new post exit on class CL_BTSRV_ADVSRL_CNTRL, method PREPARE_TOOLBAR, in order to add a new button for PDF export in table toolbar.

Post exit source code:

CLASS lcl_zexport_button DEFINITION DEFERRED.CLASS cl_btsrv_advsrl_cntrl DEFINITION LOCAL FRIENDS lcl_zexport_button.CLASS lcl_zexport_button DEFINITION.  PUBLIC SECTION.    CLASS-DATA obj TYPE REF TO lcl_zexport_button.          "#EC NEEDED    DATA core_object TYPE REF TO cl_btsrv_advsrl_cntrl .    "#EC NEEDED INTERFACES  IPO_ZEXPORT_BUTTON.    METHODS:      constructor IMPORTING core_object                              TYPE REF TO cl_btsrv_advsrl_cntrl OPTIONAL.ENDCLASS.CLASS lcl_zexport_button IMPLEMENTATION.  METHOD constructor.    me->core_object = core_object.  ENDMETHOD.  METHOD ipo_zexport_button~prepare_toolbar.*"------------------------------------------------------------------------**" Declaration of POST-method, do not insert any comments here please!*"*"methods PREPARE_TOOLBAR .*"------------------------------------------------------------------------*    DATA: ls_button               TYPE crmt_thtmlb_button.    ls_button-type     = cl_thtmlb_util=>gc_icon_accept.    ls_button-on_click = 'EXPORT'.    ls_button-text = 'Export to PDF'.    ls_button-enabled  = abap_true.    APPEND ls_button TO ME->CORE_OBJECT->gt_button.  ENDMETHOD.ENDCLASS.

(2) add a new event EXPORT and implement the handler in the result view:

Source code of export implementation:

method EH_ONEXPORT.    cl_crm_order_2_pdf=>open_pdf( io_col_wrapper = me->typed_context->btqrsrvord->collection_wrapper                                  io_window_manager = me->comp_controller->window_manager ).  endmethod.Source code of method open_pdf:  METHOD open_pdf.    DATA: lv_query TYPE string.    CHECK io_col_wrapper->size( ) > 0.    DATA(iterator) = io_col_wrapper->get_iterator( ).    DATA(bol) = iterator->get_current( ).    WHILE bol IS NOT INITIAL.      lv_query = lv_query && ',' && bol->get_property_as_string( 'GUID' ).      bol = iterator->get_next( ).    ENDWHILE.    lv_query = 'uuid=' && lv_query.    DATA(lv_url) = cl_crm_web_utility=>create_url( iv_path = '/sap/crm/order_print'                                             iv_query = lv_query                                             iv_in_same_session = 'X' ).    DATA(lv_title) = 'Service Order PDF List'.    DATA(lr_popup) =  io_window_manager->create_popup(  iv_interface_view_name = 'GSURLPOPUP/MainWindow'                                                                    iv_usage_name          = 'CUGURLPopup'                                                                    iv_title               = CONV #( lv_title ) ).    DATA(lr_cn) = lr_popup->get_context_node( 'PARAMS' ).    DATA(lr_obj) = lr_cn->collection_wrapper->get_current( ).    DATA(ls_params) = VALUE crmt_gsurlpopup_params( url = lv_url height = '1000' ).    lr_obj->set_properties( ls_params ).    lr_popup->set_display_mode( if_bsp_wd_popup=>c_display_mode_plain ).    lr_popup->set_window_width( 1000 ).    lr_popup->set_window_height( 1000 ).    lr_popup->open( ).  ENDMETHOD.

(3) Since in step 2 the reuse component GSURLPOPUP is utilized to hold rendered PDF as popup, so we need to declare it as component usage in the component of search result view:

(4) In step 2, the ICF service /sap/crm/order_print is declared but not implemented, so we have to create it in this step via tcode SICF.

Still use CL_CRM_ORDER_2_PDF as handler class,

and the main logic for PDF generation is done in method HANDLE_REQUEST of this handler class:

method IF_HTTP_EXTENSION~HANDLE_REQUEST.    CONSTANTS c_linelen TYPE i VALUE 255.    DATA: wa_data(c_linelen) TYPE x,          lt_data            LIKE TABLE OF wa_data.    DATA: lv_pdf_length  TYPE i,          lv_pdf_xstring TYPE xstring,          ls_guid_str    TYPE string.    DATA(lv_uuid) = server->request->get_form_field( 'uuid' ).    CALL METHOD me->get_output_data      EXPORTING        iv_uuid   = lv_uuid      IMPORTING        fpcontent = lv_pdf_xstring.    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'      EXPORTING        buffer        = lv_pdf_xstring      IMPORTING        output_length = lv_pdf_length      TABLES        binary_tab    = lt_data.    DATA(lv_contenttype) = 'application/pdf'.    ls_guid_str = lv_uuid.    CONCATENATE ls_guid_str '.pdf' INTO DATA(lv_filename).    server->response->append_data(                        data   = lv_pdf_xstring                        length = lv_pdf_length ).    CONCATENATE 'inline; filename=' lv_filename      INTO DATA(lv_contentdisposition).    CALL METHOD server->response->set_header_field      EXPORTING        name  = 'content-disposition'        value = lv_contentdisposition.    CALL METHOD server->response->set_header_field      EXPORTING        name  = 'content-type'        value = CONV #( lv_contenttype ).    CALL METHOD server->response->set_header_field      EXPORTING        name  = 'content-filename'        value = lv_filename.    server->response->delete_header_field(             name = 'Cache-Control' ).    server->response->delete_header_field(             name = 'Expires' ).  endmethod.

(5) Develop an Adobe Form to display the table content.
The table in the Adobe Form must behave as so called "data-driven" way, which means the table content in the PDF must grow according to the actual data passed into the PDF rendering processor.
First create an ABAP interface for Adobe form via tcode SFP:

The signature for this interface:

Once done, create a new Form template PF_CRM_ORDER_LIST via tcode SFP as well:

Key steps which makes the table in the form template be able to automatically grow according to the feed data source:
(1) The body page must be flowed instead of positioned:

(2) The table content row must be bound to a context node which has 0:n occurrence, and the "Repeat Row for Each Data Item" checkbox must be enabled.

As in step 4, I use a SELECT * from CRMD_ORDERADM_H as the data source for this template, which means you can bind any field in ABAP structure CRMD_ORDERADM_H to the table cell in PDF, as illustrated below.

Activate both form interface and form template and the corresponding PDF would be generated now once export button is pressed.

上述就是小编为大家分享的怎样将SAP CRM WebClient UI的表格导出成PDF了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注行业资讯频道。

内容 表格 分析 专业 中小 内容丰富 功能 就是 控件 文章 更多 知识 篇文章 行业 角度 资讯 资讯频道 频道 有关 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 深圳九邦互联网科技有限公司 河南真二互联网科技有限公司 互联网科技的 北京互联网科技公司 互联网金融公司科技 紫鲸互联网科技 百单互联网科技有限公司 智慧科技互联网 广州善班互联网科技 卓越科技互联网 招聘 互联网科技股午盘股票涨跌 中盈科技互联网信息有限公司 深圳前海聚择互联网科技有限公司 湖南诚度互联网科技有限公司 全球顶尖互联网科技公司 玉溪互联网科技怎么选 苏州铭阳互联网科技有限公司 世界互联网领先科技成果获奖 伍佰万互联网科技怎么赚钱 北京品多多互联网科技有限公司 互联网科技 江苏根荣互联网科技 互联网科技社 科技互联网公司logo 苏州大垚互联网科技 广州紫鲸互联网科技 银川新华互联网科技职业技术培训学校图片 青岛科技大学互联网大赛研究生 中国互联网十大科技股排名 每日互联网科技新闻
0