I had created while loop to extract the data from SAP BSEG table on weekly basis for certain time period, and this time period I am regulating using the start_date and end_date and weekly time period I am regulating using start_of _loop and end_of_loop.
for example if
start_date= ‘2011.01.01’
end_date= ‘2011.01.31’
then it enters the loop 4 times. and start_of_loop and end _of _loop values changes 4 times to cover the specified start_date and end_date.
This while loop is working fine.
Now I have a dataflow inside the while loop and this dataflow contains an ABAP dataflow to read the bseg data on weekly basis and since it is an ABAP dataflow I am using an abap transport.
Now when I execute the job, job is looping correctly and in the job log it displays the correct no of rows it is reading on the weekly basis, but at the completion of job the target table contains data only from the last loop means data only from the last week of the specified time period instead of the data from all the 4 loops it enters.
Note: Target table is getting truncate only once before the start of loop.
I am sorry I won’t be able to provide the log file from jobserver log files folder as I don’t have access to it, I have not set delete data before truncating the table becuase it is a temperory table and not permanent table.
I have attached the screenshots of the steps I followed. please do let me know if I can provide any more information…
thanks in advance for helping me out. I really stuck with it for quite a while now.
I am really thankful to this wonderful forum…not seen any other forum responsing so quick and so sincerity…hat’s off to you guys! BSEG_ABAP_JobLog.doc (398.0 KB)
In the ABAP Transport???
I believe you are saying TMP_XRX_BSEG_DATA is enabled that option…
Okay that option makes the Table to hold only the Data from the Last Run… TEMP Table’s scope is only to the DF. So in your Snap you basically invoke the DF 4 times and it contains data for the 4th time only.
So do this.
Remove the options “Drop & Recreate Table” & “Delete data from table before loading”
Create a Script after the WHILE Loop and write a Script to manually drop that table
SQL(‘DS_TARGET_REPORTING’,‘DROP TABLE DS_REPORTING.TMP_XRX_BSEG_DATA’); – Modify this script suitably to your DB Environment…
I hope this should hold all 4 runs data.
But one thing I want you to try is, when the job runs for the 2nd time, is it creating that table or how that behaves???
Luckly I had written a document on how to create an ABAP data flow, It is actually extracting data from TBSTL table, instead of which you can use BSEG table… in my case BSEG table is having millions of records in it so I execute this ABAP data flow in a while loop where I am extracting data on weekly basis…
and then I had written another dataflow which do the insert and update based on the data we got from ABAP data flow.