How to... Develop Remote POWL SAP NetWeaver

SAPNetWeaver
NetWeaver
SAP
How-To Guide
How-To
Guide
How to...
Develop Remote POWL
Applicable Releases:
SAP NetWeaver 7.01
© Copyright 2017 SAP AG. All rights reserved.
No part of this publication may be reproduced or
transmitted in any form or for any purpose without the
express permission of SAP AG. The information contained
herein may be changed without prior notice.
Some software products marketed by SAP AG and its
distributors contain proprietary software components of
other software vendors.
Microsoft, Windows, Outlook, and PowerPoint are
registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, OS/2, Parallel
Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390,
OS/400, iSeries, pSeries, xSeries, zSeries, z/OS, AFP,
Intelligent Miner, WebSphere, Netfinity, Tivoli, Informix,
i5/OS, POWER, POWER5, OpenPower and PowerPC are
trademarks or registered trademarks of IBM Corporation.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader
are either trademarks or registered trademarks of Adobe
Systems Incorporated in the United States and/or other
countries.
Oracle is a registered trademark of Oracle Corporation.
UNIX, X/Open, OSF/1, and Motif are registered
trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame,
WinFrame, VideoFrame, and MultiWin are trademarks or
registered trademarks of Citrix Systems, Inc.
HTML, XML, XHTML and W3C are trademarks or
registered trademarks of W3C®, World Wide Web
Consortium, Massachusetts Institute of Technology.
Java is a registered trademark of Sun Microsystems, Inc.
JavaScript is a registered trademark of Sun Microsystems,
Inc., used under license for technology invented and
implemented by Netscape.
MaxDB is a trademark of MySQL AB, Sweden.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP
NetWeaver, and other SAP products and services
mentioned herein as well as their respective logos are
trademarks or registered trademarks of SAP AG in
Germany and in several other countries all over the world.
All other product and service names mentioned are the
trademarks of their respective companies. Data contained
in this document serves informational purposes only.
National product specifications may vary.
These materials are subject to change without notice.
These materials are provided by SAP AG and its affiliated
companies ("SAP Group") for informational purposes only,
without representation or warranty of any kind, and SAP
Group shall not be liable for errors or omissions with
respect to the materials. The only warranties for SAP
Group products and services are those that are set forth in
the express warranty statements accompanying such
products and services, if any. Nothing herein should be
construed as constituting an additional warranty.
These materials are provided “as is” without a warranty of
any kind, either express or implied, including but not
limited to, the implied warranties of merchantability,
fitness for a particular purpose, or non-infringement.
SAP shall not be liable for damages of any kind including
without limitation direct, special, indirect, or consequential
damages that may result from the use of these materials.
SAP does not warrant the accuracy or completeness of the
information, text, graphics, links or other items contained
within these materials. SAP has no control over the
information that you may access through the use of hot
links contained in these materials and does not endorse
your use of third party web pages nor provide any warranty
whatsoever relating to third party web pages.
SAP NetWeaver “How-to” Guides are intended to simplify
the product implementation. While specific product
features and procedures typically are explained in a
practical business context, it is not implied that those
features and procedures are the only approach in solving a
specific business problem using SAP NetWeaver. Should
you wish to receive additional information, clarification or
support, please refer to SAP Consulting.
Any software coding and/or code lines / strings (“Code”)
included in this documentation are only examples and are
not intended to be used in a productive system
environment. The Code is only intended better explain and
visualize the syntax and phrasing rules of certain coding.
SAP does not warrant the correctness and completeness of
the Code given herein, and SAP shall not be liable for
errors or damages caused by the usage of the Code, except
if such damages were caused by SAP intentionally or
grossly negligent.
Disclaimer
Some components of this product are based on Java™. Any
code change in these components may cause unpredictable
and severe malfunctions and is therefore expressively
prohibited, as is any decompilation of these components.
Any Java™ Source Code delivered with this product is only
to be used by SAP’s Support Services and may not be
modified or altered in any way.
Document History
Document Version
Description
1.00
First official release of this guide
Typographic Conventions
Icons
Type Style
Description
Icon
Example Text
Words or characters quoted
from the screen. These
include field names, screen
titles, pushbuttons labels,
menu names, menu paths,
and menu options.
Cross-references to other
documentation
Example text
Emphasized words or
phrases in body text, graphic
titles, and table titles
Example text
File and directory names and
their paths, messages,
names of variables and
parameters, source text, and
names of installation,
upgrade and database tools.
Example text
User entry texts. These are
words or characters that you
enter in the system exactly as
they appear in the
documentation.
<Example
text>
Variable user entry. Angle
brackets indicate that you
replace these words and
characters with appropriate
entries to make entries in the
system.
EXAMPLE TEXT
Keys on the keyboard, for
example, F2 or ENTER.
Description
Caution
Note or Important
Example
Recommendation or Tip
How to ... Develop Remote POWL
Table of Contents
1.
Purpose ................................................................................................................... 3
2.
Business Scenario ................................................................................................. 3
3.
Background Information ....................................................................................... 3
4.
Prerequisites........................................................................................................... 3
5.
Scope ....................................................................................................................... 4
6.
Step-by-Step Procedure ........................................................................................ 4
[Type text]
How to ... Develop Remote POWL
1. Purpose
The current architecture of the POWL has the following constraints:

The feeder classes (actual dataproviders) can only be consumed by the generic webdynpro
application (POWL).

It’ is not possible to use the feeder classes from the remote systems that make it local to the
application server.
Due to the requirements from the suite harmonization projects, the POWL framework must be
enhanced with remote usage. In order to achieve this, the POWL provides a RFC library which
simulates the current user interface. This document describes the RFC Library for the POWL
framework in detail.
This enhancement yields the following benefits:






Minimized UI Adoption investments
Investments from the application side (feeder class development) .can be leveraged. This allows
you to keep up to date with SAP UI Strategy and enables multi-channel access to the work items
Enhanced user productivity
Pre Processing of work items across the system landscape.
Support for offline scenarios.
This enables you to proceed with your tasks even ifyou are not connected to the system
2. Business Scenario
NA
3. Background Information
NA
4. Prerequisites
4.1 Technical



The RFC destinations are maintained using the logon details of the technical user. The current
user’s credentials are used for the remote logon.
The current username of the host system is sent to the RFC interfaces. The feeder methods
take care of the authorization routines for the imported username. The feeders methods then
raise an exception if the user is not available in the target system.
Before making a call to the RFC library, the host system feeder sets the additional parameters
(e.g. simulating BP-Version) by calling the appropriate POWL utility methods. The target system
consumes this information and acts accordingly.
4.2 Functional


You have Implemented the POWL.
You have Integrated the Web-Dynpro object with POWL.
[Type text]
How to ... Develop Remote POWL
5. Scope
NA
6. Step-by-Step Procedure
This section provides an outline for implementing the remote POWL, using the Demo Implementation
example located in the package POWL_REMOTE.
a) GET_ACTIONS function Implementation
Purpose : Define buttons and their actions (Methods “GET_ACTIONS” & “HANDLE_ACTION”) By
maintaining the two methods GET_ACTIONS and HANDLE_ACTION, you have a huge variety of
options to improve the POWER Lists significantly. First you need to define the buttons with name,
index and more (GET ACTIONS). Second you need to define the actions which should be initiated if
the user presses such a button. The action can simply be launching a transaction and forwarding the
business object parameters to it. Or it could be used to simplify a whole process by using the buttons
to call several function modules in a sequence
To implementing GET_ACTION , you have to map between the Feeder class Importing Parameter
with Remote Function Module POWLR_ASYNC_COLLECT_ACTIONS.
First you have to feed the I_POWL_CONTEXT of POWLR_ASYNC_COLLECT_ACTIONS function
from the importing parameter of the feeder class method GET_ACTIONS.
DATA lv_context TYPE powlr_context_sty.
lv_context-applid = i_applid.
lv_context-type = i_type.
lv_context-user_name = i_username.
lv_context-language = i_langu.
Then call the 'POWLR_ASYNC_COLLECT_ACTIONS' function module to get the value from different
system
[Type text]
How to ... Develop Remote POWL
CALL FUNCTION 'POWLR_ASYNC_COLLECT_ACTIONS'
EXPORTING
i_powl_context = lv_context
i_selcrit_vals = i_selcrit_para [from importing parameter]
i_destinations = lt_destinations [different destination]
IMPORTING
e_status_flags = lt_status
e_actions
= lt_action
e_messages
= lt_message.
Importing Parameter
I_POWL_CONTEXT
Provides Remote POWL information
I_SELCRIT_VALS
Parameter Table
I_DESTINATIONS
POWL Remote Function Call Destination
Exporting Parameter
E_STATUS_FLAGS
Remote POWL Status List
E_ACTIONS
Remaote POWL action meta description
E_MESSAGES
Remote POWL Message META description
After Getting the result you have to again feed the result into the exporting & changing parameter of
the method.
IF c_action_defs IS INITIAL.
IF lt_action IS NOT INITIAL.
LOOP AT lt_action INTO ls_action.
INSERT ls_action-remote_actions
ENDLOOP.
ENDIF.
e_actions_changed = 'X'.
ENDIF.
[Type text]
INTO TABLE c_action_defs.
How to ... Develop Remote POWL
b) GET_ACTION_CONF function Implementation
Purpose : Define a confirmation dialog box (Method “GET_ACTION_CONF”) Using this method
allows you to throw a dialog box with some information like a confirmation. Think of a business object
you can delete via a button in the POWER list. A confirmation dialog box could ask whether the user
is sure to delete this object. The confirmation choice will be available in method HANDLE_ACTION
via import parameter I_ACTION_CONF.
To implement the remote POWL functionality (As its shown in the previous) you have to call
'POWLR_GET_ACTION_CONF for the Action confirmation.
DATA lv_act_contex TYPE powlr_act_context_sty.
lv_act_contex-act_index = i_action_index.
lv_act_contex-actionid = i_actionid.
CALL FUNCTION 'POWLR_GET_ACTION_CONF'
EXPORTING
i_powlr_context = lv_context
i_act_context
= lv_act_contex
i_selected
= i_selected
i_objects
= lv_object_str
i_changed
= lv_changeinfo_str
IMPORTING
e_confirmation = e_conf_message
e_messages
= lt_message.
.
After calling the function , user will get the confirmation for a single action, and then it has to set in the
exporting parameter of the feeder class.
[Type text]
How to ... Develop Remote POWL
Importing Parameter
I_POWLR_CONTEXT
Provides Remote POWL information
I_ACT_CONTEXT
Information about current action to be performed
I_SELECTED
Table for Indexes
I_OBJECTS
I_CHANGED
out tab change info’s for feeder
Exporting Parameter
E_CONFIRMATION
Table of Strings
E_MESSAGES
Message META description
c) GET_SEL_CRITERIA function Implementation
Purpose : With this method you can define which selection criteria are visible and selectable by the
user.
Example You have a POWER List showing billing documents. You could offer the selection criteria
“billing date” so that the user can later retrieve the data directly the way he searches for it.
To implement the remote functionality you have to call the 'POWLR_ASYNC_COLLECT_SELCRIT with
its requite parameter.
CALL FUNCTION 'POWLR_ASYNC_COLLECT_SELCRIT'
EXPORTING
i_powl_context = lv_context
i_destinations = lt_destinations
IMPORTING
e_status_flags = lt_status
e_selcrit
= lt_selcrit
e_messages
= lt_message.
Now you will get lt_status lt_selcrit lt_message as a exporting parameter of the function. Again you
have to feed the exporting parameter of the feeder class as shown.
[Type text]
How to ... Develop Remote POWL
IF lt_selcrit IS NOT INITIAL.
LOOP AT lt_selcrit INTO ls_selcrit.
APPEND LINES OF ls_selcrit-remote_selcrit TO c_selcrit_defs.
ENDLOOP.
ENDIF.
same as you have to set the parameter e_selcrit_defs_changed and e_default_val_changed
IF lt_status IS NOT INITIAL.
LOOP AT lt_status INTO ls_status.
e_selcrit_defs_changed = ls_status-remote_status-selcrit_changed.
e_default_val_changed = ls_status-remote_status-def_values_changed.
ENDLOOP.
ENDIF.
d) GET_FIELD_CATALOG function Implementation
Purpose: This method describes the field catalog to be used for query results table and the UI
properties of the particular fields.
To implement the Remote POWL, you have too the same type of modification at your feeder class.
Demo implementation are as bellows
CALL FUNCTION 'POWLR_ASYNC_COLLECT_FIELDCAT'
EXPORTING
i_powl_context = lv_context
i_destinations = lt_destinations
i_selcrit_vals = i_selcrit_values
IMPORTING
e_status_flags = lt_status
e_fieldcat
= lt_fieldcat
e_messages
= lt_message.
[Type text]
How to ... Develop Remote POWL
Now fill the field catalog with the received set of data.
IF lt_fieldcat IS NOT INITIAL.
LOOP AT lt_fieldcat INTO ls_fiedlcat.
APPEND LINES OF ls_fiedlcat-remote_fieldcat TO c_fieldcat.
ENDLOOP.
ENDIF.
IF lt_status IS NOT INITIAL.
LOOP AT lt_status INTO ls_status.
e_default_technical_col = ls_status-remote_status-default_tech_col.
"e_fieldcat_changed = ls_statuse_visible_cols_count = ls_status-remote_status-visible_row_cnt.
e_visible_rows_count = ls_status-remote_status-visible_col_cnt.
ENDLOOP.
ENDIF.
Importing Parameter
I_POWL_CONTEXT
Provides Remote POWL information
I_DESTINATIONS
POWL Remote Function Call Destination
I_SELCRIT_VALS
Selection Criteria Table
Exporting Parameter
E_STATUS_FLAGS
Remote POWL Status List
E_FIELDCAT
Remote Field catalog META description
E_MESSAGES
Remote POWL Message META description
[Type text]
How to ... Develop Remote POWL
e) GET_OBJECT_DEFINITION function
Implementation
Purpose: Define data container (Method “GET_OBJECT_DEFINITION”)This method is used to define
the container (e.g. specify field types) where the selected data gets stored. Caching and other
mechanisms of the POWER Lists technology will be handled automatically in the background based
on these settings. So there is no need to explicitly take care on things like caching data and so on.
(defines the data type of the actual (internal) query results table as to be delivered by
GET_OBJECTS)
Same as , you have to implement the GET_OBJECT _DEF function for remote POWL
CALL FUNCTION 'POWLR_ASYNC_COLLECT_OBJECT_DEF'
EXPORTING
i_powl_context = lv_context
i_selcrit_vals = i_selcrit_values
i_destinations = lt_destinations
i_format
= lv_format
IMPORTING
e_status_flags = lt_status
e_obj_def
= lt_object_def
e_messages
= lt_message.
Importing Parameter
I_POWL_CONTEXT
Provides Remote POWL information
I_SELCRIT_VALS
rsparams Table
I_DESTINATIONS
POWL Remote Function Call Destination
I_FORMAT
Remote POWL Format Type
Exporting Parameter
E_STATUS_FLAGS
Remote POWL Status List
E_OBJ_DEF
Remote POWL Object Defination
E_MESSAGES
Remote POWL Message META description
READ TABLE lt_object_def INDEX 1 INTO ls_object_def.
IF sy-subrc EQ 0.
e_object_def ?= ls_object_def-remote_obj_def.
ELSE.
[Type text]
How to ... Develop Remote POWL
f) GET_OBJECTS function Implementation
Retrieve data from the backend system (Method “GET_OBJECTS”) Here you need to define the data
retrieval itself. This can be either a very simple database select (e.g. select * from xyz) or a complex
selection where you use existing SAP function modules or your own coding.Same as , you have to
implement the GET_OBJECT function for remote POWL. Here is some implementation code.
CALL FUNCTION 'POWLR_ASYNC_COLLECT_OBJECTS'
EXPORTING
i_powl_context = lv_context
i_destinations = lt_destinations
i_selcrit_vals = i_selcrit_values
i_format
= lv_format
importing
e_results
= lt_results
*
E_CONSOLDATED
=
e_status_flags
= lt_status
*
E_CONS_RESULT
=
e_messages
= lt_message
.
Importing Parameter
I_POWL_CONTEXT
Provides Remote POWL information
I_DESTINATIONS
POWL Remote Function Call Destination
I_SELCRIT_VALS
rsparams Table
I_FORMAT
Remote POWL Format Type
Exporting Parameter
E_RESULTS
Remote POWL Result
E_CONSOLIDATED
Remote POWL Single-Character Flag
E_STATUS_FLAGS
Remote POWL Status List
E_CONS_RESULT
E_MESSAGES
[Type text]
Remote POWL Message META description
How to ... Develop Remote POWL
IF lt_message IS NOT INITIAL.
LOOP AT lt_message INTO ls_message.
APPEND LINES OF ls_message-remote_messages TO e_messages.
ENDLOOP.
ENDIF.
FIELD-SYMBOLS <fs_data> TYPE INDEX TABLE.
READ TABLE lt_results INDEX 1 INTO ls_results.
assign ls_results-remote_objects->* to <fs_data>.
IF sy-subrc eq 0.
e_results = <fs_data>.
ENDIF.
g) HANDLE_ACTION function Implementation
Purpose: Define buttons and their actions (Methods “GET_ACTIONS” & “HANDLE_ACTION”) By
maintaining the two methods GET_ACTIONS and HANDLE_ACTION, you have a huge variety of
options to improve the POWER Lists significantly. First you need to define the buttons with name,
index and more (GET ACTIONS). Second you need to define the actions which should be initiated if
the user presses such a button. The action can simply be launching a transaction and forwarding the
business object parameters to it. Or it could be used to simplify a whole process by using the buttons
to call several function modules in a sequence
Importing Parameter
I_ACT_CONTEXT
Information about current action to be performed
I_POWLR_CONTEXT
Provides Remote POWL information
I_CHANGED
Action changed
I_FORMAT
Remote POWL Format Type
Exporting Parameter
E_STATUS_FLAGS
Remote POWL Action Status Information
E_MESSAGES
Remote POWL Message META description
E_PORTAL_ACTIONS
Follow-up action in portal for Remote POWL
[Type text]
How to ... Develop Remote POWL
To implemented the remote POWl action , call the 'POWLR_HANDLE_ACTION' with parameter as
you call the other function previously.
CALL FUNCTION 'POWLR_HANDLE_ACTION'
DESTINATION lv_destinations
EXPORTING
i_act_context
= lv_act_context
i_powlr_context = lv_context
i_changed
= lv_changed_str
IMPORTING
e_status_flags = ls_status
e_messages
= e_messages
CHANGING
c_objects
= lv_objects_str
c_selected
= c_selected
c_action_defs
= c_action_defs.
Now you have to set the value at the exporting parameter of the feeder class handle action method.
IF lt_message IS NOT INITIAL.
LOOP AT lt_message INTO ls_message.
APPEND LINES OF ls_message-remote_messages TO e_messages.
ENDLOOP.
ENDIF.
IF ls_status IS NOT INITIAL.
" LOOP AT lt_status INTO ls_status.
e_do_refresh = ls_status-remote_status-do_refresh.
e_selected_changed = ls_status-remote_status-selection_changed.
[Type text]
How to ... Develop Remote POWL
e_actions_changed = ls_status-remote_status-action_changed.
c_first_visible_row = ls_status-remote_status-first_visible_row.
c_first_visible_scroll_col = ls_status-remote_statusfirst_visible_col.
cl_powlr_utility=>deserialzie_xml2data( EXPORTING i_xmlstring = lv_ob
jects_str importing data_object = c_result_tab ).
E_RESULT_LINES_CHANGED = 'X'.
ENDIF.
7. Utility Class and It’s Use
In the Package POWL_REMOTE , there is a Utility class to facilitate user in conversation of Data
Type, XML & RTTI etc. Here is the few details of the Utility Class.
Method
Description
CONSTRUCTOR
CONSTRUCTOR
SERIALIZE_XML
Serialize the XML String From the DATA, [mainly use in reference to
send data from host system to remote system and vice versa ]
DESERIALIZE_XML
De-serializes the xml String which is already Serialize, [mainly use
in reference to send data from host system to remote system and
vice versa ]
SERIALIZE_RTTI2XML
Gets the data description [ data rtti to XML conversion]
DESERIALIZE_XML2RTTI
Gets the data reference from the description
SERIALIZE_DATA2JSON
Serializes the result as a JSON string
SERIALIZE_RTTI2XSD
Serialize the data type info as XSD schema
SERIALIZE_DATA2XML
Serialize the data Object as XML STRING
GET_DESC_REC
Recursively builds the type info
GET_REFERENCE_REC
Recursively builds RTTI
DESERIALZIE_XML2DATA
Desterilizes the XML data and fills it to the table []
CREATE_XMLDOC
Creates a xml document from a given xml string
RENDER_XMLDOC
Renders the xml document as string
BUILD_JSON
Builds the JSON string recursively
NORMALIZE_SEL_CRITERIA
Updates the data type definition for the sel criteria
UPDATE_ACTION_DEFINITION
Updates the remote action definition
IS_COMPATIBLE
Checks if two RTTIs are same
GET_ADDITIONAL_PARAMS
Gets the additional runtime parameters [used for Portal Navigation ]
SET_ADDITIONAL_PARAMS
Sets the additional runtime parameters [used for Portal Navigation ]
[Type text]