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

Split download file into multiple files

Former Member
0 Likes
3,389

I want to split my internal table into multiple files when downloading. The split will be determined by contents of a specific field. The number of files to download can only be determined at runtime.

I want to split my internal table into multiple files when downloading. The split will be determined by contents of a specific field. The number of files to download can only be determined at runtime.

5 REPLIES 5
Read only

Former Member
0 Likes
1,566

Hi,

You can split the data and download the data in multiple files based on the specific field value...

THanks,

Naren

Read only

Former Member
0 Likes
1,566

try this...

*declare itab1 same as itab

data : filename(25).

loop at itab.

<b> move-corresponding itab to itab1.

append itab1.</b>

at end of BUKRS.

*use GUI_DOWNLOD FM here

*pass itab1 every time here

*change the filename everytime

concatenate 'Company_' itab-bukrs into filename.

<b> refresh itab1.</b>

endat.

endloop.

Read only

Former Member
0 Likes
1,566

chk this thread with the same question and same answer given by Rameshbabu Chirumamilla

Read only

Former Member
0 Likes
1,566

Hi all,

my requirement is i want to split records into multiple files not basing on the field condition but basing on the arithmetic operations..

like I have 12 records and separation no is given that is 5.Now i have to divide the records by 12 so that first 5 records go into first flatfile and next 5 to second flat file and remaining 2 records to 3rd flatfile.

Is it possible.Please help me solve this issue

Read only

0 Likes
1,566

I think you just need a counter ...

You create a 2nd itab for the file creation (collector).

You loop over the main itab and based on your rule and the sy-tabix you fill the 2nd itab, write it to the file (work station or server), refresh collector itab and continue the loop.

Write process, file creation depends on used technology.

Example solution:

****************

c_constant type i value '5'.

split type i.

v_count type i.

v_file_count.

describe itab1 lines to v_count.

loop at itab1 into wa.

split = split + 1.

move wa into wa_collector.

append wa_collector to itab2.

If split EQ c_constant

or sy-tabix EQ v_count.

v_file_count = v_file_count + 1.

< open file / export however you already planed to do it>

< Filename will be dynamic on counter and other variable choice>

clear split.

refresh itab2.

endif.

enloop.

****************

But that was a very rough an simple one.

When I would write it into the program I would change the fixed parts. And you need to check from the example if the check agains the counted entries is sufficient to write the last two entries in the thrid file.

That can be done more dynamic, based on input fields, arithmetic rules, counting of entries etc. check the mod command ect. I have done things like that often with other purpose.

BR,

P.S.: The more I check the example above, the more I think you should take it really only as an sample idea. I would indeed make it nicer with less counters etc. and some assign ...