Saturday, June 25, 2011

Text Variable with Replacement Path

Replacement Path
Replacement path processing type is used in a variable when you wish to get a value from attributes of another character or from a query. The processing type Replacement Path can be used with the following options:
Replace with Characteristic Value
Text and formula variables with the processing type Replacement Path can be replaced with a corresponding characteristic value. In the variable editor, on the General tab page, you specify under Reference Characteristic the characteristic that is to be referenced by the replacement. On the Replacement Path tab page, you can choose whether the variable is replaced with the From or the To Value and with the Key or the Name of the characteristic value. You can also specify the Offset Start and Offset Length for the output.
Replace with Query
Characteristic value variables with the processing type Replacement Path are replaced with the results of a query. In the variable editor, on the Replacement Path tab page, you select the query whose result you want to use as the variable. You can now process the data result of the selected query as a variable in a different query.
Replace with Variable
Characteristic value variables, hierarchy variables, text variables, and formula variables with the Replacement Path processing type can take their values from a different variable.
The following prerequisites need to be fulfilled:
Variable
● The variable must not be input-ready
● The variable must represent a single value
Source Variable
● The source variable must not be a hierarchy node variable
● The source variable must be input-ready
● The source variable must be available in the query
● The source variable must represent a single value or an interval

In the variable editor, on the Replacement Path tab page, you specify the source variable from which the value is to be determined. The value is either determined from the key, the external attribute of the key, the description, or the attribute value. You can specify an Offset Start and an Offset Length for the output here.
The variable is replaced on the variable screen upon each data release.

Illustrated Example of Replacement Path Usage :
In this example we will be using text variables to dynamically handle the description of selections in the query designer. At first we will use an example which shows the resultant query without the use of Replacement path, then we will show the same query output with replacement path used during query design.
After going through the complete document one can clearly compare and identify the purpose and advantage of using a Replacement Path Processing Type.


Designing the Query for Implementation
Open BEx Query Designer
You will see the following screen.
The Key figures and dimensions of the Infoprovider used here can also be seen in the image below


Now we will create a query with some selections.
To do that, go to columns and Right-Click inside.
Now select ‘New Structure’ from the Context menu.


A new structure will be created below. All your new Selections will be created inside this structure.

Right-Click on the Structure and select ‘New Selection’ from the context menu.

A new Selection will appear as part of the Structure we created earlier.
This can be seen below. A new selection ‘Selection 1’ has appeared.

Similarly we will create 2 more selections namely, ‘Selection 2’ and ‘Selection 3’

Now we dragged and dropped Product Characteristic into Rows and Rest of the Characteristics into free characteristics.

Now, for each selection we will restrict the characteristic 0CALMONTH (Calendar Year/Month)
To do that, Right Click on the selection (Here ‘Selection 1’)

You will see the following window.

Here we dragged and dropped ‘Quantity’ key figure and Calendar Year/Month (0CALMONTH) characteristic into the ‘Details of Selection’ pane.

He will restrict Characteristic 0CALMONTH by Value July 2007 for Selection 1
To do this, Right-Click on Calendar Year/Month and select Restrict from the context menu.

You will get the following screen.

Here Select July 2007 and Click on the button to transfer it to the selection pane.
The Single value will be transferred as shown below.

Now repeat these steps for Selection 2 and 3 while selecting August 2007 and September 2007 for Selection 2 and Selection 3 respectively.

Query Execution without the use of Replacement Path
Go to RSRT transaction
You will get the following screen.

Enter your query name and press Execute.

The query output is as shown below


Query Execution using Replacement Path
Now we will see the same example and its output using Replacement Path.
We add on to the step after which we have added Calendar year/Month selection.
Open Selection 1 for editing.
You will get the following screen.
Click on the Variable entry button circled in red below.

You will get the following window.

Click on Create to create a new Variable ( or you can double-click on an existing one to use it)

The following widow will appear.

In the Processing By drop-down option, select ‘Replacement Path’.

In the new ‘Reference Characteristic’ drop-down option, select ‘Calendar Year/Month.

Now Check the ‘Use Standard Text’ checkbox if you want to use the standard text or type-in the customtext to use. In this example, we will retain the standard text.

Now move on to the ‘Replacement Path’ tab. You will see the following window.

As the pre-selections are the same settings we require, we leave it unchanged and click on OK.
We get the following window.
Enter in a desired description and technical name and Press Ok to continue.

Now you can see your new variable in the ‘Variable Selection’ window.

Select the variable and press OK.
You will get the following new screen with the new description as a variable name instead of a constant value. This value will be determined dynamically at runtime

Press Ok.
You will see that the Key Figure name has been changed from a constant ‘Selection 1’ to a variable.

Now we will do the same for the other two Key Figures –Selection 2 and Selection 3
We will use the same variable we created for selection 1.
The end-result looks like the following:

Now, Go to RSRT transaction
You will get the following screen.

Enter your query name and press Execute.

The new query output is as shown below with Calendar year/month value determined dynamically at runtime

Hence we have described a practical usage and advantage of using Replacement path processing variable using a detailed illustrated example.

1 comment: