howtoguide for rpowl

28
SAP NetWeaver How-To Guide How To... << Enter document title in File -> Properties -> Summary >> Develop Remote POWL Applicable Releases: SAP NetWeaver 7.01 SAP NetWeaver How-To Guide

Upload: go2kaatt

Post on 17-Sep-2015

238 views

Category:

Documents


5 download

DESCRIPTION

RPOWL

TRANSCRIPT

How To... Properties -> Summary >>

SAP NetWeaverHow-To GuideHow to... Develop Remote POWLApplicable Releases:

SAP NetWeaver 7.01 Copyright 2009 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 SAPs Support Services and may not be modified or altered in any way.

Document HistoryDocument VersionDescription

1.00First official release of this guide

Typographic Conventions

Type Style Description

Example TextWords 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 textEmphasized words or phrases in body text, graphic titles, and table titles

Example textFile and directory names and their paths, messages, names of variables and parameters, source text, and names of installation, upgrade and database tools.

Example textUser entry texts. These are words or characters that you enter in the system exactly as they appear in the documentation.

Variable user entry. Angle brackets indicate that you replace these words and characters with appropriate entries to make entries in the system.

EXAMPLE TEXTKeys on the keyboard, for example, F2 or ENTER.

Icons

IconDescription

Caution

Note or Important

Example

Recommendation or Tip

Table of Contents

31.Purpose

32.Business Scenario

33.Background Information

34.Prerequisites

45.Scope

46.Step-by-Step Procedure

1. PurposeThe 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 system2. Business ScenarioNA3. Background InformationNA4. Prerequisites

4.1 Technical

The RFC destinations are maintained using the logon details of the technical user. The current users 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.5. ScopeNA6. Step-by-Step ProcedureThis 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.

DATAlv_contextTYPEpowlr_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

CALLFUNCTION'POWLR_ASYNC_COLLECT_ACTIONS'EXPORTINGi_powl_context=lv_contexti_selcrit_vals=i_selcrit_para [from importing parameter]i_destinations=lt_destinations [different destination]IMPORTINGe_status_flags=lt_statuse_actions=lt_actione_messages=lt_message.

Importing Parameter

I_POWL_CONTEXTProvides Remote POWL information

I_SELCRIT_VALSParameter Table

I_DESTINATIONSPOWL Remote Function Call Destination

Exporting Parameter

E_STATUS_FLAGSRemote POWL Status List

E_ACTIONSRemaote POWL action meta description

E_MESSAGESRemote POWL Message META description

After Getting the result you have to again feed the result into the exporting & changing parameter of the method.

IFc_action_defsISINITIAL.IFlt_actionISNOTINITIAL.

LOOPATlt_actionINTOls_action.INSERTls_action-remote_actionsINTOTABLEc_action_defs.ENDLOOP.ENDIF.e_actions_changed='X'.ENDIF.

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.

DATAlv_act_contexTYPEpowlr_act_context_sty.

lv_act_contex-act_index=i_action_index.lv_act_contex-actionid=i_actionid.

CALLFUNCTION'POWLR_GET_ACTION_CONF'EXPORTINGi_powlr_context=lv_contexti_act_context=lv_act_contexi_selected=i_selectedi_objects=lv_object_stri_changed=lv_changeinfo_strIMPORTINGe_confirmation=e_conf_messagee_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.

Importing Parameter

I_POWLR_CONTEXTProvides Remote POWL information

I_ACT_CONTEXTInformation about current action to be performed

I_SELECTED Table for Indexes

I_OBJECTS

I_CHANGEDout tab change infos for feeder

Exporting Parameter

E_CONFIRMATIONTable of Strings

E_MESSAGESMessage 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.CALLFUNCTION'POWLR_ASYNC_COLLECT_SELCRIT'EXPORTINGi_powl_context=lv_contexti_destinations=lt_destinationsIMPORTINGe_status_flags=lt_statuse_selcrit=lt_selcrite_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.

IFlt_selcritISNOTINITIAL.LOOPATlt_selcritINTOls_selcrit.APPENDLINESOFls_selcrit-remote_selcritTOc_selcrit_defs.ENDLOOP.ENDIF.

same as you have to set the parameter e_selcrit_defs_changed and e_default_val_changed

IFlt_statusISNOTINITIAL.LOOPATlt_statusINTOls_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

CALLFUNCTION'POWLR_ASYNC_COLLECT_FIELDCAT'EXPORTINGi_powl_context=lv_contexti_destinations=lt_destinationsi_selcrit_vals=i_selcrit_valuesIMPORTINGe_status_flags=lt_statuse_fieldcat=lt_fieldcate_messages=lt_message.

Now fill the field catalog with the received set of data.

IFlt_fieldcatISNOTINITIAL.LOOPATlt_fieldcatINTOls_fiedlcat.APPENDLINESOFls_fiedlcat-remote_fieldcatTOc_fieldcat.ENDLOOP.ENDIF.

IFlt_statusISNOTINITIAL.LOOPATlt_statusINTOls_status.e_default_technical_col=ls_status-remote_status-default_tech_col."e_fieldcat_changed=ls_status-e_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_CONTEXTProvides Remote POWL information

I_DESTINATIONSPOWL Remote Function Call Destination

I_SELCRIT_VALSSelection Criteria Table

Exporting Parameter

E_STATUS_FLAGSRemote POWL Status List

E_FIELDCATRemote Field catalog META description

E_MESSAGESRemote POWL Message META description

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

CALLFUNCTION'POWLR_ASYNC_COLLECT_OBJECT_DEF'EXPORTINGi_powl_context=lv_contexti_selcrit_vals=i_selcrit_valuesi_destinations=lt_destinationsi_format=lv_formatIMPORTINGe_status_flags=lt_statuse_obj_def=lt_object_defe_messages=lt_message.

Importing Parameter

I_POWL_CONTEXTProvides Remote POWL information

I_SELCRIT_VALSrsparams Table

I_DESTINATIONSPOWL Remote Function Call Destination

I_FORMATRemote POWL Format Type

Exporting Parameter

E_STATUS_FLAGSRemote POWL Status List

E_OBJ_DEFRemote POWL Object Defination

E_MESSAGESRemote POWL Message META description

READTABLElt_object_defINDEX1INTOls_object_def.IFsy-subrcEQ0.e_object_def?=ls_object_def-remote_obj_def.ELSE.

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.

CALLFUNCTION'POWLR_ASYNC_COLLECT_OBJECTS'EXPORTINGi_powl_context=lv_contexti_destinations=lt_destinationsi_selcrit_vals=i_selcrit_valuesi_format=lv_formatimportinge_results=lt_results*E_CONSOLDATED=e_status_flags=lt_status*E_CONS_RESULT=e_messages=lt_message.

Importing Parameter

I_POWL_CONTEXTProvides Remote POWL information

I_DESTINATIONSPOWL Remote Function Call Destination

I_SELCRIT_VALSrsparams Table

I_FORMATRemote POWL Format Type

Exporting Parameter

E_RESULTSRemote POWL Result

E_CONSOLIDATEDRemote POWL Single-Character Flag

E_STATUS_FLAGSRemote POWL Status List

E_CONS_RESULT

E_MESSAGESRemote POWL Message META description

IFlt_messageISNOTINITIAL.LOOPATlt_messageINTOls_message.APPENDLINESOFls_message-remote_messagesTOe_messages.ENDLOOP.ENDIF.

FIELD-SYMBOLSTYPEINDEXTABLE.READTABLElt_resultsINDEX1INTOls_results.assignls_results-remote_objects->*to.IFsy-subrceq0.e_results=.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_CONTEXTInformation about current action to be performed

I_POWLR_CONTEXTProvides Remote POWL information

I_CHANGEDAction changed

I_FORMATRemote POWL Format Type

Exporting Parameter

E_STATUS_FLAGSRemote POWL Action Status Information

E_MESSAGESRemote POWL Message META description

E_PORTAL_ACTIONSFollow-up action in portal for Remote POWL

To implemented the remote POWl action , call the 'POWLR_HANDLE_ACTION' with parameter as you call the other function previously.

CALLFUNCTION'POWLR_HANDLE_ACTION'DESTINATIONlv_destinationsEXPORTINGi_act_context=lv_act_contexti_powlr_context=lv_contexti_changed=lv_changed_strIMPORTINGe_status_flags=ls_statuse_messages=e_messagesCHANGINGc_objects=lv_objects_strc_selected=c_selectedc_action_defs=c_action_defs.

Now you have to set the value at the exporting parameter of the feeder class handle action method.

IFlt_messageISNOTINITIAL.LOOPATlt_messageINTOls_message.APPENDLINESOFls_message-remote_messagesTOe_messages.ENDLOOP.ENDIF.

IFls_statusISNOTINITIAL."LOOPATlt_statusINTOls_status.e_do_refresh=ls_status-remote_status-do_refresh.e_selected_changed=ls_status-remote_status-selection_changed.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_status-first_visible_col.cl_powlr_utility=>deserialzie_xml2data(EXPORTINGi_xmlstring=lv_objects_strimportingdata_object=c_result_tab).E_RESULT_LINES_CHANGED='X'.ENDIF.

7. Utility Class and Its UseIn 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_RTTI2XMLGets the data description [ data rtti to XML conversion]

DESERIALIZE_XML2RTTIGets the data reference from the description

SERIALIZE_DATA2JSONSerializes the result as a JSON string

SERIALIZE_RTTI2XSDSerialize the data type info as XSD schema

SERIALIZE_DATA2XMLSerialize the data Object as XML STRING

GET_DESC_RECRecursively builds the type info

GET_REFERENCE_RECRecursively builds RTTI

DESERIALZIE_XML2DATADesterilizes the XML data and fills it to the table []

CREATE_XMLDOCCreates a xml document from a given xml string

RENDER_XMLDOCRenders the xml document as string

BUILD_JSONBuilds the JSON string recursively

NORMALIZE_SEL_CRITERIAUpdates the data type definition for the sel criteria

UPDATE_ACTION_DEFINITIONUpdates the remote action definition

IS_COMPATIBLEChecks if two RTTIs are same

GET_ADDITIONAL_PARAMSGets the additional runtime parameters [used for Portal Navigation ]

SET_ADDITIONAL_PARAMSSets the additional runtime parameters [used for Portal Navigation ]

EMBED MSPhotoEd.3

_1084866957.bin

_1099206023.bin