+ All Categories
Home > Documents > HowToDevelopandUseDynamicVariables.doc

HowToDevelopandUseDynamicVariables.doc

Date post: 04-Nov-2015
Category:
Upload: vasudeva
View: 223 times
Download: 0 times
Share this document with a friend
17
SAP NetWeaver How-To Guide How To… Develop and Use Dynamic Variales in P!W" pplicale #eleases$ SAP NetWeaver %&'( SAP NetWeaver %&(( Version (&' )arc* +'',
Transcript

SAP NetWeaver

SAP NetWeaverHow-To GuideHow To

Develop and Use Dynamic

Variables in POWL

Applicable Releases:

SAP NetWeaver 7.01

SAP NetWeaver 7.11

Version 1.0March 2008 Copyright 2008 SAP AG. All rights reserved.No part of this publication may be reproduced ortransmitted in any form or for any purpose without theexpress permission of SAP AG. The information containedherein may be changed without prior notice.Some software products marketed by SAP AG and itsdistributors contain proprietary software components ofother software vendors.Microsoft, Windows, Outlook, and PowerPoint areregistered trademarks of Microsoft Corporation.IBM, DB2, DB2 Universal Database, OS/2, ParallelSysplex, 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 aretrademarks or registered trademarks of IBM Corporation.Adobe, the Adobe logo, Acrobat, PostScript, and Readerare either trademarks or registered trademarks of AdobeSystems Incorporated in the United States and/or othercountries.Oracle is a registered trademark of Oracle Corporation.UNIX, X/Open, OSF/1, and Motif are registeredtrademarks of the Open Group.Citrix, ICA, Program Neighborhood, MetaFrame,WinFrame, VideoFrame, and MultiWin are trademarks orregistered trademarks of Citrix Systems, Inc.HTML, XML, XHTML and W3C are trademarks orregistered trademarks of W3C, World Wide WebConsortium, 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 andimplemented by Netscape.MaxDB is a trademark of MySQL AB, Sweden.SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAPNetWeaver, and other SAP products and servicesmentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG inGermany and in several other countries all over the world.All other product and service names mentioned are thetrademarks of their respective companies. Data containedin 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 affiliatedcompanies ("SAP Group") for informational purposes only,without representation or warranty of any kind, and SAPGroup shall not be liable for errors or omissions withrespect to the materials. The only warranties for SAPGroup products and services are those that are set forth inthe express warranty statements accompanying suchproducts and services, if any. Nothing herein should beconstrued as constituting an additional warranty.These materials are provided as is without a warranty ofany kind, either express or implied, including but notlimited to, the implied warranties of merchantability,fitness for a particular purpose, or non-infringement.SAP shall not be liable for damages of any kind includingwithout limitation direct, special, indirect, or consequentialdamages that may result from the use of these materials.SAP does not warrant the accuracy or completeness of theinformation, text, graphics, links or other items containedwithin these materials. SAP has no control over theinformation that you may access through the use of hotlinks contained in these materials and does not endorseyour use of third party web pages nor provide any warrantywhatsoever relating to third party web pages.SAP NetWeaver How-to Guides are intended to simplifythe product implementation. While specific productfeatures and procedures typically are explained in apractical business context, it is not implied that thosefeatures and procedures are the only approach in solving aspecific business problem using SAP NetWeaver. Shouldyou wish to receive additional information, clarification orsupport, please refer to SAP Consulting.Any software coding and/or code lines / strings (Code)included in this documentation are only examples and arenot intended to be used in a productive systemenvironment. The Code is only intended better explain andvisualize the syntax and phrasing rules of certain coding.SAP does not warrant the correctness and completeness ofthe Code given herein, and SAP shall not be liable forerrors or damages caused by the usage of the Code, exceptif such damages were caused by SAP intentionally orgrossly negligent.DisclaimerSome components of this product are based on Java. Anycode change in these components may cause unpredictableand severe malfunctions and is therefore expressivelyprohibited, as is any decompilation of these components.Any Java Source Code delivered with this product is onlyto be used by SAPs Support Services and may not bemodified or altered in any way.Document HistoryDocument Version1.00DescriptionFirst official release of this guideTypographic ConventionsType StyleExample TextDescriptionWords or characters quotedfrom the screen. Theseinclude field names, screentitles, pushbuttons labels,menu names, menu paths,and menu options.Cross-references to otherdocumentationExample textEmphasized words orphrases in body text, graphictitles, and table titlesFile and directory names andtheir paths, messages,names of variables andparameters, source text, andnames of installation,upgrade and database tools.User entry texts. These arewords or characters that youenter in the system exactly asthey appear in thedocumentation.Variable user entry. Anglebrackets indicate that youreplace these words andcharacters with appropriateentries to make entries in thesystem.Keys on the keyboard, forexample, F2 or ENTER.IconsIconDescriptionCautionNote or ImportantExampleRecommendation or TipExample textExample text

EXAMPLE TEXTTable of Contents1.2.3.4.5.6.Purpose ................................................................................................................................ 1Business Scenario............................................................................................................... 1Background Information ..................................................................................................... 1Prerequisites ........................................................................................................................ 2Scope .................................................................................................................................... 2Step-by-Step Procedure...................................................................................................... 36.1Develop Dynamic Variable formulas ............................................................................ 3To develop the custom formulas, implement the interface in a class and follow the steps for each interface................................................................................................ 36.1.16.1.26.1.36.1.46.1.56.1.66.26.2.16.2.26.2.3Method GETPARAMETERS............................................................................ 3GETDEFINITION ............................................................................................. 4CALCULATE .................................................................................................... 4ENCODE_PARAMETERS............................................................................... 5DECODE_PARAMETERS............................................................................... 6GET_ATTRIBUTES ......................................................................................... 7Configuration settings ...................................................................................... 8Navigation to Calculated Dates ..................................................................... 10Dynamic Variable Refresh ............................................................................. 11Use Dynamic Variable formulas ................................................................................... 8How To... Properties -> Summary >>1. PurposeThis guide describes the technical background, the development of own dynamicvariable formulas for date selection criteria, and how to use the developed formulas.2. Business ScenarioThe POWL is a very flexible tool , used by a range of applications (ERPOperations, Financials, HCM, SRM etc.), that provides personalized work lists tothe user.Consider the scenario in which the POWL is used in the SAP role Internal SalesRepresentative to provide access to the current workload for SalesDocuments and Customers and so on. Within sales, the date definition of work lists is very important. The Internal SalesRepresentative needs to define, for example,. a work list of expiring quotations, in order to call thecustomer in time and ensure that a sales order is created out of the quote withinthe validity time.Currently, it is only possible to define the work list with a fixed date, for example,. a list of expiringquotations with the selection criteria valid to = 20.07.2007. It is not possible todefine a date variable such as valid to = today + 10 days. To do this, it is necessary to have the possibility to assign a dynamic date variableThis is anew development in the POWL framework which can be used by allapplications.Examples from other applications: Production Supervisor: Operations for Work Centers with start or end date 5 days in the past or in the future Buyer: Purchase Requisitions to be assigned with delivery date within the next 5 days3. Background InformationFor dynamic variables, an interface IF_POWL_DYN_VAR is provided allowing thedeveloper to develop custom formulas apart from the standard formulas provided bythe POWL framework.How To... Properties -> Summary >>A developer can have any number of formulas for his or her business demands, and theseformulas are sent to POWL by implementing the BAdI BADI_GET_DYN_VAR_CLS.4. PrerequisitesThe application has implemented a feeder class and the necessarycustomizing. More information about developing the feeder class could be found athttps://bis.wdf.sap.corp/twiki/pub/Applications/POWL/POWLHow_to_Guide.pdf5. ScopeThe dynamic variable formulas are provided only for the date selection criteria.In future, it will beexpanded to other selection criteria variables.How To... Properties -> Summary >>6.Procedure6.1 Develop Dynamic Variable formulasTo develop the custom formulas, implement the interface in a class and follow the stepsfor each interface. NoteExample codes are taken from the class CL_POWL_DYN_TODAY_PLUS_N.6.1.1Method GETPARAMETERSGenerally, formulas will have parameters for computing. In this method, description ormeta data of the parameters are given.ParametersImportingI_USERNAMEthe user ID the current portal user ismapped toExportingE_PARAMS_DEF Parameters meta dataFor each parameter defined, a record has to be added to the tableE_PARAMS_DEF.Field NamePARAMNAMEMANDATORYREAD_ONLYHIDDENDATATYPETOOLTIPDESCRIPTIONVALID_VALUESDescriptionName or Id of the parameterMandatory parameter set the flag toX.Read only parameter set the flag toX.Hidden parameter set the flag to X.Data typeParameter tool tipParameter description text, this willbe acting as label.If a drop down is needed rather thaninput field, then add a name valueset.How To... Properties -> Summary >> RecommendationFor labels, it is recommended to define OTR texts instead of using staticliterals.Examplemethod IF_POWL_DYN_VAR~GETPARAMETERS.DATA: ls_params TYPE LINE OF powl_params_def_tty.ls_params-paramname = 'N'.ls_params-datatype = 'I'.ls_params-tooltip = 'Number of days'.ls_params-description = 'No of days'.ls_params-mandatory = 'X'.APPEND ls_params TO e_params_def.endmethod....6.1.2...GETDEFINITIONThis method is not used now. In future, it will be used if formulas other than date selection criteria are needed.6.1.3...CALCULATEThe formula is computed here. It gets a list of parameters along with values.A developer can compute the formula based on the values, and return the result.ParametersImportingi_paramsList of formula parameters withvaluesExportinge_resulte_messagesComputed ResultError messagesHow To... Properties -> Summary >>ExampleMETHOD if_powl_dyn_var~calculate.DATA: l_current_date LIKE sy-datum, lt_params TYPE powl_params_tty, ls_params TYPE LINE OF powl_params_tty. READ TABLE i_params INTO ls_params WITH KEY paramname = 'N' .** Today + N days l_current_date = sy-datum. l_current_date = l_current_date + ls_params-value. e_result = l_current_date.ENDMETHOD.6.1.4ENCODE_PARAMETERSThe list of parameters with values is encoded to a string. Developers can have theirencoding format if needed. NoteThe encoded string will appear in the POWL_QUERY transaction, so it isadvisable to use an understandable format.ParametersImportingi_usenamei_paramsthe user ID the current portal user ismapped toList fo formula parameters withvaluesExportinge_params_string Encoded stringe_messagesMessage META descriptionHow To... Properties -> Summary >>Examplemethod IF_POWL_DYN_VAR~ENCODE_PARAMETERS. CALL FUNCTION 'POWL_ENCODE_DYNPARA' EXPORTING i_params= i_params i_escape= '/'IMPORTING E_PARAMS_STRING= e_param_string.endmethod.6.1.5DECODE_PARAMETERSThe encoded string is converted to a table of parameter and value.ParametersImportingi_param_stringI_usernamee_paramse_messagesEncoded stringMessage META descriptionExportingList for formula parameters withvaluesMessage META descriptionExample METHOD IF_POWL_DYN_VAR~DECODE_PARAMETERS. CALL FUNCTION 'POWL_DECODE_DYNPARA' EXPORTING i_params_string = i_param_string i_escape= '/' IMPORTING e_params= e_params.ENDMETHOD.How To... Properties -> Summary >>6.1.6GET_ATTRIBUTESThis is the description of the formula. If the parameter or its value is needed toappear in the drop down list, or in the calculated description shown below, the selectioncriteria follows the pattern &, with index position of the parameter in thee_params_def table. ExampleClass CL_POWL_DYN_TODAY_PLUS_N description is Today + &1Days. This formula has a parameter N and its index in exportingparameter E_PARAMS_DEF of method GETPARAMETERS is 1. So &1will be replaced by N when appearing in drop down.When the user enters the value of N, assume 2. Below the selection criteria,the description will be displayed has Today + 2 Days.ParametersExportingE_description Description of the class RecommendationDefine OTR texts instead of using static literals for description. ExampleMETHOD if_powl_dyn_var~get_attributes. e_description = Today + &1 Days.ENDMETHOD.

How To... Properties -> Summary >>6.2 Use Dynamic Variable formulasIn order to use the developed formulas, the following steps must be performed.1. Configuration settings2. Supply the developed formula class name to POWL through the BAdIBADI_GET_DYN_VAR_CLS.6.2.1Configuration settingsSince the implementation of this feature is optional, it is provided via configurationpossibility. This can be achieved by following the steps given below.1. Start transaction SE80, choose Web Dynpro Comp. / Intf. and enter Component Name POWL_UI_COMP.

2. Right click on node 'POWL_UI_COMP' or 'Component Configurations' and choose Create/Change Configuration.3. The Web Dynpro Configuration Editor will start up.4. Enter 'POWL_UI_COMP' into the field component name and choose a name for5. your configuration.6. Click the 'create' button.7. Click on tab 'Component-defined'.8. Select the node 'TYPE_SPECIFIC'.9. Check the checkbox for dynamicData to trueComponent Configuration settings for Dynamic Variables Only

How To... Properties -> Summary >>10. Now click on the save button to save the configuration.Now you need to create the application configuration

11. Go back to SE80 and select the node Web Dynpro Applications12. Right click on POWL and select create/change configuration from the context menu. 13. In the Application Configuration editor enter the followingApplication = POWLConfiguration = {your choice}14. Click on Create button.15. Under the Configuration column in the table enter the name of the previously created component configuration

16. Click on the save button Application Configuration settings for Dynamic Variables only

How To... Properties -> Summary >>6.2.2Navigation to Calculated DatesIt is possible to navigate to calculated dates either by changing the query or bydefining a new query. Both are similar.1. Launch the POWL application.2. Click Change Query3. Click Calculated Dates A Pop-up will appear.4. Select the formula in the drop down list If the formula has any parameters, they will appear in the same line5. Enter the values for the parameters

How To... Properties -> Summary >>6. Click Ok. For any selection criteria, if a formula is selected, it will display as read only and a description will appear for the selected formula.6.2.3Dynamic Variable RefreshFormula calculated values are changed everyday, or within a day, so they defer with cached parameter values. Refresh is triggered to keep thecached values and results in sync with the calculated valueThese are the following scenarios1. On launch of the POWL, all the query dynamic variable valuesare recalculated. If the value differs, then Refresh is triggered for only those particular queries..2. On switching the query, dynamic variable values are recalculated. If the value differs, then refresh is triggered for only those particular queries..6.2.1.1 Call the POWER List with a specific Configuration

The NWBC must start the respective POWER List with the newly created configuration; otherwise the calculated dates wont be available in the query. This can be achieved via role maintenance: an additional parameter WDCONFIGURATIONID has to be passed to the POWL WebDynpro application.

Access the transaction pfcg.

On the Role Maintenance Specify the role to be maintained.

Choose Change.

On the screen Change Role navigate to tab Menu.

Navigate to the specific POWER List within the role menu.

Right-Click on the POWER List and choose Change Nodes.

On the Web Dynpro Application subscreen, enter the new parameter WDCONFIGURATIONID. Be sure to select the parameter via input help.

Specify the name of the newly created Application Configuration

Choose OK.

Choose Save.