在ABAP Webdynpro裡顯示PDF的一種辦法
There is a good blog about how to get PDF preview in CRM web client UI. However several development are invovled in that solution. You have to implement your own ICF node to make PDF displayed in UI, and you have to generate the binary code of PDF by yourself.
There is just another approach to achieve the same result but with much less coding by leveraging the standard control “Adobe Interactive form” in ABAP webdynpro. In this way no ICF node implementation, no manual PDF binary code generation, just a few model task.
(1) Create an form interface in tcode SFP.
Choose interface type as ABAP Dictionary-Based Interface.
Just create two parameter NAME and SCORE. Activate the interface.
(2) Create a new form template via tcode SFP.
Click “Context”tab, drag the two parameters from Interface to the right part Context ZPF_EXAMPLE and drop there.
Click tab Layout, design your form layout. Here I create a caption and two text fields. Bind the data source of the two fields to your form context parameter. Here text field NAME is bound to ZPF_EXAMPLE.NAME and Score field bound to ZPF_EXAMPLE.SCORE.
(3) Create a new ABAP webdynpro in SE80. A view MAIN will be created by workbench automatically. Just put a new Adobe Interactive form control into the empty view. You can choose “Insert Element” from context menu and choose “Interactive form”
Specify the form template name ZPF_EXAMPLE to property “templateSource” created in step2.
After that the property “dataSource” is also determined automatically.
Click tab “Context”, now you should see the two parameters defined in form interface is also displayed in context node of view MAIN.
(4) Create a new Webdynpro application and assign two parameter NAME and SCORE to it.
(5) Double click WDDOINIT to implement:
The init method will retrieve name and score from application parameter included in url. The url will be populated from CRM webclient UI side. Till now the development of ABAP webdynpro is finished. You don’t care about the PDF generation and display, it will be handled by ABAP webdynpro framework.
method WDDOINIT .
data(lo_node) = wd_context->get_child_node( 'ZPF_EXAMPLE' ).
DATA: lv_name type string,
lv_score type int4.
lv_name = cl_wd_runtime_services=>get_url_parameter( name = 'NAME' ).
lv_score = cl_wd_runtime_services=>get_url_parameter( name = 'SCORE' ).
lo_node->set_attribute( name = 'NAME' value = lv_name ).
lo_node->set_attribute( name = 'SCORE' value = lv_score ).endmethod.
(6) The left task would be quite easy for a CRM UI developer: I create a simple view with two input fields for Name and Score, and one hyperlink.
The event handler for hyperlink click:
DATA: lr_popup TYPE REF TO if_bsp_wd_popup,
lr_cn TYPE REF TO cl_bsp_wd_context_node,
lr_obj TYPE REF TO if_bol_bo_property_access,
lt_parameters TYPE tihttpnvp,
ls_params TYPE crmt_gsurlpopup_params.
data(lo_data) = me->typed_context->data->collection_wrapper->get_current( ).
DATA(ls_line) = VALUE ihttpnvp( name = 'NAME' value = lo_data->get_property_as_string( 'NAME' ) ).
APPEND ls_line TO lt_parameters.
ls_line = VALUE ihttpnvp( name = 'SCORE' value = lo_data->get_property_as_string( 'VALUE' ) ).
APPEND ls_line TO lt_parameters.
cl_wd_utilities=>construct_wd_url(
EXPORTING
application_name = 'ZADOBEFORM'
in_parameters = lt_parameters
IMPORTING
out_absolute_url = mv_url ).
lr_popup = me->comp_controller->window_manager->create_popup( iv_interface_view_name = 'GSURLPOPUP/MainWindow'
iv_usage_name = 'GSURLPOPUP'
iv_title = 'Adobe Interactive Form Control' ).
lr_cn = lr_popup->get_context_node( 'PARAMS' ). "#EC NOTEXT lr_obj = lr_cn->collection_wrapper->get_current( ).
ls_params-url = mv_url.
ls_params-height = '700'. "#EC NOTEXT lr_obj->set_properties( ls_params ).
lr_popup->set_display_mode( if_bsp_wd_popup=>c_display_mode_plain ).
lr_popup->set_window_width( 700 ).
lr_popup->set_window_height( 700 ).
lr_popup->open( ).
Of course you need to add component GSURLPOPUP via component usage. In the runtime after name and score fields are maintained in CRM UI and hyperlink is clicked, the corresponding PDF will be generated and displayed by ABAP Webdynpro framework.
要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2712087/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 如何把 SAP ABAP 系統裡一張資料庫表的內容,顯示在 Adobe PDF Form 裡資料庫ORM
- 在SAP CRM WebClient UI裡開啟ABAP Webdynpro頁面WebclientUI
- ABAP的語法高亮是如何在瀏覽器裡顯示的瀏覽器
- html裡顯示中文亂碼的解決辦法HTML
- 在linux字型下的顯示問題及幾種解決辦法Linux
- 使用 SAP ABAP 程式碼生成 PDF 檔案,填充以業務資料並顯示在 SAPGUI 裡試讀版GUI
- 如何在 SAPGUI 裡顯示上傳到 ABAP 伺服器的 PDF 檔案試讀版GUI伺服器
- Vue控制子元件的顯示隱藏的四種辦法Vue元件
- IE瀏覽器不能自動顯示PDF檔案的解決辦法瀏覽器
- ABAP Webdynpro效能測試工具Web
- 把經典的ABAP webdynpro應用配置到SAP Fiori Launchpad裡Web
- Html 顯示pdfHTML
- Blazor 部署 pdf.js 不能正確顯示中文資源解決辦法BlazorJS
- 在 ABAP 開發工具執行時錯誤顯示介面裡植入思否貓
- 如何修改SAP ABAP webdynpro的背景色Web
- phpmyadmin在PHP7中顯示空白的解決辦法!PHP
- 在ABAP裡實現條件斷點的三種方式斷點
- 顯示-bash-3.2$ .的解決辦法
- 在ABAP裡取得一個資料庫表記錄數的兩種方法資料庫
- 電腦顯示器黑屏 顯示器不亮的解決辦法
- vmware不顯示usb圖示解決辦法
- 強制頁面顯示在框架裡框架
- 使用 pdf.js 檢視發票時,顯示不了臺頭和印章的解決辦法JS
- iOS 大圖顯示解決辦法iOS
- 讓emacs完美顯示BMP檔案的辦法Mac
- SAP SRM ABAP Webdynpro和CFCA usb key整合的一個原型開發Web原型
- pdf在前端網頁的顯示前端網頁
- win10工作列圖示不顯示怎麼辦 修復工作列顯示不正常的辦法Win10
- ABAP webdynpro的view navigation和WebUI的view navigationWebViewNavigationUI
- SourceTreet提交時顯示remote: Incorrect username or password ( access token )(4種解決辦法)REM
- DELL電腦不顯示硬碟的解決辦法硬碟
- Picasa相簿圖片不顯示的解決辦法
- 解決WordPress無法顯示已安裝主題的辦法
- ABAP Webdynpro和WebClient UI不同的會話管理機制WebclientUI會話
- 根據ABAP BAdI definition名稱找到SPRO裡配置路徑的辦法
- 行動硬碟不顯示怎麼辦? 行動硬碟不顯示磁碟機代號的解決辦法硬碟
- ABAP 740裡的新語法 - LET表示式
- 網頁圖片不能顯示 網頁圖片顯示不出來的解決辦法網頁