2008 May 16 1:33 PM
can anybody give me the function module to upload and read the text file
can anybody give me the function module to upload and read the text file
2008 May 16 1:35 PM
2008 May 16 1:36 PM
hi
WS_UPLOAD and UPLOAD are the function modules you can use to upload a file in text format
2008 May 16 1:40 PM
Hi
To upload from the text file u can either use the funcion module
-- GUI UPLOAD and
-- UPLOAD
In these function modules you pass the name of the internal table as the parameter .
And then,
you can loop at that internal table to read the contents in the internal table.
Reward if useful.
Best Regards
2008 May 16 1:41 PM
Hi,
You can use this code to upload the text file.
DATA : v_file TYPE string.
----
SELECTION SCREEN
----
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_file TYPE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK b1.
----
AT SELECTION SCREEN ON VALUE-REQUEST
----
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = p_file.
----
START-OF-SELECTION
----
START-OF-SELECTION.
v_file = p_file.
*gui upload
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_file
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = it_vendor
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Here, wehen you press F4, it will ask to select the file.
Then you can select the file.
and after that i sued the FM GUI_UPLOAD, to insert the data into Internal table from the text file.
here this parameter is Important " has_field_separator ".
If you typing the text by giving TAB space between evry filed, you need to give "X".
And one more thing, you asked to Read the text file:
This I dint understand.
Please elaborate your requirement.
Regards
Sandeep Reddy
2008 May 16 2:59 PM
Hi Chaitra!!
For uploading text file
we use gui_upload
and for reading text
we use read_text FM.
rewrd points.
2014 Apr 10 4:52 PM
Hi,
i want to know how to use upload notepad in function modules.
what r the parameters needed to import from main program to function module program of notepad upload..
Thank You.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |