Skip to Content

dynamic table select


i am creating bdocs and send them to CRM. To select the Data, i was trying to use the CURSOR-Statement. Well i figured out, that curser gets reseted in the process and so i cant use it.

Now im looking for a dynamic possibility to select data from tables similar to the cursor.

is there a fm i can give a tablename and blocksize so it is returning me small blocks of data each call? (without using intern cursor statement ). the data tables can also be very large ( > 20 mio entries) so FMs like RFC_READ_TABLE have too bad performance.

If there is no FM / Method like this. how to do a dynamic select, with dynamic table and where clause so i can get small blocks of any table, sending them and then selecting the next block. Like saving the last row's key fields and putting them into the where clause of next select in loop. so i get only the new values.

can you help me out with this? 😊

I hoping there are some FMs... because im looking for an easy solution 😉


Stefan Seeburger

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • author's profile photo
    Former Member
    Posted on Apr 15, 2016 at 09:34 AM

    All you describe sounds like: Use a cursor.

    Well, so I want take another view on the problem. Have you already analyzed why the cursor is reseted? Maybe you can avoid the reset and your cursor approach works well.

    Add comment
    10|10000 characters needed characters exceeded

    • I'm not familiar with your exact scenario, but looking at a where-used-list for CRS_SEND_TO_SERVER I found (among many others) function module CRS_TEXT_EXTRAKT.

      This seems to circumvent the issue by selecting portions from STXH with option ORDER BY PRIMARY KEY and a WHERE-clause composed from the last key values of the previously processed portion. Maybe you can deploy something similar for your particular task.

      Not sure though how this compares in terms of runtime to a OPEN CURSOR / FETCH construct.


  • Posted on Apr 18, 2016 at 03:28 PM

    Hi all,

    i found a solution - Regarding my other post:


    i also had the feeling background-processing could help, but wasnt able to call the FM this way. now its working.

    sadly i found nothing to do a dynamic select. but its fine for me since dynamic select was only plan B.

    thanks for your help anyway.


    Stefan Seeburger

    Add comment
    10|10000 characters needed characters exceeded