How to substract one row data from another in a DSO in SAP BW

Scenario: The source data is coming in the form of ytd numbers. Below is an example of year to date (YTD) numbers:

ytd numbers.png

The user wants to see the monthly values instead of the YTD values, below is the data which the user wants to see in the report:

ytd numbers.png

Thus the monthly 2017.02 values are 2017.02 value – 2017.01 value.

Thus, the first month value will be as it is, the second month value will  be second month – first month, the third month value will be third month value – second month value.

Solution:

Continue reading →

Private: How to read child hierarchy entries in DTP

Scenario: There is a requirement to load data with a filter on a certain infoObject.

This filter is a parent node of a hierarchy.

The data in the source is having rows with leaf nodes only for this infoObject.

See below diagram to get clarity:

hier.png

source data.png

From the above diagrams, observe that the data in the source cube is having only leaf nodes for the Region ZREG1. Continue reading →

ABAP in BW Data load Processes

Learn step by step approach of writing start routine, field routine and end routine in BW transformations.

Learn about ABAP routine filters in DTP and info packages and use of OLAP variables as Filters.

Access the ebook on Amazon at amazingly low prices.

 

How to write BW Customer exit to enhance BEx variables

Here I will site an example of how to enhance a BEx variable using BW customer exit.

More details and insightful examples can be accessed in my ebook BEx variable enhancement by Customer Exit.

Display only two years of data in the BEx query

Scenario: Displaying only two years data in the BEx query based on the system date. The BEx query is based on a cube having 5 years of data.

Method:

Create a variable for calday or any time characteristic present in the cube.

I am taking 0calday as an example. SAP provides standard variables also to serve the same purpose. Here I will create a customer exit variable to illustrate the method.

Let the variable name is VAR2

This variable should be Interval value and mandatory.

There is no user input required when the query is accessed. Hence the BEx variable should not be “Ready for Input”.

Based on the system date, an Interval of two years will be calculated. For example, if system date is 24th Feb, 2017, the BEx query should display 2016 and 2017 data.

Drag and drop this variable in the filter section of the query.

Save the query.

Now go to the CMOD transaction and select your project. The project is generally provided by the client and should not be created by the developer. Click Display.

Click on the “components” button and then double click on the Function exit EXIT_SAPLRRS0_001

Double click on Include file name to go into the coding area.

Write the following code: Continue reading →

How to write ABAP program to trigger PC based on file in application server

In this post, I will detail on how to write an ABAP program which checks for a specific file in the application server and triggers a process chain. If no file is found, it just displays a message and does not do anything.

Once the program is ready, you need to schedule a job with this program which runs in the background every 30 minutes for example to check the file and trigger the PC.

Continue reading →

How to write ABAP program to Merge multiple files in one file in Application server

In some scenarios, it may happen that business has loaded multiple files in a period for sales for example. All these files should be merged into one consolidation file and loaded once to target instead of loading each file separately.

Also the consolidation file will have a standard name which the infopackage can recognize and pick up rather than changing the infopackage to load multiple files with different names.

Continue reading →