11-10-2010 10:14 PM
Experts,
I have a file in app server which is having around 600,000 records, needs to be apload into SAP.
While uploading the file i am getting dump due to insufficeint memory of my ITAB.
I am getting error something like "No more storage space available for extending an internal table."
So i wanted to Change my program logic to implement block processing like read a block, process, clear internal tables, read next block, etc.
My question is how to read app server file by BLOCK wise like want to read like 100,000 in first loop and 100,001 to 200,000 in second loop and so on...
Any syntax would be a great help.
or If you could share any sample program would also be great help.
Thanks
kaki
11-11-2010 10:51 AM
HI,
Maybe this could be of any help;
DATA: l_pos TYPE i,
l_no_of_loops TYPE i,
reclen TYPE i VALUE 100,
fname(80) TYPE C.
PERFORM read_file. " Do this until EOF
FORM read_file.
l_pos = 10000 * l_no_of_loops * reclen.
OPEN DATASET fname FOR INPUT IN BINARY MODE AT POSITION l_pos.
DO 10000 TIMES.
READ DATASET fname INTO wa_ftp_table.
APPEND wa_ftp_table TO it_ftp_table.
ENDDO.
l_no_of_pos = l_no_pos + 1.
Take care of the data read into the internale table.
FREE it_ftp_table.
ENDFORM.
11-10-2010 10:25 PM
Something like:
OPEN...
DO...
if count > 10000
process itab
refresh itab
count = 0.
endif.
READ...
if sy-subrc <> 0.
exit.
endif.
ENDDO.
Rob
11-10-2010 10:45 PM
Hi Rob,
My existing code is like this. Pls help how to approach.
DO.
READ DATASET G_GET_FILE INTO FTP_FILE.
IF SY-SUBRC = 0.
APPEND FTP_FILE.
CLEAR FTP_FILE.
ELSE.
EXIT.
ENDIF.
ENDDO.
11-11-2010 5:36 AM
Hi,
If you want to read first 100 lines only .. then write as ...
DO 100 times.
READ DATASET G_GET_FILE INTO FTP_FILE.
IF SY-SUBRC = 0.
APPEND FTP_FILE.
CLEAR FTP_FILE.
ENDIF.
ENDDO.
Regards,
Srini.
11-11-2010 12:56 PM
Rob told you how to do....Surely, he doesn't need to also write the code for you.
11-11-2010 10:51 AM
HI,
Maybe this could be of any help;
DATA: l_pos TYPE i,
l_no_of_loops TYPE i,
reclen TYPE i VALUE 100,
fname(80) TYPE C.
PERFORM read_file. " Do this until EOF
FORM read_file.
l_pos = 10000 * l_no_of_loops * reclen.
OPEN DATASET fname FOR INPUT IN BINARY MODE AT POSITION l_pos.
DO 10000 TIMES.
READ DATASET fname INTO wa_ftp_table.
APPEND wa_ftp_table TO it_ftp_table.
ENDDO.
l_no_of_pos = l_no_pos + 1.
Take care of the data read into the internale table.
FREE it_ftp_table.
ENDFORM.
11-15-2010 2:49 PM
11-11-2010 11:00 AM
Have a F1 look on OPEN DATASET.
You can open a dataset at a specific position using AT POSITION.
Thus enabling you to read and process in blocks.
-
Please hug me!