Child pages
  • How to run report for future date
Skip to end of metadata
Go to start of metadata

Purpose

This content helps SAP BW developer to test the report if there is any text variable populating system data in istep1 or in istep2. User can debug the customer exit code and populate desired future date instead if system date and run the report for same future date.

Overview 

It is a step by step solution for a scenario where the report will display the data for current year as well as for future year also.It is about a query having key figures which can be displayed only for future dates or years.

Scope: In SAP BW when there are variables or text variables depending upon their processing type affect the run date of the report & the data to be displayed is dependent on these variable values this solution is useful.

We generally have a requirement for a report displaying employee leave data where at the end of the year we calculate the amount to be paid out for the encashment of leaves. For different organizations based on their location,state or Business Unit the encashment may vary. Now my requirement is a report having all leave hours displayed for my organization & there are some hours which can be seen only after the year 2011 i.e. those leave will become active for calculation after 2011 only & after that I need those hours to be displayed.Hence to test these future hours I need to run my report fir future dates. here my main focus of this blog comes into picture.

I chose to use Customer exit because it is a customized processing type for variables to suit requirement specific needs. I have built the query having all those Key figures & restricted it on given years. for testing the current year, current year - 1 & current year -2 was very simple as fetching that data based on sy-datum was easy through customer exit variables.but the problem occur while testing the report for future dates. to test the report behavior in future I have followed following simple steps of debugging the customer exit to get desired date:

Steps

Step 1: Go to SE38, Program name:ZXRSRU01

Step 2: Press "Display" tab.

Step 3: Find the variable which is populating the  date might be system date  or any other date from customer exit in your report. There might be more than 1 variables populating the date through customer exit in your report.

Step 4: Insert break-point corresponding to that variable. Break-point should be inserted wrt only those variable which populate the date for your report. Insert break-point where you have condition which will take system date & populate into some local variable or say L_S_RANGE-LOW.

Step 5: Go to transaction RSRT in new session. Enter the query's technical name & execute.

Step 6: Once you press Execute, new session will be called of ABAP debugger

Step 7: Press F5 for proceeding further STEP BY STEP.

Step 8: Double click on L_S_RANGE-LOW, to see values populated in it can be seen on right hand side. Here the date can to be changed to be the required future date. & then press F5 to continue further processing.

Step 9: Once the variable code is debugged press F8 to go to variable selection screen pop-up. Here enter selections as per requirement & execute the query.

In case of any other variable populating the date through customer exit in istep2, for which already break-point has been inserted istep2. The ABAP debugger session will occur for debugging of second variable.

Now repeat the steps for step 1 to step 9 & change the date to required future date of this variable also. Note that both dates should be same else the query dates will mismatch & desired result will not be displayed.

Detailed explanation with example

Consider following query, which has 2 text variables populating dates in columns for current year as well as for future (year >= 2011).Now to view how the report will look like in year 2011 and years after that.



 

Note: Entitled for future, taken in future & available in future fields will be displayed only after year 2009 for leave type 3 as they are the leaves only in 2009 & we have to show status of these leave in coming years.

Variable details:

source code:

 

 
From the above table it is clear that till 2010 report will show data of year 2008 hence those hours for leave type 3 are already shown but in year 2011 report will not show data of 2008 hence hours of leave type 3 will not be displayed. Now as per our functional requirement we need to display leave type 3 hours in future also independent of their status. Hence the 3 fields for future will be displayed only after year 2011 onwards.

In example query, I have 2 text variables populating system date and running the report.
ZST_YR1 written in istep1 and ZLT03 written in istep2
You can execute the query and view the output for current date.
PFB the output: Following employees have data of year 2008 onwards hence previous year's data is not displayed.



 


 

Step 1: Go to SE38


Step 2: Press "Display" button.

Step 3: Find (Ctr F) variable which will be populating system date in your report.

Step 4: Insert a break-point. The break point can be inserter by the red button seen on the TOP <highlighted one>

Note: Insert break-point where you have condition which will take system data & populate into some local variable or say L_S_RANGE-LOW.

 

Step 5: Go to transaction /oRSRT (/o is for new session)
Enter query technical name.

 
Press Execute.
Step 6: Once you press Execute, you will be connected to an ABAP Debugger session.
For example: see below is a sample code for a text variable populating system data in L_S_RANGE-LOW

 
Step 7: Press F5 for proceeding STEP BY STEP.
Step 8: Double click on L_S_RANGE-LOW so that on right hand side you can see values populating in it.

 
After the STEP MOVE SY-DATUM (4) TO L_S_RANGE-LOW when you press F5,
You can see that current year is populated in L_S_RANGE-LOW

Double click on modify i.e. the Pencil button, change the year to future year say 2011, and press enter.

 Step 9: Then Press F5 once and then Press F8 till you get Variable Screen Pop-up.
For example: See the selection screen in the following screen shot. This screen pops up when there are user entry variables in a query.



Enter the required selections and press Execute button.
Step 11: Here if you have another variable populating system date in iSTEP2
Then session will again connect to ABAP debugger as istep2 comes after the variable entry.

Here perform same set of steps as above and edit the current date with future date.

I have a variable ZLT03 in istep2.

  Double click on pencil sign and edit value, make it 2011.

Press enter and then F8.

Step 12: Then you will get the output as if the report was run for future date.

 In above output data for year future means data of year 2008 for leave type 3 is displayed.
These Employee numbers does not have any data for year 2009, 2010 and 2011 hence this data is also not displayed.
PFB the output for Employee number144952 which has data for year 2009 also


Related Content

Related Documents

Insert SAP Help links or other WIKI content

Related Notes

Insert links to any related notes/KBA that support your topic or are related

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bw_bex/~form/handler%7B5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d343131313235%7D

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bw_bex/~form/handler%7B5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d313535373530%7D