custom column names for bex query
DESCRIPTION
bex queryTRANSCRIPT
1/3/13 Replacement path for text variable | SCN
1/8scn.sap.com/docs/DOC-25425
Getting Started Newsletters Store
Solutions Services & Support About SCN Downloads
Industries Training & Education Partnership Developer Center
Lines of Business University Alliances Events & Webinars Innovation
Login RegisterWelcome, Guest Search the Community
Activity Communications Actions
Brow se
0 TweetTweet 0
created by Umran Syed on Mar 20, 2012 1:10 PM, last modif ied by Jason Lax on Jun 13, 2012 8:51 AM
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,
Replacement path for text variable
ShareShare Like 0
Version 3
1/3/13 Replacement path for text variable | SCN
2/8scn.sap.com/docs/DOC-25425
User input: 1000
Fiscal Year: 2012
The output should be as below:
DB1/1000
Budget for 2011
DB1/1000
Budget for 2012
DB1/1000
Budget for 2013
Cost center Heirarchy
DBIND1000
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.
1. 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.
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
1/3/13 Replacement path for text variable | SCN
3/8scn.sap.com/docs/DOC-25425
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:
Click on New Variable.
ii) Fill in the details for the new variable as below:
1/3/13 Replacement path for text variable | SCN
4/8scn.sap.com/docs/DOC-25425
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.
1/3/13 Replacement path for text variable | SCN
5/8scn.sap.com/docs/DOC-25425
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.
in 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:
1/3/13 Replacement path for text variable | SCN
6/8scn.sap.com/docs/DOC-25425
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.
d) 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
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:
1/3/13 Replacement path for text variable | SCN
7/8scn.sap.com/docs/DOC-25425
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.
Follow SCNSite Index Contact Us SAP Help Portal
Privacy Terms of Use Legal Disclosure Copyright
Average User Rating
(0 ratings)
0 TweetTweet 0
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
ShareShare Like 0
There are no comments on this document.
0 Comments