Web Dynpro for ABAP(3):Integration

3.4Integration

WDA提供一下额外接口。

Adobe Flash Islands Integration

Adobe Flash Islands基于Adobe Flex,提供标准环境创建Rich Internet Applications (RIA)工具。

UI Element: FlashIsland可以嵌入Adobe Flex开发的应用。

环境准备:

Adobe Flex Builder 2 or 3;

Adobe Flash Player;

Adobe Flex Library provided by SAP NetWeaver,可以SE80在MIME Repository中查看,路径:SAP/PUBLIC/BC/UR/nw7/FlashIslands;

Adobe Flex Builder3提供开发的SWF文件;

示例:

Adobe Flash Islands for Web Dynpro ABAP Tutorial #1 (sap.com)

 

Microsoft Silverlight Islands Integration

Microsoft Silverlight Islands基于Microsoft Silverlight,也是一种创建创建Rich Internet Applications (RIA)工具。

UI Element:SilverlightIsland可以嵌入Microsoft silverlight创建的应用。

环境准备:

Microsoft Visual Studio and the Silverlight Add-on;

Silverlight browser plug-in (for using Microsoft Silverlight Islands on the client);

The Microsoft Silverlight library provided by SAP NetWeaver,SE80中MIME Repository:SAP/PUBLIC/BC/UR/nw7/SilverlightIslands;

Microsoft Silverlight application提供开发的XAP文件;

示例:

WDA Component:DEMO_SILVERLIGHT_SEATS

其中MIME中DEMO_SILVERLIGHT_SEATS.ZIP是Microsoft Silverlight项目文件。

注意: 2021.10 silverlight5 end of support。

 

Portal Integration

WDA Application可以嵌入到SAP Enterprise portal。

通过接口:IF_WD_PORTAL_INTEGRATION,访问Portal管理方法,包括Portal Events、Navigation、WorkProtect Mode等;

示例:

Package:SWDP_TEST

1Component:WDR_TEST_PORTAL_EVENT

Trigger event

方法fire参数说明:

PORTAL_EVENT_NAMESPACE: Namespace where the event is stored;

PORTAL_EVENT_NAME: Name of the event;

PORTAL_EVENT_PARAMETER: Parameter;

PORTAL_EVENT_SCOPE: Scope;

PORTAL_EVENT_SCOPE参数值说明:

IF_WD_PORTAL_INTEGRATION=>CO_EVENT_SCOPE-CURRENT_WINDOW:

Event is only forwarded within the current browser window;

IF_WD_PORTAL_INTEGRATION=>CO_EVENT_SCOPE-CHILD_TO_PARENTS:

Event is forwarded to all superordinate browser windows but not within the current browser window;

IF_WD_PORTAL_INTEGRATION=>CO_EVENT_SCOPE-CURRENT_WINDOW_ AND _PARENTS:    Event is forwarded to all superordinate browser windows and within the current browser window;

PORTAL_EVENT_NAMESPACE命名规则:

只能有字母,数字,下划线,".","-"组成;

由“urn:”开头;

SAP保留字com.sapportals.portal.* and com.sapportals.*;

 

示例代码1:Trigger event

  data node                    type ref to if_wd_context_node.
  data portal_event_namespace  type string value 'urn:com.sap.bc.webdynpro.sap.wdrTestPortalEventFire'.
  data portal_event_name       type string value 'fireHello'.

  node = wd_context->get_child_node( name = `DATA` ).
  node->get_attribute( exporting name  =  `USERNAME`
                       importing value = portal_event_parameter ).

  data l_componentcontroller type ref to ig_componentcontroller .
  data l_api_componentcontroller type ref to if_wd_component.
  data l_portal_manager type ref to if_wd_portal_integration.

  l_componentcontroller =   wd_this->get_componentcontroller_ctr( ).
  l_api_componentcontroller = l_componentcontroller->wd_get_api( ).
  l_portal_manager = l_api_componentcontroller->get_portal_manager( ).

  l_portal_manager->fire(
    exporting
      portal_event_namespace = portal_event_namespace
      portal_event_name      = portal_event_name
      portal_event_parameter = portal_event_parameter ).
 

示例代码2:注册事件,Subscribe_event方法

  data node             type ref to if_wd_context_node.
  data subscribe_hello  type wdy_boolean.

  data  view                      type ref to if_wd_view_controller.
  data  portal_event_namespace    type string value 'urn:com.sap.bc.webdynpro.sap.wdrTestPortalEventFire'.
  data  portal_event_name         type string value 'fireHello'.

* here is the name of the action where the portal event will be received!
* you have to create this action in the application!!
  data  portal_event_action_name  type string value 'RECEIVE_PORTAL_EVENT'.

  data lr_componentcontroller type ref to ig_componentcontroller .
  data l_api_componentcontroller type ref to if_wd_component.
  data lr_port_manager type ref to if_wd_portal_integration.

  node = wd_context->get_child_node( name = 'DATA' ).
  node->get_attribute( exporting name =  `SUBSCRIBE_HELLO`
                       importing value = subscribe_hello ).

  lr_componentcontroller =   wd_this->get_componentcontroller_ctr( ).
  l_api_componentcontroller = lr_componentcontroller->wd_get_api( ).
  lr_port_manager = l_api_componentcontroller->get_portal_manager( ).

  view ?= wd_this->wd_get_api( ).

  if subscribe_hello = abap_true.
    call method lr_port_manager->subscribe_event
      exporting
        portal_event_namespace = portal_event_namespace
        portal_event_name      = portal_event_name
        view                   = view
        action                 = portal_event_action_name.
  else.
    call method lr_port_manager->unsubscribe_event
      exporting
        portal_event_namespace = portal_event_namespace
        portal_event_name      = portal_event_name
        view                   = view.
  endif.

 

示例代码3:取消订阅事件

  data view     type ref to if_wd_view_controller.
  data l_componentcontroller type ref to ig_componentcontroller .
  data l_api_componentcontroller type ref to if_wd_component.
  data l_portal_manager type ref to if_wd_portal_integration.

  l_componentcontroller =   wd_this->get_componentcontroller_ctr( ).
  l_api_componentcontroller = l_componentcontroller->wd_get_api( ).
  l_portal_manager = l_api_componentcontroller->get_portal_manager( ).
  view ?= wd_this->wd_get_api( ).
  call method l_portal_manager->unsubscribe_event
      exporting
        portal_event_namespace = portal_event_namespace
        portal_event_name      = portal_event_name
        view                   = view.
 

示例代码4:handler portal event,Action:RECEIVE_PORTAL_EVENT

  data node                   type ref to if_wd_context_node.
  data portal_event_namespace type string.
  data portal_event_name      type string.
  data portal_event_parameter type string.

  portal_event_namespace = wdevent->get_string( 'PORTAL_EVENT_NAMESPACE' ).
  portal_event_name      = wdevent->get_string( 'PORTAL_EVENT_NAME' ).
  portal_event_parameter = wdevent->get_string( 'PORTAL_EVENT_PARAMETER' ).

  check portal_event_namespace = 'urn:com.sap.bc.webdynpro.sap.wdrTestPortalEventFire'.

  node = wd_context->get_child_node( name = 'DATA' ).
  node->set_attribute( exporting name = 'PORTAL_EVENT_NAME' value = portal_event_name ).
  node->set_attribute( exporting name = 'PORTAL_EVENT_PARAMETER' value = portal_event_parameter ).

 

2Component:WDR_TEST_PORTAL_OBN_WS、WDR_TEST_PORTAL_OBN_WS2

Object-based navigation

方法:navigate_to_object

必须参数:

SYSTEM: Specify the system (or the system alias) the business object is assigned to;

OBJECT_TYPE: Specify the business object you are using;

 

3Component:WDR_TEST_PORTAL_NAV

Page navigation

方法:navigate_absolute

必须参数:

NAVIGATION_TARGET:Absolute address, path for page or iView in the portal content directory;

可选参数:

NAVIGATION_MODE:

"INPLACE": Displays the navigation target on the same page;

"EXTERNAL":Displays the navigation target on a new page, but only as an iView, without the portal;

"EXTERNAL_PORTAL ":Displays the navigation target on a new portal page;

"WINDOW_FEATURES":Window参数

″TOOLBAR″,Displays the standard toolbar;

″LOCATION″,Displays the Web address;

″DIRECTORIES″,Displays the directory buttons of the browser;

″STATUS″,Displays the status bar;

″MENUBAR″,Displays the menu bar of the browser;

″SCROLLBARS″,Displays the scroll bar;

″RESIZABLE″,Windows can be resized;

″WIDTH″,Width of the window;

″HEIGHT″,Height of the window;

"TARGET_TITLE":Title;

" CONTEXT_URL":上下文URL;

" POST_PARAMETERS":是否POST;

 

方法:navigate_relative

必须参数:

LEVELS_UP: Number of navigation steps upwards in the navigation structure

PATH:Relative path list for the target application

可选参数:

BASE_URL:Starting point for relative navigation

 

4Component:WDR_TEST_PORTAL_PROTECT

Security monitoring

方法:set_application_dirty_flag,设置为true,页面跳转后,再回到原页面还能够保存数据。

示例代码1:

call method wd_comp_controller->m_portal_manager->set_application_dirty_flag
    exporting
      dirty_flag = abap_true. 

方法:SET_WORK_PROTECT_MODE

参数值说明:

"NONE": protect mode关闭,设置dirty flag失效;

" APPLICATION_ONLY":application itself decides if there is still unsaved data;

" BOTH": This ensures that no user input that has not yet been transferred to the server will be lost;

 

3.5Integrating Forms

SAP Interactive Forms by Adobe使用场景:

Input-enabled forms;

printing and displaying forms;

the application is responsible for extracting the form data from the form;

环境准备:

SAP NetWeaver Application Server system with Adobe Document Services (ADS);

SAP GUI Release 6.40 Support Package Level 20 or higher;

Adobe LiveCycle Designer;

Adobe Reader on the Client (Browser);

创建Intergrating Form步骤:

1.使用UI Element:InteractiveForm;

2.设置Property:templateSource,唯一命名;

3. Form Builder打开,创建Form;

4.Layout Type选择ZCI Layout;

5. On the Layout tab in the Form Builder, you can insert the ZCI-Skript script by choosing Utilities-> Insert Web Dynpro Script;

6. If it is a print form, deactivate the enabled property of the InteractiveForm UI element; If it is an interactive form, activate the enabled property of the InteractiveForm UI element;

Tcode: SFP,Form Builder;

示例:

DEMO_IFBA_HIGHLIGHT_ERROR

DEMO_IFBA_JOB_PROFILES

DEMO_IFBA_DYNAMIC_TABLE

DEMO_IFBA_EMAIL

WDR_TEST_ADOBE

示例代码1:获取mime资源

data:lr_mime_repository type ref to if_mr_api,
content            type xstring.

constants:url type string value '/SAP/BC/WebDynpro/SAP/WDR_TEST_ADOBE/display_pdf.pdf'.
lr_mime_repository = cl_mime_repository_api=>get_api( ).
lr_mime_repository->get( exporting i_url = url importing e_content = content ).
 

示例代码2:下载PDF

data:lr_pdf_node type ref to if_wd_context_node,
   pdf         type xstring.
lr_pdf_node = wd_context->get_child_node( wd_this->wdctx_pdf ).
lr_pdf_node->get_attribute( exporting name = 'PDF' importing value = pdf ).
cl_wd_runtime_services=>attach_file_to_response(
    i_filename      = 'DemoAdobeOffline.pdf'
    i_content       = pdf
    i_mime_type     = 'application/pdf'
    i_in_new_window = ABAP_FALSE
    i_inplace       = ABAP_false ). 

InteractiveForm使用限制:

1. Web Dynpro ABAP popups is not supported.

2.It is not possible to display two or more InteractiveForm UI elements at the same time in a browser window.

3.Web Dynpro ABAP does not support interfaces that are compatible with Smart Forms.

4.If you used an existing form for the form integration, whose interface is not based on an XML schema, you cannot then add any further data fields.

5.If you integrate an existing form with an XML schema-based interface into your Web Dynpro application, ensure that all names of elements in the schema consist of capital letters.

If names of elements in the schema consist of lowercase letters, note that:

You cannot navigate to invalid entries on the form from the MessageArea element.

The application cannot place the focus on a field in the form.

The data type DECFLOAT is not presently supported by the integration of forms in Web Dynpro ABAP.

注意:

推荐使用ZCI forms with XML interfaces;

ACF-based PDF forms已弃用;

ABAP Dictionary-based interfaces can only be used as print forms;

Notes:

Error analysis for Web Dynpro ABAP Adobe integration

http://help.sap.com/disclaimer?site=https://launchpad.support.sap.com/#/notes/999998

New creation of Web Dynpro ZCI forms in Form Builder

http://help.sap.com/disclaimer?site=https://launchpad.support.sap.com/#/notes/955795

Use of update function in forms

http://help.sap.com/disclaimer?site=https://launchpad.support.sap.com/#/notes/956074

 

3.6File Export

通过CL_WD_RUNTIME_SERVICES类的ATTACH_FILE_TO_RESPONSE方法下载文件。

示例:

WDR_TEST_EVENTS

示例代码1:

data:conv_out type ref to cl_abap_conv_out_ce,
    content  type xstring.
conv_out = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' ).
* attach the first file
conv_out->convert( exporting data = 'Der Inhalt einer Textdatei' importing buffer = content ).
cl_wd_runtime_services=>attach_file_to_response(
    i_filename  = 'file1.txt'
    i_content   = content
    i_mime_type = 'text/plain' ).

 

3.7Active Component Framework (ACF)

WDA提供ACF-based UI elements接口:

Gantt

OfficeContro

InteractiveForm

AcfExecute

AcfUpDownload

FlashIsland

SilverlightIsland

ActiveX

示例:

WDR_TEST_LIFECYCLE_AC

测试ACF elements LifeTime。

Tcode: WDR_ACF_WLIST

Working with White Lists,设置白名单。

posted @ 2022-04-23 09:56  渔歌晚唱  阅读(165)  评论(0编辑  收藏  举报