While Loop for BSEG data

Hi ,

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.

any help will be appriciated…thanks in advance.


BOBJFan (BOB member since 2011-09-24)

Can you attach the monitor log file (file taken from the log directory)?


Werner Daehn :de: (BOB member since 2004-12-17)

Hi Werner,

here is the attached Job Log.
BSEG_ABAP_JobLog.doc (349.0 KB)


BOBJFan (BOB member since 2011-09-24)

Where have you set the DELETE Data before loading or Truncating the Table?

And would you be able to collect the MONITOR Log file from the %LINK_DIR%/log/JobServer/REPO – folder?


ganeshxp :us: (BOB member since 2008-07-17)

Hi Ganesh,

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)


BOBJFan (BOB member since 2011-09-24)

So is the option Drop & Recreate Table enabled?


ganeshxp :us: (BOB member since 2008-07-17)

In the abap data transport the replace option is ticked but I am sorry Ganesh where I need to check if drop and recreate option is ticked or not…


BOBJFan (BOB member since 2011-09-24)

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.

  1. Remove the options “Drop & Recreate Table” & “Delete data from table before loading”
  2. 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???


ganeshxp :us: (BOB member since 2008-07-17)

I got it where I should untick the drop and recreate table …thanks Ganesh…let me try it now…

It’s working now…thanks a lot Ganesh…you made my weekend…thanks a lot…I don’t know how can I be so silly…
have a wonderful weekend…!


BOBJFan (BOB member since 2011-09-24)

:cheers:


ganeshxp :us: (BOB member since 2008-07-17)

Slipped my attention as well. Well done, Ganesh!


Werner Daehn :de: (BOB member since 2004-12-17)

@rashmig: can you please send step by step approach of doing this, including scripts.

I have a similar requirement of loading BSEG table in HANA DB.

I haven’t worked much on Data Services. You help would be of great help.

Thanks


avbaby :india: (BOB member since 2009-05-09)

Hi Avbaby,

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.

hope it might be of some help to you.
RG_ABAP DATAFLOW.doc (922.0 KB)


BOBJFan (BOB member since 2011-09-24)

Greaaaatttt!!!

Thanks a lot rashmig. Wonderfully prepared document. This is certainly going to save lot of my effort. Feeling like giving you a grand treat :slight_smile:

Thanks a lot


avbaby :india: (BOB member since 2009-05-09)

thanks avbaby… I am happy that it is of some help… :slight_smile:

Rashmi


BOBJFan (BOB member since 2011-09-24)