2010 Mar 09 11:27 AM
Hello gurus,
I need to upload a flat file but the header is the control record with the number of lines in the file, and has a diferent structure from remaining file records.
I'm using GUI_UPLOAD in ASCII mode for the flat file and my first line with the control record does not "fit" the structure of the remaining records.
Whats the best way I read diferent line structures in the flat file so I can have a counter from the first line and all other lines in an internal table?
Using GUI_UPLOAD twice with diferent internal tables will have performance degraded...
regards.
Sérgio.
Hello Suhas,
Thanks for your reply, but how do you suggest defining the initial table of string characters? What I've found is that if I define a line string and my flat file has several TAB separated fields, only the first column is uploaded to the internal table because the table only has one field. If I define several character fields to accommodate all required fields it should work but I don't believe that there is not a most efficient method in ABAP unless this one uploading all data in strings and then convert them all to the required data types.
regards.
Sérgio.
2010 Mar 09 11:31 AM
Hello,
If it is a flat file upload the file contents to an internal table of type string (DATA: ITAB TYPE STANDARD TABLE OF STRING).
Now read the 1st line which is the header & populate the remaining lines to an internal table.
BR,
Suhas
2010 Mar 09 12:51 PM
Hello Suhas,
Thanks for your reply, but how do you suggest defining the initial table of string characters? What I've found is that if I define a line string and my flat file has several TAB separated fields, only the first column is uploaded to the internal table because the table only has one field. If I define several character fields to accommodate all required fields it should work but I don't believe that there is not a most efficient method in ABAP unless this one uploading all data in strings and then convert them all to the required data types.
regards.
Sérgio.
2010 Mar 09 1:04 PM
Hi,
Declare an itab as
ITAB TYPE STANDARD TABLE OF STRING
Variable for Tab limited
data :gc_con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
pass the control record to the internal table first then.
loop at it_final into wa_final.
concatenating gc_con_tab will add TABs in your output.
CONCATENATE wa_final-f1 wa_final-f2
into ITABl separated by gc_con_tab.
append ITAB.
endloop.
Then use GUI_DOWNLOAD to download ITAB.
Regards,
Shanmugavel chandrasekaran
2010 Mar 09 1:15 PM
Hello Shanmugavel, now I'm lost... I ask about uploading a file with a diferent structure in the first record, and if there is any way to manage this eficiently in ABAP.
I think your reply is to make a download, not an upload, correct?
Thanks
Sérgio.
2010 Mar 09 1:17 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |