Tuesday, April 19, 2022

Run DTP as a job?

This is probably a quite silly idea to run the DTP scheduled as background job. However, I just started to wonder whether it is possible at all. I am aware that ever since there was a concept of a process chain introduced in BW this is not really necessary. Having the process chain it is a pretty much possible to run the DTP within that chain anytime we want with any frequency we want. Nevertheless, I still wondered - it is possible to run the DTP as a job without the chain? Let us have a look.

There is an ABAP program called RSPROCESS that can runs any BW Process. Be it Execute Data Transfer Process (DTP_LOAD), Delete Complete Data Target Contents (DROPCUBE), Activate Requests in advanced DataStore Objects (ADSOACT), Execute ABAP Program (ABAP), Execute Operating System Command (COMMAND), Activate Master Data (MDACTIVAT), any BPC process and so on. See overview of different BW tasks/objects within the SAP BW here.

Thus, a very first idea is to leverage this program and schedule it as the background job. On the program’s selection screen, here are input parameters that need to be provided:

Process Type                                                 DTP_LOAD

Process Variant                                              <DTP_tech_name>


Now the program needs to be scheduled as the background job. To do that there is an item called Execute in background in menu Program:


As a next, just accept a Background Print Parameters pop-up:


Finally enter Start date/time or event which should serve as the background job’s trigger. Once done the job will be scheduled by accepting the pop-up by save button.


There is an information message “Background job was scheduled for program RSPROCESS” confirming the job’s schedule.


Now it is possible to observe the job’s execution in t-code SM37. Depending on DTP and BW system setup there can be several jobs found:


RSPROCESS - job that ran the program RSPROCESS itself. This one started next job(s) that represents the DTP load execution.

BIDTPR_20220419211828000002_1 – generated timestamps represents the data load request ID that can be seen in DTP’s monitor (e.g. t-code RSDTP). There can be multiple of those jobs depending on size data set that is being processed, DTP’s pack size etc. 




Debugging End Routine in HANA runtime of BW Transformation

In BW’s Transformation that are set to be executed in HANA mode there is still possible to have an ABAP End Routine. Here’s a short guide on how to debug ABAP code in such End Routines.


Technically a place that where the ABAP code of the End Routine is embedded into overall code of the HAAP process is a generated ABAP class. As an example if HAAP name (variable I_HAAPNM) is TR_ZQPTTP4YE36NYCQEVA6P_A then the ABAP class name is /BIC/ZQPTTP4YE36NYCQEVA6P_A (variable R_CLASS_NAME). In that ABAP class there is a method called GLOBAL_END where it code is located.

There are two environments where such an End Routine can be debugged.

 

1. in SAP HANA Studio – First open the transformation and display the End Routine code. Do a right click on some executable ABAP statement and set the breakpoint via choosing "Toggle Breakpoint" context menu item. 


While being in BW Modeling perspective open respective DTP and via button on DTP’s toolbar called "Start execution of data transfer process" select "Simulate in Dialog" item. This action open an RSDTP t-code embedded in SAP HANA Studio. Here hit a Simulate button and continue as you would do the debugging in SAP GUI as described below.



2. in SAP GUI – The debugging is still possible in SAP GUI if one prefer to do so. While being in RSDTP t-code set a "Processing Mode" to "Serially in the Dialog Process (for Debugging)" position, check out "Expert Mode" checkbox and hit Simulate button.


Next, a following pop-up called "Debug Request" is shown. Here enable "Before Transformation" checkbox. After that run it.



After a while, an ABAP debugger screen of SAP GUI is presented. Follow to Break./Watchpoints tab of the ABAP Debugger. Create a new breakpoint here pointing to ABAP objects:



Class name       CL_RSDHAR_TGT

Method Name      IF_RSDHAR_TGT~EXTRACT

Once the new breakpoint is created, it is visible like below:



Run the debugger until the new breakpoint is reached. There may be few more stops caused by hardcoded BREAK-POINT ABAP statements until it is reached to. If the ABAP debugger finally stops at IF_RSDHAR_TGT~EXTRACT (CL_RSDHAR_TGT) breakpoint just scroll a little bit down to a place where a call of method o_execute_abap_endrout is located and place a another breakpoint there.



Once that new breakpoint at the call of method o_execute_abap_endrout is reached, you came into the point where the ABAP code of custom End Routine is executed.