Sometimes in the forums, answering some questions, it’s difficult to explain where to look for errors or wrong settings. Especially, if the wrong settings might be made in any place of data flow, from a source system to a data target.
Debugging might be very time-consuming and difficult. Moreover, some BWers don’t know ABAP at all.
I’d recommend using Simulate update feature for watching the data transformation. Many BW-people aware of this tool. Though, I guess that the most of them use it for debugging only. Meanwhile, it’s a powerful tool that may help in quick identification of the place of trouble without debugging.
I’ll demonstrate it on two examples.
1. Load of master data through flexible infosource with multiple data targets
(the whole data loading scenario you may see here):
So, we upload master data for five data targets and want to see how data is transformed during the loading process. Immediately after data load we go from the infopackage to the ‘Details’ tab of the monitor.
The monitors’ entries contain a lot of information, especially concerning the data flow within the BW system.
If there are no errors, expand all nodes under ‘Processing (data packet)’ node. On the picture below we see that the loading process has updated five data targets simultaneously.
Select any data package and from the context menu choose ‘Simulate update’.
Do not check any flags, just hit ‘Perform Simulation’ button.
Choose a data package to do a simulation.
Pay attention to the screen name each time you proceed further.
We came to the transfer structure (it’s like a replica of datasource structure in the source system).
As you can see, the Address Line 1 columns contains the long text, the next column – some figures (most likely – garbage), and two next columns are empty.
There is also a ‘Start Routine’ button (the icon shows that it is a routine in transfer rules). Click on it or on a ‘Target Records’ button.
This screen shows the data transformation after the start routine in transfer rules has worked out, but before the transfer rules. Note, that the last three columns now contain some text.
Go to the code of the start routine in transfer rules and see that this routine cuts out the long text and places peaces of it in these last columns.
Now, select any row and hit the ‘Target Records’ button.
We are in the communication structure (after the work of transfer rules). Careful comparison with the previous picture shows that something is added to the beginning of the fields in Address Line 1 column.
Go to transfer rules and see that the transfer rule for this field has a routine. In the routine’s code we see that to the field a group code is added (just for demonstration purposes):
DATA: addrl LIKE TRAN_STRUCTURE-ADDR_LINE1.
addrl = TRAN_STRUCTURE-ADDR_LINE1.
addrl(3) = TRAN_STRUCTURE-/BIC/ZGROUP_1.
RESULT = addrl.
Now press the ‘Target Records’ button at the bottom of the frame.
We arrived to the data target records screen.
See, that there was no start routine in update rules (no appropriate button). Just update rules have worked out. We can go to update rules and see that all update rules have transferred data from the communication structure to the data targets as 1 to 1.
In this case there were many data targets. By default the simulate/update process bring us to the first one in the scheduler’s list of data targets. In order to track data flow transformation for a particular data target we need to uncheck the other data targets in the scheduler, repeat the load and then go to simulate/update option for a particular (checked) data target.
2. Load of transaction data.
The second way of reaching the discussed option is through PSA area in RSA1. Locate the PSA for our load and choose from the context menu ‘Simulate/Cancel Update’ option.
We are, again, in the monitor. Repeat the steps described earlier.
After not ticking any debug flags we receive a message about changing the number of data records in a start routine.
It’s a clear indication of a start routine existence.
So, we came to the transfer structure.
The icon on the button for a start routine shows that there is a start routine in update rules.
But, first we want to see what is coming into a communication structure. Hence, we select one row and hit the ‘Target Records’ button.
We see that this record came to the communication structure unchanged. Now press the ‘Target Records’ at the bottom of the screen again.
We see that after the start routine the record has been duplicated. The second row has EURO currency. It’s time to look at the routine itself.
DATA: wa_temp TYPE DATA_PACKAGE_STRUCTURE OCCURS 0 WITH HEADER LINE.
wa_temp = DATA_PACKAGE.
LOOP AT wa_temp.
wa_temp-AMOUNT = wa_temp-AMOUNT * 2.
wa_temp-CURRENCY = 'EUR'.
APPEND LINES OF wa_temp TO DATA_PACKAGE.
clearly shows that in fact, here another record in EURO was added (with pseudo currency translation).
Note: the code was taken from the thread:
Later Mark Bernard posted there the more efficient code (if anyone interested in records duplication code).
Finally, by pressing ‘Target Records’ button again, we are brought to the records in the data target. Since we don’t see any transformation in data, we don’t need to look at update rules.
Hope, I have demonstrated that not always you have to debug the code, the Simulate/update feature may help you to figure out fast where the (undesired) data transformation may take place.