Friday, August 28, 2015

Using Selective deletion in a Process Chain with a filter from the TVARVC table

SCOPE: This document will explain “Selective deletion of infocube data in a process chain” based on fiscal period.

SCENARIO: Infocube is being loaded in such a way that we need to delete the previous month (Previous Fiscal period) data first and then reload it again in order to accommodate the changed data. The infocube contains many delta requests. Previous month data can be in any of these requests. In such a case ‘Delete overlapping request in Infocube’ functionality in process chain doesn’t work and we need to have ABAP program so that we could automate this in a process chain.

STEPS FOLLOWED:
  1. Create a selection variable in the TVARVC table.
  2. Use transaction DELETE_FACTS and generate ABAP program and variant for the selective deletion of the infocube
  3. Create an ABAP Program to populate the dynamic variable in the TVARVC table.
  4. Add the ABAP Program from step 3 and step 2 to the process chain. The process chain will have following sequence of variants.
     ABAP program from Step 3 --> ABAP program   from Step 2 --> DTP to load previous month data.

STEP 1:
Create a selection variable in the TVARVC table.
For this go to STVARV transaction à Select options Tab  à Click on Create and create a variable.
I have created ZPREV_FISC_PERIOD.
image1.png
An entry will be created in TVAVRC table
image2.png

STEP 2:
Go to transaction DELETE_FACTS. Provide the Infocube name for which you want to perform a selective deletion and select the radio button ‘Generate Selection Program’.
Click on execute.
image3.png
A program will generated automatically.
image4.png
In order to follow naming convention you can rename the program to a ‘Z’ program.
Create a variant of the generated program.
image5.png
I created ZSELECT_DEL variant
After you click on create you will see the following screen:
image6.png

Go to Fiscal period field and click F1, you will see the following screen.
image7.png
Click on technical Information
image8.png

Note down the ‘screen field’ name.
image9.png
Now click on attributes button
image10.png
Give description to variant and turn the technical name on.
image11.png

Go to fiscal period (which is C023) in this case and enter the selection variable as “T”.  (T: Table Variable from TVARVC (only option available)).
image12.png

Also provide the Name of variable (which we created in Step 1) and save the variant.
image13.png

STEP3:

Create an ABAP Program to populate the dynamic variable in the TVARVC table.
We need to apply logic such that based on system date and fiscal variant we determine the fiscal period and then load the previous fiscal period in the variable.

REPORT  Z_PRE_MONTH_TVARVC.
            DATA:w_datum LIKE sy-datum,
w_yy 
TYPE T009B-BDATJ,
w_month 
TYPE T009B-POPER,
w_fiscper 
TYPE /bi0/oifiscper,
lt_tvarvc 
type STANDARD TABLE OF tvarvc,
gs_tvarvc 
TYPE tvarvc.
CONSTANTSc_s TYPE rsscr_kind VALUE 'S'.
************fiscal month and Year from system date**********
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
I_DATE               
sy-datum*   I_MONMIT             = 00
I_PERIV              
'V3' "Fiscal Variant
IMPORTING
E_BUPER              
w_month
E_GJAHR              
w_yy.
* EXCEPTIONS
*   INPUT_FALSE          = 1
*   T009_NOTFOUND        = 2
*   T009B_NOTFOUND       = 3
*   OTHERS               = 4

****If fiscal month is jan, previous fiscal month will be December and Year =Year-1

IF w_month 10.
w_month 
.
w_yy 
=  w_yy 1.
ELSE.
w_month 
w_month 1.
ENDIF.

Concatenate  w_month  w_yy into w_fiscper.
gs_tvarvc
-low w_fiscper.
gs_tvarvc
-sign 'I'.
gs_tvarvc
-opti 'EQ'.
gs_tvarvc
-name 'ZPREV_FISC_PERIOD'. "Variable name in TVARVC table
gs_tvarvc
-type c_s.

append gs_tvarvc to lt_tvarvc.
Modify tvarvc FROM table lt_tvarvc.
FREEgs_tvarvc.

Save and activate the program. You can also execute the program manually to check whether the TVARVC table is updated with required record or not.
image14.png
Step 4:

Add the ABAP Program from step 3 and step 2 to the process chain.
image15.png
Reference:
Using Selective Deletion in Process Chains
Using Selective deletion in a Process Chain with a filter from the TVARVC table


Monday, December 2, 2013

Navigational and Display Attributes


Display attributes - You can display these attributes of the main info object in the query but cannot drill down beyond these attributes and apply some formula's.

We cannot restrict the display attribute nor can we create variables on them at query level.

Navigational attributes - You can display these attributes in the query as well as apply drill down beyond these attributes and apply formula's and do some calculation.

We can restrict the navigational attribute and also create variables on them at query level.

Lets consider we have objects Material, Material type and sales amount. We have the below data.

Material    Material Type  Sales amount

M1          ABC                   200
M2          ABC                   300
M3          XYZ                   500
M4          XYZ                   400
M5          TYS                   600
M6          XYZ                   100

Navigational Attribute:

Assume that Material type is as navigation attribute to master data Material. If we want to have an analysis about the sales based on Material Type. Since 'Material Type' is navigational attribute we have an independent drill down of 'Material Type' without the support of Material in report .

Material Type   Sales amount

ABC                   500
XYZ                  1000
TYS                   600

Here Material Type  is an attribute of Material, as we made this as navigational attribute, it can be standalone in report without Material.

Display Attribute:

We cannot go for individual drill down to 'Material Type' without Material, i.e. if we want 'Material Type' in our report then we have to drill down Material along with 'Material Type'. Report output will be as below.

Material  Material Type Sales amount

M1            ABC               200
M2            ABC               300
M3            XYZ               500
M4            XYZ               400
M5            TYS               600
M6            XYZ               100

Just observe the report in our first case is having only three records with aggregated value based on 'Material Type' but in the second we have 6 records.

-----------------------------------------------------------------------------------------------------------------------------------------

Thursday, September 5, 2013

Event Based Process Chains

There may be a requirement where you may need to schedule a process chain after an event is being triggered.


In this Example I have a process chain A runs weekly, when completed should trigger an event which will result in execution of Process chain B.


Steps to be followed is as follows :


Step 1) Create an Event-->    Go to Transaction code SM62   --> Select  BckProcEvnts tab  --> Create an event.


Image


In the snapshot  above  we can see I have created an Event 'ZTEST'.


Step 2) Create variant for Program ''BTC_EVENT_RAISE"


    Go to se38 --> Enter Program name 'BTC_EVENT_RAISE'---> Select Variant radio Button --> Click Display


Image


Enter a name for Variant and click 'Create'.


 Image


In the following screen, enter the event name which you have created in SM62 (in Step 1). In my case I had created 'ZTEST' Event.Image


Click on Attributes , enter description for variant  and click on 'Save'


Image


Step 3) Go to Process Chain A


At the end of your Process chain, insert process type 'ABAP Program'.


Image


In the next Screen insert  the ABAP Program 'BTC_EVENT_RAISE'.


Enter the variant created in Step 2.


Image


Your Process chain A will look like this


Image


Schedule process chain A as per your requirement .Example I scheduled it weekly, (on Sunday, Morning 6 AM)


Image


Step 4  ) Go to your RSPC and open Process chain B


Go to Start Variant --> Change selections --> After Event --> Enter the Event Name created in Step 1.


Check box 'Periodic job'


Image


Now , every Sunday 6 am Process chain A  gets executed. As soon as the ABAP Program is completed  in the last step of Process chain A, event ZTEST is gets triggered and as a result of that Process chain B starts.


So you get the desired result as per event based scenario.

Thursday, August 29, 2013

Difference Between SAP BW 3.5 and 7x

The difference can be described as follows :

1) The Remodeling transaction helps you add new key figure and characteristics and handles historical data as well without much hassle. This is only available for infocubes in  SAP BW 7x.


2) The BI accelerator (for now only for infocubes) helps in reducing query run time by almost a factor of 10 - 100.


3) Search functionality has improved. You can search any object you want to, which was not possible in SAP BW 3.5


4) The transformation replaces the transfer and update rules.


5) Introduction of Write-optmized DataStore  Object in which does not have any change log and the requests do need any activation. The goal of such DSO is mainly to request its data with the Bex tools in order to provide queries at the raw data level..


6) One level of Transformation. This replaces the Transfer Rules and Update Rules.


7) Load in the PSA is a must in SAP BW 7x, which was optional in SAP BW 3.5 and data could be directly loaded to data targets.


8) In Infosets now you can include Infocubes as well.


9) Renamed ODS as DataStore Object (DSO).


10) Datawarehousing workbench replaces the administrator workbench.


11) New data flow capabilities such as Data Transfer Process (DTP), Real time data Acquisition