2006 Nov 28 3:45 AM
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.
2006 Nov 28 3:50 AM
Hi,
You can split the data and download the data in multiple files based on the specific field value...
THanks,
Naren
2006 Nov 28 3:53 AM
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.
2006 Nov 28 4:02 AM
2007 Jan 09 5:13 AM
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
2007 Jan 09 8:12 PM
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 ...
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |