‎2008 Dec 18 3:56 AM
hai,
in gui_upload function module ,field separator has '#' used for tab space between records in flatfile. i need to know where they declared tab= '#' and what are the other way to give field separator.
‎2008 Dec 18 4:05 AM
Hi Muthu Raman,
Try this alternative.
First make entries into an excel file(without header line) and then save it as TEXT DELIMITED file type.
This will result in a text file with fields separated by tabs and records in different lines.
Make sure that you have the same order of field entries in flat file as in the internal table.
You can now use this code for uploading data from a flat file into the internal table and use as per your requirements.
TYPES : BEGIN OF VENDOR,
LIFNR LIKE RF02K-LIFNR,
BUKRS LIKE RF02K-BUKRS,
EKORG LIKE RF02K-EKORG,
KTOKK LIKE RF02K-KTOKK,
ANRED LIKE LFA1-ANRED,
NAME1 LIKE LFA1-NAME1,
SORTL LIKE LFA1-SORTL,
LAND1 LIKE LFA1-LAND1,
SPRAS LIKE LFA1-SPRAS,
WAERS LIKE LFM1-WAERS,
END OF VENDOR.
DATA : VENDOR_TAB TYPE STANDARD TABLE OF VENDOR INITIAL SIZE 10 WITH HEADER LINE.
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD' "uploads the internal table from flat file
EXPORTING
FILENAME = 'c:\vendors.txt'
FILETYPE = 'DAT'
TABLES
DATA_TAB = VENDOR_TAB "internal table
This will populate the flat file records into the internal table.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir
‎2008 Dec 18 4:05 AM
Hi Muthu Raman,
Try this alternative.
First make entries into an excel file(without header line) and then save it as TEXT DELIMITED file type.
This will result in a text file with fields separated by tabs and records in different lines.
Make sure that you have the same order of field entries in flat file as in the internal table.
You can now use this code for uploading data from a flat file into the internal table and use as per your requirements.
TYPES : BEGIN OF VENDOR,
LIFNR LIKE RF02K-LIFNR,
BUKRS LIKE RF02K-BUKRS,
EKORG LIKE RF02K-EKORG,
KTOKK LIKE RF02K-KTOKK,
ANRED LIKE LFA1-ANRED,
NAME1 LIKE LFA1-NAME1,
SORTL LIKE LFA1-SORTL,
LAND1 LIKE LFA1-LAND1,
SPRAS LIKE LFA1-SPRAS,
WAERS LIKE LFM1-WAERS,
END OF VENDOR.
DATA : VENDOR_TAB TYPE STANDARD TABLE OF VENDOR INITIAL SIZE 10 WITH HEADER LINE.
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD' "uploads the internal table from flat file
EXPORTING
FILENAME = 'c:\vendors.txt'
FILETYPE = 'DAT'
TABLES
DATA_TAB = VENDOR_TAB "internal table
This will populate the flat file records into the internal table.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir
‎2008 Dec 18 4:30 AM