You are on page 1of 8

1/3/13

Replacement path for text variable | SCN


Getting Started New sletters Store

Welcome, Guest

Login

Register

Search the Community

Solutions Industries Lines of Business

Services & Support Training & Education University Alliances

About SCN Partnership Events & Webinars

Downloads Developer Center Innovation


Activity Brow se Communications Actions

Replacement path for text variable


created by Umran Syed on Mar 20, 2012 1:10 PM, last modified by Jason Lax on Jun 13, 2012 8:51 AM Share 0 Tw eet 0 Like 0

Version 3

Visibility: Open to anyone Summary This article describes a step by step procedure to create replacement path for text variable used in the Bex. Queries. Author: Syed Umran Ali Company: Man Diesel & Turbo India Ltd. Created on: 21st March 2012 Author Bio:

I am a SAP BW Consultant with Man Diesel & Turbo India Ltd. I have an experience of 3.4 years in BW/BI Implementation & Support Projects.

Table of Contents Introduction ............................................................................................................................... 2 Scenario ................................................................................................................................... 2 Step by step procedure ........................................................................................................... 4 Related Content Disclaimer and Liability Notice

1. Introduction While creating Bex. Queries we often use variables in characteristic restrictions, for user inputs as parameters or for fetching some backend values via customer exists. The variable though filter the required amount of data from the Bex query, the value of the variable itself is not displayed on the report. However, sometimes its an added advantage to have the variable value itself to be displayed in the report. In a scenario where you have reports which displays similar type of data in different columns but for different time periods and different characteristic restrictions, it becomes difficult to identify each of them seperately (sure we can go for selections and hardcode the text for such columns), But if the values are not limited or are calculated at runtime, then its a problem to maintain. This functionality can be achieved with the help of Replacement path for variable text. It provides dynamic text, which will use the value of the selected variable at runtime.

2. Scenario The requirement is to create a report which displays the comparison of yearly budget values for different cost centers of an organization XYZ. The report displays the comparison of the previous year budget values and the next years budget values for each cost center with respect to the value of the fiscal year entered by the user at runtime. The structure of the query is shown below : For,

scn.sap.com/docs/DOC-25425

1/8

1/3/13
User input: 1000 Fiscal Year: 2012 The output should be as below: DB1/1000 Budget for 2011 Cost center Heirarchy
DBIND1000

Replacement path for text variable | SCN

DB1/1000 Budget for 2012

DB1/1000 Budget for 2013

DBMH100 Where, DB1/1000 : Heirarchy node for the cost center input by user. 2011 : User input fiscal year -1 2012 : User input fiscal year 2013 : User input fiscal year +1 The cost center heirarchy node and the fiscal year highlighted above should be caluclated dynamically from the user input and must be displayed as column headers in the report. 3. Step by step procedure: The below procedure describes the way how we can use the variables values as the text for the column headers in the report, using replacement variable text for the above mentioned scenario. a) A local structure is created as shown below: A local structure 'Budget value Comparison' is created to hold the selections for each year i.e. previous year to user input, user input year, next year to user input.

1.

b) It is necessary to have atleast one selection with the characteristic restrictions on the variables whose values we want to display dynamically in the column headers. The structure of of each of the selection is as below: i) For budget for previous fiscal year to the user given value

ii)

For budget for the user given fiscal year value

scn.sap.com/docs/DOC-25425

2/8

1/3/13

Replacement path for text variable | SCN

iii)

For budget for next fiscal year to the user given value

Here, all three places we have used a customer exit variable for Cost center and for fiscal year we have used a user input variable with offsets. Note: Replacement path for text variables can be used without structure as well. c) Creation of the Replacement path text variables Here we will create the two replacement path variables for text, one for the displaying the cost center value and the other for fiscal year. i) Go to the properties of the first selection of the structure. We can find a button just next to the description as shown below:

ii)

Click on New Variable. Fill in the details for the new variable as below:

scn.sap.com/docs/DOC-25425

3/8

1/3/13

Replacement path for text variable | SCN

Note: Here the technical name of the variable is of the replacement path variable to be created and not the User input / Customer exit variable. In the Processing By option, there are three options - manual input/Default Value - Replacement path - Customer Exit Here, we will use the Replacement path processing. Also assign the reference characteristic which is cost center in this case, as shown above. iii) In the next tab for replacement path we can choose the source for the text of the replacement path variable.

Replacement Rule: We have the option to replace the variable with info object or another variable. Here we have replace the variable with another Customer Exit Variable for Cost Center and entered the technical name for it. Replace With: Since we have used a variable for replacement, in the the 'Replace with' selection we have selected 'External Characteristic Value key'. Other options can be used as required. Key - It replace the variable with the characteristic key.

scn.sap.com/docs/DOC-25425

4/8

1/3/13

Replacement path for text variable | SCN


Label - It replace the variable with the name of the characteristic. Attrb. Value - It replace the variable with value of an attribute. An option will appear to enter the reference characteristic of the attribute. Hierarchy Attrb. - It replace the variable with value of an Hierarchy attribute. An option will appear to enter the hierarchy attribute. Use Interval: If in the replacement rule, we have chosen another variable which returns an interval value, then this setting enables you to choose the -From Value -To Value -Difference of the interval range. Offset Setting: It can be used to display only the required part of the text by specifying the required offset and its length. Here, we need the complete text to be displayed hence we kept the offset start and the offset length as '0'. In the details tab no changes are required for Replacement path text variables. iv) In similar way we create the replacement path variable for the fiscal year as shown below:

in

scn.sap.com/docs/DOC-25425

5/8

1/3/13

Replacement path for text variable | SCN

Here the fiscal year variable is a user input variable and not a customer exit, it does not calculate any value at the backend, hence we can directly use the value from the info obejct. Therefore, we replace the variable with the Info Object and selected to Replace the value with the Info Object Key.

The dynamic description setting: The descriptions fetch values dynamically from the technical name of the replacement path variable in between & _______& Any other required text can also be kept outside the &__& where ever required. E.g. &variablename& Actuals
d) This will display the value for the variable fetched dynamically along with the text 'Actuals'.

After creation of the variables the structure will be displayed as below:

The replacement path variable can be modified or changed if required as below:

scn.sap.com/docs/DOC-25425

6/8

1/3/13

Replacement path for text variable | SCN

e)

Execution of the report We had two variables as below:

a) Customer exit variable which takes the cost center value as user input and returns its corresponding hierarhy node. Variable name: VAR_COSTCENTER_01 Replacement path variable created: TXT_VAR_COSTCENTER b) Fiscal Year variable which accepts the user input value. But here we used the Info Object value instead. Replacement path variable created: TXT_0FISCYEAR_01 Execute the report: User Selection for the report are as below:

Output:

Here the Cost center and the Fiscal Year values are calculated dynamically with by the replacement path variables.

Related Content: www.help.sap.com scn.sap.com/welcome

Disclaimer and Liability Notice This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk.

scn.sap.com/docs/DOC-25425

7/8

SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.

656 View s

Tags: for, text, replacement, path, by, variable, step

Average User Rating (0 ratings)

Share

Tw eet

Like

0 Comments
There are no comments on this document.

Site Index Privacy

Contact Us Terms of Use

SAP Help Portal Legal Disclosure

Copyright

Follow SCN

You might also like