Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Large Table / Export with SQL into many little files

Former Member
0 Likes
720

Hi@all,

at the moment we have a report which download many sap data tables into one big file for each table.

example: BSEG have 25 million records, so the file bseg.txt is maybe 20gigabyte large.

Is it possible to split this into 25 files with 1 million records? like "BSEG_001.txt, BSEG_002.txt...."

best regards,

alex

Hi@all,

at the moment we have a report which download many sap data tables into one big file for each table.

example: BSEG have 25 million records, so the file bseg.txt is maybe 20gigabyte large.

Is it possible to split this into 25 files with 1 million records? like "BSEG_001.txt, BSEG_002.txt...."

best regards,

alex

2 REPLIES 2
Read only

venkat_o
Active Contributor
0 Likes
588

Hi, <li>There is one statement called OPEN CURSOR , you can use that . <li>Try this test program.


 REPORT ztest_notepad.
DATA:it_nfal     TYPE STANDARD TABLE OF nfal WITH HEADER LINE.
DATA:c1          TYPE cursor.
DATA:flag        TYPE c.
DATA:no_of_lines TYPE i VALUE '1000'.

START-OF-SELECTION.
OPEN CURSOR:c1 FOR SELECT * FROM nfal.
DO.
  IF flag NE 'X'.
    FETCH NEXT CURSOR c1 APPENDING TABLE it_nfal PACKAGE SIZE no_of_lines.
    IF sy-subrc <> 0.
      CLOSE CURSOR c1.
      flag = 'X'.
    ENDIF.
  ENDIF.
  IF flag = 'X'.
    EXIT.
  ENDIF.
ENDDO. 
Thanks Venkat.O

Read only

Former Member
0 Likes
588

The OPEN CURSOR approach will run into difficulties if there are any COMMITs (may be implied) in the code.

Rob