‎2005 Mar 23 12:56 PM
Hi ALl,
Can any one tell me how to upload a flat file (field separator is pipe |) using the FM GUI_UPLOAD.
And than how to split the fields into there corresponding table-fields.
Thanks in advance.
regards
satish.
‎2005 Mar 23 1:25 PM
Upload the flat file into a flat itab using the GUI_UPLOAD.
Types: Begin of ttab,
rec(1000) type c,
end of ttab.
data: itab type table of ttab with header line.After you have the data in the flat itab. Loop thru it and split at the pipe(|). Update another itab with your data.
data: Begin of itab2 occurs 0,
field1(10) type c,
field2(10) type c,
field3(10) type c,
endo of itab2.
Loop at itab.
split itab-rec at '|' into itab2-field1
itab2-field2
itab2-field3.
append itab2.
endloop.Regards,
Rich Heilman
‎2005 Mar 23 1:43 PM
Hi,
1) upload file in table ftab
2) split fields dyn. to your itab
DATA: BEGIN OF SPTAB OCCURS 0,
line type string,
END OF SPTAB.
Data : begin of itab,"your int. target table
....
loop at ftab.
split ftab at '|' into table sptab.
loop at sptab.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE itab TO <F>.
IF SY-SUBRC <> 0.
EXIT.
endif.
<f> = sptab-line.
endloop.
endloop.regards Andreas
‎2005 Mar 23 3:11 PM
Thanks for the reply.
This is for the horizontal tab separator.
CLASS CL_ABAP_CHAR_UTILITIES DEFINITION LOAD.
CONSTANTS:
CON_TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
is there any specific thing for the pipe to0.
Thanks and Regards
satish
‎2005 Mar 23 5:26 PM
There is no specific value for Pipe as there is no Unicode conversion issues. In this case simply use:
DATA: l_delimiter TYPE c LENGTH 1 VALUE '|'.
You can specify the delimiter directly for any "normal" character, by that I mean any NON-white space characters.
Tone