Downlaod file in Application server in tab delimited format
Hello,
Any sample code on the above Mentioned topic or any help plz....
Thanks in Advance
Dear Raja,
first get your data in one internal table. Also you need to have path to your application server. then use below code to download same.
*p_file - File name with path to application server.
*itab - internal table with your data.
OPEN DATASET: P_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT .
LOOP AT ITAB.
TRANSFER ITAB TO P_FILE.
ENDLOOP.
CLOSE DATASET: P_FILE.
If any more clarification needed do mail me.
Raj
Similar Messages
-
Application Server Download - Tab Delimited Text File
Hi,
I am trying to create a tab delimited text file in application server. Is there any option should i use with the Open Dataset / Transfer statements? My requirement is to download the file (Text - Tab Delimited) into Excel for further analysis. Can you please suggest me a suitable solution for this?
Thanks,
Kannan.Hi,
You can use transactions CG3Y and CG3Z. Its very simple.
Refer sample code:
constants: c_split TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
c_path TYPE VALUE char100 '/local/data/interface/A28/DM/OUT'.
*& Form f1001_browse_appl_file
Pick up the file path for the file in the application server
FORM f1001_browse_appl_file .
DATA: lcl_directory TYPE char128.
lcl_directory = p_direct.
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
EXPORTING
directory = lcl_directory
filemask = c_mask
IMPORTING
serverfile = p_f2
EXCEPTIONS
canceled_by_user = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE s000 WITH text-039.
EXIT.
ENDIF.
ENDFORM. " f1001_browse_appl_file
*& Form f1004_app_file
upload the file from the application server
FORM f1004_app_file .
REFRESH: i_input.
OPEN DATASET p_f2 IN TEXT MODE ENCODING DEFAULT FOR INPUT.
IF sy-subrc EQ 0.
DO.
READ DATASET p_f2 INTO wa_input_rec.
IF sy-subrc 0.
MESSAGE s000 WITH text-030.
EXIT.
ENDIF.
o
+ Split The CSV record into Work Area
PERFORM f0025_record_split.
o
+ Populate internal table.
APPEND wa_input TO i_input.
CLEAR wa_input.
ENDDO.
ENDIF.
ENDFORM. " f1004_app_file
*& Form f0025_record_split
Move the assembly layer file into the work area
FORM f0025_record_split .
CLEAR wa_input.
SPLIT wa_input_rec AT c_split INTO
wa_input-legacykey
wa_input-profile_role
wa_input-read_date.
ENDFORM. " f0025_record_split
DO your manipulation with the data records here.
Popualte data into final internal table and write it back to application server at the desired path.
*& Form f0020_write_application
Write error log to application Server
FORM f0020_write_application .
IF p_f1 IS NOT INITIAL.
CONCATENATE p_direct p_obj sy-datum text-037 INTO p_f2.
ELSEIF p_f2 IS NOT INITIAL.
REPLACE text-036 IN p_f2 WITH text-037.
ENDIF.
OPEN DATASET p_f2 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc 0.
EXIT.
ENDIF.
LOOP AT i_error INTO wa_error.
TRANSFER wa_error TO p_f2.
IF sy-subrc 0.
EXIT.
ENDIF.
CLEAR wa_error.
ENDLOOP.
CLOSE DATASET p_f2.
ENDFORM. " f0020_write_application
HTH,
Regards,
Dhruv Shah -
Download the file in Presentation server with TAB Delimited
Hi,
I have to download the data of the finla internal table in presentation servr.
The oup put file should be TAB Delimited. I can do the same with using LOOP.
Is there any class or FM to do the same so that the out put file can be TAB Delimited.
SandeepHI,
you can use the fm
GUI_DOWNLOAD
in that if you see the
WRITE_FIELD_SEPARATOR - the import parameter, you can use this
so that the fille will be downloaded with tab delimited.
Regards,
Venkatesh -
Error in Downloading the Text file on Application Server
Hi All,
I am working on ECC6.0. I have written a program in whcih I am downloading the text file on
application server in UTF-8 format. However when I am opening this file in Excel I am getting
garbage value for some characters(as Excel does not support UTF-8 format). So now I
want to download the data on application server in text file in non unicode format(Like ANSI or
other non unicode format) which is supported by excel. When I am writing the code as
OPEN DATASET DN_FILE FOR OUTPUT IN LEGACY TEXT MODE it is giving me dump saying
CHARACTER CONVERSION FROM CODE PAGE '4102' to CODEPAGE '1100' NOT POSSIBLE.
Same in case if I add the code OPEN DATASET DN_FILE FOR OUTPUT IN LEGACY TEXT
MODE CODE PAGE '8000' is also giving dump.
So please let me know how can I download the file in non unicode format ?
Any help would be greatly appricated.
Thanks & Regards
Jitendra Gujarathi.OPEN DATASET l_filename FOR INPUT IN TEXT MODE ENCODING NON-UNICODE IGNORING CONVERSION ERRORS.
CHECK sy-subrc EQ 0.
DO.
CLEAR wa_file_content.
READ DATASET l_filename INTO wa_file_content.
IF sy-subrc EQ 0.
APPEND wa_file_content TO it_file_content.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET l_filename.
t_filedata[] = it_file_content[].
can you use like this. -
Read Tab delimited File from Application server
Hi Experts,
I am facing problem while reading file from Application server.
File in Application server is stored as follows, The below file is a tab delimited file.
##K#U#N#N#R###T#I#T#L#E###N#A#M#E#1###N#A#M#E#2###N#A#M#E#3###N#A#M#E#4###S#O#R#T#1###S#O#R#T#2###N#A#M#E#_#C#O###S#T#R#_#S#U#P#P#L#1###S#T#R#_#S#U#P#P#L#2###S#T#R#E#E#T###H#O#U#S#E#_#N#U#M#1
i have downloaded this file from Application server using Transaction CG3Y. the Downloaded file is a tab delimited file and i could not see "#' in the file,
The code is as Below.
c_split TYPE abap_char1 VALUE cl_abap_char_utilities=>horizontal_tab.
here i am using IGNORING CONVERSION ERRORS in order to avoid Conversion Error Short Dump.
OPEN DATASET wa_filename-file FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.
IF sy-subrc = 0.
WRITE : /,'...Processing file - ', wa_filename-file.
DO.
Read the contents of file
READ DATASET wa_filename-file INTO wa_file-data.
IF sy-subrc = 0.
SPLIT wa_file-data AT c_split INTO wa_adrc_2-kunnr
wa_adrc_2-title
wa_adrc_2-name1
wa_adrc_2-name2
wa_adrc_2-name3
wa_adrc_2-name4
wa_adrc_2-name_co
wa_adrc_2-city1
wa_adrc_2-city2
wa_adrc_2-regiogroup
wa_adrc_2-post_code1
wa_adrc_2-post_code2
wa_adrc_2-po_box
wa_adrc_2-po_box_loc
wa_adrc_2-transpzone
wa_adrc_2-street
wa_adrc_2-house_num1
wa_adrc_2-house_num2
wa_adrc_2-str_suppl1
wa_adrc_2-str_suppl2
wa_adrc_2-country
wa_adrc_2-langu
wa_adrc_2-region
wa_adrc_2-sort1
wa_adrc_2-sort2
wa_adrc_2-deflt_comm
wa_adrc_2-tel_number
wa_adrc_2-tel_extens
wa_adrc_2-fax_number
wa_adrc_2-fax_extens
wa_adrc_2-taxjurcode.
WA_FILE-DATA is having below values
##K#U#N#N#R###T#I#T#L#E###N#A#M#E#1###N#A#M#E#2###N#A#M#E#3###N#A#M#E#4###S#O#R#T#1###S#O#R#T#2###N#A#M#E#_#C#O###S#T#R#_#S#U#P#P#L#1###S#T#R#_#S#U#P#P#L#2###S#T#R#E#E#T###H#O#U#S#E#_#N#U#M#1
And this is split by tab delimited and moved to other variables as shown above.
Please guide me how to read the contents without "#' from the file.
I have tried all possible ways and unable to get solution.
Thanks,
ShrikanthHi ,
In ECC 6 if all the unicode patches are applied then UTF 16 will defintly work..
More over i would suggest you to ist replace # with some other * or , and then try to see in debugging if any further # appears..
and no # appears then try to split now.
if even now the # appears after replace statement then try to find out what exactly is it... wheather it is a horizantal tab etc....
and then again try to replace it and then split..
Please follow the process untill all the # are replaced...
This should work for you..
Let me know if you further face any issue...
Regards
Satish Boguda -
Reading tab delimited file from application server
Hi All,
I do know that we need to use Open data set to read a file from application server, but my question is when you use read DATASET v_file into wa_final - this wa_final is an work area and also i have mentione an internal table. so do we need to Split the record at tab into the corresponding fields. Append the records into an internal table i_input.????
Please let me know on this....
thanks in advance....
Poonam....Hi,
first see the file contents in application server, how the contents whether the contents seperated by any symbol or not, if the contents seperated by any symbol then you have to split the data before appending to internal table.
check this code.
DATA: l_data_string TYPE string.
filename = p_file.
OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
DO.
READ DATASET filename INTO l_data_string.
IF sy-subrc NE 0.
EXIT.
ENDIF.
CLEAR k_input.
SPLIT l_data_string AT '#' INTO k_input-agreement k_input-suffix k_input-status
k_input-first_name k_input-last_name k_input-job_title k_input-tel k_input-fax k_input-email_address k_input-mob_number.
APPEND k_input TO i_input.
ENDDO.
ENDIF.
Regards,
Venu -
Problem while uploading file from application server to internal tab in BG
Hi all,
When i see the file in application server.data is like this
#################00\);_(#####}#-#}###############################00\);_(#####}#-#}###############################00\);_(*#####}#-#}#########
###################}###}#############A#############???#00\);_(*#################;_(@_) ########???# ########???# ########???###
#######???#########}###}#############)##############}##00\);_(*#################;_(@_) ############ ############ ##############
###################}#A#}#############:##############}##00\);_(#################;_(@_) }###}##############################00\);_(*##########
#######???#########}#-#}#############F#################00\);_(#####}###}#############@#################00\);_(#################;_(@_) #####
###################}#-#}#############3#################00\);_(#####}#U#}#############E#################00\);_(#################;_(@_) #####
Because the csv which is uploaded has dropdowns and some formattings.
when download from tcode cg3y i am getting correct file
When try to use open(binary mode) and read dataset i getting data as it is (junk).
i need to process in background.
Any help.
Rhea.upload file to string format
begin of ty_tab,
string type char200,
end of ty_tab.
loop at ty_tab into string
use statement replace string into tab deliminated fromat(particular occurance in string)
now call class to break string at tab into fields
endloop.
DATA : BEGIN OF i_data OCCURS 0,
data(200) TYPE c, "To hold Upload file data
END OF i_data.
OPEN DATASET v_str FOR INPUT
IN TEXT MODE
ENCODING DEFAULT IGNORING CONVERSION ERRORS.
IF sy-subrc EQ 0.
DO.
*Read a line from input file
READ DATASET v_str INTO i_data-data.
IF sy-subrc NE 0.
EXIT.
ENDIF.
*Append record to an internal table
APPEND i_data.
CLEAR: i_data.
ENDDO.
*Close the file
CLOSE DATASET v_str.
*---Start of inserti
LOOP AT i_data.
REPLACE ALL OCCURRENCES OF '"' IN i_data WITH '#'.
SPLIT i_data AT cl_abap_char_utilities=>horizontal_tab
INTO i_doc-pvaudt
i_doc-pvpate
i_doc-vecatc
i_doc-vhvend
i_doc-vhidt8
i_doc-vhinvn
i_doc-vhhexp
i_doc-vhiref. -
Pipe delimited file on application server.
Hi , i m creating a text file on application server, i have written below code and file is getting created correctly. however, i want to create pipe delimited file. is there any method for this?
DATA : lv_line(173).
DATA : l_wa_itab_length(4) TYPE c VALUE '173'.
IF NOT p_tab[] IS INITIAL.
SORT p_tab.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE.
IF sy-subrc NE 0.
MESSAGE 'Error on output file read' TYPE 'E'.
ELSE.
LOOP AT p_tab.
lv_line = p_tab.
TRANSFER lv_line TO p_file LENGTH l_wa_itab_length.
CLEAR p_tab.
CLEAR lv_line.
ENDLOOP.
CLOSE DATASET p_file.
ENDIF.
ENDIF.
REFRESH p_tab.i m pasting below my entire code.
REPORT zmigration_data_download.
FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE.
DATA: d_table_ref TYPE REF TO data.
DATA: d_rfc_db_opt TYPE rfc_db_opt.
DATA: it_opt LIKE rfc_db_opt OCCURS 0 WITH HEADER LINE.
DATA: d_file TYPE string.
PARAMETERS: p_tab TYPE dd02l-tabname OBLIGATORY.
PARAMETERS: p_file LIKE rlgrap-filename OBLIGATORY DEFAULT '/usr/sap/tmp/test.txt'.
SELECT-OPTIONS: s_opt FOR d_rfc_db_opt NO INTERVALS.
START-OF-SELECTION.
REFRESH it_opt.
LOOP AT s_opt WHERE sign = 'I' OR option = 'EQ'.
it_opt-text = s_opt-low.
APPEND it_opt.
ENDLOOP.
CREATE DATA d_table_ref TYPE TABLE OF (p_tab).
UNASSIGN <fs_table>.
ASSIGN d_table_ref->* TO <fs_table>.
IF <fs_table> IS ASSIGNED.
CLEAR <fs_table>.
SELECT * FROM (p_tab) INTO TABLE <fs_table>
WHERE (it_opt).
IF sy-subrc EQ 0.
PERFORM download_file TABLES <fs_table> USING p_file.
MESSAGE i398(00) WITH 'Upload from SAP Successfull'.
ENDIF.
ENDIF.
*& Form download_file
text
-->P_<FS_TABLE> text
-->P_P_FILE text
FORM download_file TABLES p_tab USING p_file.
DATA : lv_line(173).
DATA : l_wa_itab_length(4) TYPE c VALUE '173'.
IF NOT p_tab[] IS INITIAL.
SORT p_tab.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE.
IF sy-subrc NE 0.
MESSAGE 'Error on output file read' TYPE 'E'.
ELSE.
LOOP AT p_tab.
lv_line = p_tab.
TRANSFER lv_line TO p_file LENGTH l_wa_itab_length.
CLEAR p_tab.
CLEAR lv_line.
ENDLOOP.
CLOSE DATASET p_file.
ENDIF.
ENDIF.
REFRESH p_tab.
ENDFORM. " download_file -
Need a pipe delimiter after every field in the file on application server
Hi ,
i have to transport data in internal table to a file on application server.
I have done this successfully. But the problem is i have to put a pipe
delimiter after every field in the file on application server.
Could yoe plz help in this issue.
Thanks & Regards
Suresh kumar DHi Should,
I think the below code should solve your problem as i also had a similar type of requirement and this was the code i had used in my program.
FIELD-SYMBOLS: <FS> TYPE ANY.
DATA: L_FLINE TYPE STRING.
Open file for output
M_CHECK_SELSCR_FNMS O1 O.
LOOP AT I_TARGET.
Write records to file
DO.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE I_TARGET TO <FS>.
IF SY-SUBRC EQ 0.
IF SY-INDEX EQ 1.
MOVE <FS> TO L_FLINE.
ELSEIF <FS> NE C_PIPE.
CONCATENATE L_FLINE C_PIPE <FS> INTO L_FLINE.
ELSE.
CONCATENATE L_FLINE <FS> INTO L_FLINE.
ENDIF.
ELSE.
TRANSFER L_FLINE TO W_SRVR_NM_O_O1.
EXIT.
ENDIF.
ENDDO.
ENDLOOP.
Close file
CLOSE DATASET W_SRVR_NM_O_O1.
IF SY-SUBRC EQ 0.
MESSAGE S208(00) WITH TEXT-M02.
ENDIF.
Regards
Sikha -
File from application server -Read and process and delete the file .
Hi All,
I writing a ZEE program which will read the file from application server(file will be in text delimat format) and moving the data to internal table and uploadind data base.The part which iam facing problem is -
> I hve read the file from application server like below ,
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
EXIT.
ELSE.
DO.
CLEAR: wa_string, wa_uploadtxt.
READ DATASET ld_file INTO wa_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
wa_uploadtxt-name2
wa_uploadtxt-age.
Spliting part i having problem .i need to seperate each field which is seperate from tab delimite and pass it into respective fields of internal table .
Second if another file come to the appicaltion server , wether my first file will be there ? or should i need to delete the first file after redaing how should i proceed further ?.
Regards
SRIRAM...
THANKS In ADVANCEHI,
1.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
EXIT.
ELSE.
DO.
CLEAR: wa_string, wa_uploadtxt.
READ DATASET ld_file INTO wa_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT wa_string AT cl_abap_char_utilities=>horizontal_tab INTO wa_uploadtxt-name1
wa_uploadtxt-name2
wa_uploadtxt-age.
APPEND wa_uploadtxt TO itab.
ENDDO.
CLOSE DATASET ld_file.
ENDIF.
2. If the another file get's generated in the application server with same file name then the data in old file get's over written with the new data. You are not required to delete the file. -
Problem of Delete and Overwrite XLS file on Application Server
Hi Experts,
I want to transfer file on application server using below code and try to delete after successfully transfer on application file to other location.
I have problem during deleting file and overwrite file.
DATA: G_S_FILE TYPE EPSFILNAM,
G_S_DIR TYPE EPSDIRNAM,
G_T_FILE TYPE EPSFILNAM,
G_T_DIR TYPE EPSDIRNAM.
DATA : DELFILE(60).
G_S_FILE = '1400000051.XLS'.
G_S_DIR = '\\Dev\PO\'.
G_T_FILE = '1400000051.XLS'.
G_T_DIR = '\\Dev\PO\bkup'.
DELFILE = '\\Dev\PO\1400000051.XLS'.
CALL METHOD CL_CTS_LANGUAGE_FILE_IO=>COPY_FILES_LOCAL
EXPORTING
IM_SOURCE_FILE = G_S_FILE
IM_SOURCE_DIRECTORY = G_S_DIR
IM_TARGET_FILE = G_T_FILE
IM_TARGET_DIRECTORY = G_T_DIR
IM_OVERWRITE_MODE = 'S'
EXCEPTIONS
OPEN_INPUT_FILE_FAILED = 1
OPEN_OUTPUT_FILE_FAILED = 2
WRITE_BLOCK_FAILED = 3
READ_BLOCK_FAILED = 4
CLOSE_OUTPUT_FILE_FAILED = 5
OTHERS = 6.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
OPEN DATASET DELFILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC = 0.
DELETE DATASET DELFILE.
ELSE.
WRITE / 'File not found'.
ENDIF.
Thanks,
Himanshu Patel.Write a Java program using Apache POI that reads in a tab delimited file and outputs an xls file (in what they call Horrible Spread Sheet Format. Create your tab delimited file and then run your Java program using appropriate OS commands.
Jelena Perfiljeva wrote:
In all honesty, I find it hard to believe other application can't accept any other format. It's actually seems rather unreasonable to expect an ERP system to create a file in an outdated format of a desktop software. Even Excel itself can open many formats, so this just doesn't make any sense.
This.
Unless you can explain exactly why the destination must be xls and no other format is acceptable, I'm going to close the thread. What is this third party tool? Why can it only read the obsolete xls file format.
I'm going through this thread and rejecting all the responses that attempt a solution that isn't xls.
I'm surprised that the OP thought that simply saving with an xls file extension would cause some magic to happen and produce an actual Excel file. -
Uploading Excel File in application server
Hi,
I am uploading data from internal table to excel file in application server.I am using Open dataset to put in appln server.(background job).But the problem is it is not sitting in different colums,all data goes to single column.I want every field in separate columns.Please suggest to proceed.Hi,
save the internal table as a desktop file and then use CG3Z transaction to put the data from desktop to application server.
then to read the application file use the logic given below:
DATA: wa_file_data TYPE text4096,
lv_app_server_file TYPE string.
lv_app_server_file = pa_afile.
To read file from Application server
OPEN DATASET lv_app_server_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET lv_app_server_file INTO wa_file_data.
IF sy-subrc = 0.
APPEND wa_file_data TO gi_file_data.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET lv_app_server_file.
DATA: lv_file_separator TYPE c.
lv_file_separator = cl_abap_char_utilities=>horizontal_tab.
To upload file in other formats(CSV, Tab delimited etc)
CALL FUNCTION 'TEXT_CONVERT_TEX_TO_SAP'
EXPORTING
i_field_seperator = lv_file_separator
i_tab_raw_data = gi_file_data
TABLES
i_tab_converted_data = gi_zhralcon_file
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Hope it helps.
Regards,
Rajesh Kumar -
Placing the text file in application server
Hi all,
I am uploading the text file into application server.
the line length is 1028 characters.But in application server i am not able to see whole line.it is showing only some data and reamaining data is not coming.
Please let em know how can we increase the line length in application server.
Regards,
ShobanSE38 is the ABAP Editor transaction.
Use function module GUI_UPLOAD to create an upload the data.
*Use function module GUI_UPLOAD to create an upload the data.
Example Code >>>
REPORT zuploadtab .
PARAMETERS: p_infile LIKE rlgrap-filename
OBLIGATORY DEFAULT '/usr/sap/'..
*DATA: ld_file LIKE rlgrap-filename.
DATA: gd_file type string.
*Internal tabe to store upload data
TYPES: BEGIN OF t_record,
name1 LIKE pa0002-vorna,
name2 LIKE pa0002-name2,
age TYPE i,
END OF t_record.
DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
wa_record TYPE t_record.
*Internal table to upload data into
DATA: BEGIN OF it_datatab OCCURS 0,
row(500) TYPE c,
END OF it_datatab.
*Text version of data table
TYPES: BEGIN OF t_uploadtxt,
name1(10) TYPE c,
name2(15) TYPE c,
age(5) TYPE c,
END OF t_uploadtxt.
DATA: wa_uploadtxt TYPE t_uploadtxt.
*String value to data in initially.
DATA: wa_string(255) TYPE c.
CONSTANTS: con_tab TYPE x VALUE '09'.
*If you have Unicode check active in program attributes then you will
*need to declare constants as follows:
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INFILE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_infile.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = p_infile
mask = ',*.txt.'
mode = 'O'
title = 'Upload File'(078)
IMPORTING
filename = p_infile
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
*START-OF-SELECTION
START-OF-SELECTION.
gd_file = p_infile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gd_file
has_field_separator = 'X' "file is TAB delimited
TABLES
data_tab = it_record
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 NE 0.
write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
skip.
endif.
Alternative method, where by you split fields at each TAB after you
have returned the data. No point unless you dont have access to
GUI_UPLOAD but just included for information
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gd_file
filetype = 'ASC'
TABLES
data_tab = it_datatab "ITBL_IN_RECORD[]
EXCEPTIONS
file_open_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
ELSE.
LOOP AT it_datatab.
CLEAR: wa_string, wa_uploadtxt.
wa_string = it_datatab.
SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
wa_uploadtxt-name2
wa_uploadtxt-age.
MOVE-CORRESPONDING wa_uploadtxt TO wa_record.
APPEND wa_record TO it_record.
ENDLOOP.
ENDIF.
*END-OF-SELECTION
END-OF-SELECTION.
*!! Text data is now contained within the internal table IT_RECORD
Display report data for illustration purposes
LOOP AT it_record INTO wa_record.
WRITE:/ sy-vline,
(10) wa_record-name1, sy-vline,
(10) wa_record-name2, sy-vline,
(10) wa_record-age, sy-vline.
ENDLOOP.
Edited by: Nikhil Jathar on Jan 9, 2008 7:38 AM -
File from Application server into BW
Hi All,
I have a urgent requirement and I do not know much of ABAP
The requirement is
selecting existing file from application server Dynamically in BW server. This will be done by writing an ABAP code at the InfoPackage level in the External Data Tab but I am in need some ABAP code for the same
Also let me know which table stores AL11 files
I know USER_DIR stores directories but I required the table for the files within the directories.
Any help is appreciatedHi DPN,
If we have a condition like depending on System Date we have to get a file some thing like that then we can do that by using the ABAP Routine. But in your Scenario there are no specific conditions to select a file.
If we have some variable which stores the value which we give and gets the specified file... That Would be Great.
But in Routine we can not use Variables..(As Far As I Know)
So better Select manually every time...
Hope This Helps.
Regards,
rik. -
Move file to application server or delete a file from application server
Hi all
I have one application in which if succeful uploading of BMP file from application server is not done , File has to move to another folder like 'ERROR' Folder
but i am unable to do that.
here is the code:
CONDENSE g_t_ws_move.
CALL 'SYSTEM' ID 'COMMAND' FIELD g_t_ws_move
ID 'TAB' FIELD g_t_ws_command_line[].
where
<b>G_T_WS_MOVE= 'MOVE /Y /sapin/XVZ/journeyplan/0000000.BMP /tmp/0000000.BMP'
means i have to move 000000.bmp file from XVZ to tmp directory ,</b>Hello Neetu
Alternatively you could use a combination of the following function modules:
- EPS_FTP_PUT
- EPS_DELETE_FILE
Regards
Uwe
Maybe you are looking for
-
How to order more than 1 item from iphoto?
I just created 3 calendars and 3 photobooks and want to order all of them but it seems like I have to order them one by one and also pay for the shipment separately = 6 times.. is there anyway I could make ONE order for all my items at the same time?
-
Where is the audio waveform please?
I dont see the wave form and thus cannot expand it for some finer editing. I thought we just drag the track down and the track expanded? thanks anyone
-
Error: local logical system is not definied
Hallo, when I start transaction bd64, I got following error: "local logical system is not definied" Can anybody help me please? Regards Stefan
-
Hi Experts, I created DSO in ECC side(BW Patch) and data comes from other bw source.I transported to other ECC development system as its fails with Source System Doesn't exists and DSO is not activated.My Questions is we can't activate DSO man
-
Gigawork s700 vs logitech z5500 vs klipsch ultra 5.1
i wanna buy a set of 5.1 speakers, the purpose is to use it on pc and DVD player. i want GOOD SOUND QUALITY, LOUD and Earthquake BASS. Which brand and model is better? Gigawork s700? Logitech z5500? Klipsch ultra 5.1 or any other suggestion? Thanks a