Sunday, June 26, 2011

SAP BW3.5 to BI7.0 Migration

This document will give you the step by step guide to migrate the 3.5 modeling to new BI 7.x. We have to migrate the all the modeling to BI 7.x because the business content provide the 3.x modeling with transfer rule, update rule, info source and old (3.5) data source.
Following are the prerequisites for the migration.
  • Copy the info provider to Z info provider.
  • Copy the all the transformations Routines code to other documents as safer side. Because after migrate, all the ABAP code are shifted to OOPs code.
  • Please make sure that data source should migrate at the last.
Please find the Step by Step guide with screen shot.
1. First you have to copy the info provider and make another copy with Z name ( like original name 0FIGL_O02 and make it ZFIGL_O02)
Please give the Z name and also put it in the Z info area .
2. Then first we have to migrate the Update rule with Z info source. Please make a separate copy off transformation routine will require later on. Like
Interest Calculation Numerator Days 1 (Agreed) KF
PROGRAM UPDATE_ROUTINE.
*$*$ begin of global - insert your declaration only below this line  *-*
* TABLES: ...
* DATA:   ...
*$*$ end of global - insert your declaration only before this line   *-*
FORM compute_data_field
  TABLES   MONITOR STRUCTURE RSMONITOR "user defined monitoring
  USING    COMM_STRUCTURE LIKE /BIC/CS80FIAR_O03
           RECORD_NO LIKE SY-TABIX
           RECORD_ALL LIKE SY-TABIX
           SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
  CHANGING RESULT LIKE /BI0/V0FIAR_C03T-NETTAKEN
           RETURNCODE LIKE SY-SUBRC
           ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
*
*$*$ begin of routine - insert your code only below this line        *-*
* fill the internal table "MONITOR", to make monitor entries
* result value of the routine
  IF COMM_STRUCTURE-FI_DOCSTAT EQ 'C'.
     RESULT = COMM_STRUCTURE-CLEAR_DATE - COMM_STRUCTURE-NETDUEDATE.
  ELSE.
     RESULT = 0.
  endif.
* if the returncode is not equal zero, the result will not be updated
  RETURNCODE = 0.
* if abort is not equal zero, the update process will be canceled
  ABORT = 0.
*$*$ end of routine - insert your code only before this line         *-*
*
ENDFORM.
 
Then Right click update rules , additional functions --->Create transformations 

Then use Copy info Source 3.x New Info source option to make new copy of the info source

Then give the Z name for that info source which will help you to make new copy of the info source.

3. Then Map and Activated ( Most of the fields are mapped automatically )   

4. Then the following screen would appear.  

5. Then Right click transfer rules, additional functions --> Create transformations

Please assigned newly created info source with Use available infosource Option.  

6. Then map and activated.

7. Then Right click datasource, click migrate ,click with export.  

Please select only With export.

8. Now Your Migration is completed now just look at the Routine code.
Some Tips:
Do not use:
DATA:BEGIN OF itab OCCURS n,
fields...,
END OF itab.

REPLACED by
TYPES:BEGIN OF line_type,
fields...,
END OF line_type.
DATA itab TYPE TABLE OF line_type INITIAL SIZE n.

Internal tables with header lines are not allowed. Header line in an internal table is a default line that the system uses when looping through the internal table

Short forms of internal table line operations are not allowed. For example, you cannot use the syntax INSERT TABLE itab. However, you can use INSERT wa INTO TABLE itab

Transformations do not permit READ itab statement in which the system reads values from header lines.
For example, the code READ TABLE itab. is now outdated, but you could use the code READ TABLE itab WITH KEY . . . INTO wa.

Calling external subroutines using the syntax PERFORM FORM(PROG) is not allowed.
In this example, FORM is a subroutine in the program PROG.

THIS DOCUMENT IS COPIED FROM SAP_TECHNICAL BLOG, for Knowledge sharing ...THANKS TO THE BLOG ORGANIZER.

RSMRT-Remodeling

Beginner’s Guide on Remodeling of Info Providers:
Remodeling, a term which so obviously states something is either reset or rearranged with terms of Info providers. What must be the ideal way to modify how data is displayed? Say, we have loaded a million records into our cube, but in a dire need to modify, do some changes to accommodate some more Info objects to the existing fact or delete some repeating data / no data columns etc at dimension level. In such cases what is the handy solution? The most trusted way to resolve hiccups of this sort is to identify & remodel your Info provider either at fact/dimensions level. In this article we’ll discuss some steps to change the metadata of our Info Cube and remodel our Info Provider. But first time users must be cautious enough to use the remodeled object, and transport the same object to different system landscapes sequentially. The drawback is that, we need to ensure no inconsistency with regards to definition of the Info provider exists between different systems in our entire landscape, else objects could become non-transportable at last.A simple example for re-modeling is as below.

So whatever the changes the DW architects make, care must be taken to do a full backup of all data, followed by stopping all respective process chains. After remodeling existing InfoCube, ensure to re-activate all your transformations & restart process chains (if applicable).
Remodeling in SAP NW-BI 7.0 is applicable only for InfoCubes; not Characteristic Info objects or DSOs. The following options can be performed during a remodeling.
  • Add Characteristics / Key figure
  • Replace Characteristics / Key figure
  • Delete Characteristics / Key figure
There are some pre-activities to be performed too. Once a remodeling rule is scheduled, it is not allowed to modify in future; if not we must create a new remodeling rule. The best advantage is remodeling can be performed even when cube is filled with full data. The remodeling activity can be monitored also, and the requests can be either reset or restarted. Reset would be an exception, while Restart would potentially re-initiate the whole process.
So, to discuss on the early watches to be taken care, its best advised to never run remodeling for an InfoCube, while some process chains or SM37 jobs are running in parallel & take care of manually activating & restarts of the process chains once the remodelling is successful. Also, the InfoCube is locked for any loads or changes.
This activation must be performed for all objects upper & below the data flow (which would include transformation rules). Plus, data backups are a must. Aggregates existing on the cube, if any, will have to be recreated.
Deletion of Characteristics – Step by Step Example
Use T-Code: RSMRT or use ‘Re-Modeling’ in Administration tab on LHS of RSA1.
 
Consider the data as in the cube. Here we plan to delete the unused field Z08_DTE.
 
Give the remodeling rule name & description.

Choose the required options as in the figure.

Save, Check & Schedule the rule.

Click the ‘Monitor’ hot key to check the status on a periodic basis.


Click Release Job. The job which had been scheduled has run successfully.

After remodeling has been successful, we need to check & reactivate the transformations, DTPs etc. & other dependent objects associated with the InfoCube.
Addition of Characteristics
Provide the name & descriptions of new characteristics & dimension it must be included. Also, specify what mechanism the data is populated. In fact, there are 4 ways: Constant, Attribute (& of Characteristic), 1:1 Mapping with Characteristic or Customer Exit. Finally add the new characteristic to the BEx query and execute it.
Replacement of Characteristics is most similar to Addition.
Customer Exit for Remodeling Rules
Go to SE24 –or- Tools > ABAP Workbench > Development > Class Builder
Select Add characteristic, select new characteristic in which the dimension characteristic needs to be added. Select option Customer Exit, select Customer Exit and Transfer.
Use the last option to ‘Insert’ While the rule is being executed it can be monitored by clicking on the monitor button. Once the class builder is open, you can goto ‘Interface’ tab & use the Interface IF_RSCNV_EXIT. This is nothing but an structure which defines how one class behaves with other classes, also known as abstract class.
An interface can specify a set of methods, and classes that implement the interface will have to provide concrete implementations of those methods. IF_RSCNV_EXIT being the interface, we must implement the remodelling functionality via few methods (exits) Viz. IF_RSCNV_EXIT~EXIT. Once the class has been coded, we need to save & activate the method.

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.