Saturday, March 24, 2012

Where used list of BW reports for characteristics


A need of knowing in which BW reports is particular characteristics used is quite common in SAP BW area. Imagine that you need to analyze BW system for e.g. for auditing purposes. 

Usually what you would do is to go to RSA1->Modeling->InfoObjects. Here you search for InfoObject and you go to its maintenance screen. In toolbar of this screen there is a Where-used button available. You hit this button and task is supposed to be completed in case you would get a list of BW reports where this InfoObject is used. Surprisingly this is not the case. You get the list of InfoProviders, Transformations, InfoObjects, Transfer Rules, 3.x InfoSource, etc. But not the reports!


What to the in this case? Luckily there is a special InfoObject transaction (RSD1) which does the same but for broader spectrum of objects. Peculiarity here is that once you are in RSD1 you cannot go via Where-Used button. This gives you the same what RSA1 gave – no reports list. What you need to do is go via menu->Edit->Where-Used List. Even more this functionality gives you a list of BE’x variables related to the InfoObject.



ABAP code which is behind this Functionality is function module RSDG_IOBJ_USAGE_SHOW.

Monitor 2 screen of DTPs

In BW of version 7.x so called monitor 2 screen has appeared. As it is not available for InfoPackages I assume it was introduced just in version 7.x. I found it by accident by right clicking in area of DTP’s maintenance screen. If you choose item MON2 from menu you get to this screen.



Screen allows browsing for another DTP and what you basically see is all the instances of this DTP. It contains status (U and T) of particular data load request, request ID, its time stamps. From here you can jump to from to monitor of this request, you can execute DTP, delete it and set its QM status to red and green.


Request status can have following values: 

0 New 
1 Executable 
2 Processed Successfully 
3 Processed with Errors 
4 Deleted 
5 Active 
6 Processed, with Warnings 
7 Further Processing Started 
8 Processed Further 
9 Deletion Started 
A Further Processing Terminated 

I was digging deeper to see what ABAP code is behind this screen. It is function module RSBK_MONITOR_SHOW what is being called here. In my eyes screen can be handy mostly for support people. I was not aware of this screen and looking forward to hear some comments from you how do you using this functionality.

Saturday, March 3, 2012

Endless loops in ABAP

I haven't updated my blog for quite long time. This is mostly because I’m currently involved in project which requires me to travel a lot. Therefore today here comes again only very short tip. To be more precise the tip will be how to code so called endless loops in ABAP. 

First let me explain what it is endless loop. It is a part of code which is being constantly executed over and over again until certain condition (there can be terminating condition or condition that is never met) is not fulfilled or loop is terminated by user. In other words we call the endless loop as infinite loop or unproductive loop.

Secondly let me explain why we (from time to time) need that. There might be situation that you need to check or monitor behavior of system while runtime of your program. Someone might say that for this I could set a breakpoint and achieve the same. Yes that would be possible but imagine you run your program as a job and within distributed SAP environment comprised from several application servers. In such a scenario you cannot be sure by which server your program will be executed. Therefore you let your program run in endless look.  Afterwards you observe on which server it runs and you switch into its runtime from e.g. TA SM50 via Debugging functionality (process, menu Program-> Debug program).  Actually in this case loop gives you a time to prepare TA50 and get into the processing of program as well.

In case of BW there are certain situations where infinite loops are handy as well. As all BW processing usually takes place on background (e.g. extraction: DTP, InfoPackages, Process Chains or BEx reporting variables programming) endless loops are needed here as well. I’m pretty sure you can figure out our examples.

Here’s one example of the endless loop:

data: debug(1).
do.
if debug = 'X'.
exit.
endif.
enddo.

If you are done with program’s environment monitoring you can easily escape this loop by manipulating with value of variable debug setting it to ’X’.

See blog on similar ABAP topic: If 1 equals 2, what’s the purpose?