Reading file from App. Server - Problem.
Hi All
While Reading a file from Application Server into the Presentation Server, in a Notepad its coming fine(Data is coming in a Multiple lines).
Problem:-
When we try to open the same file with Word Pad, Its showing in a single line. But I want the data to be in a multiple lines
Please help me ASAP.
Thanks
Niranjan.
Edited by: Niranjan Thimmareddy on Feb 28, 2009 12:15 PM
Edited by: Niranjan Thimmareddy on Feb 28, 2009 12:15 PM
Instead of reading entire file at a time.Restrict it to some length
Check this link
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3d42358411d1829f0000e829fbfe/content.htm
Similar Messages
-
Problem with READ DATASET when reading file from app server
Hi,
wondering if anyone can help, I'm using the following code to read from a file on app server, the file is of type .rtf
OPEN DATASET file_rtf FOR INPUT IN TEXT MODE
ENCODING DEFAULT
WITH SMART LINEFEED.
DO.
READ DATASET file_rtf INTO string.
IF SY-SUBRC = 0.
EXIT.
ENDIF.
ENDDO.
the open dataset part works sy-subrc = 0, but the read returns sy-subrc = 8 and no data is passed to string.
Any ideas as to what is causing this problem appreciated, <removed>
Thanks
Edited by: Thomas Zloch on Mar 17, 2010 3:57 PM - please don't offer p...Hi Adam,
The source code in the below link has details about how to read/write to application server.
[Application server file operartions|http://www.divulgesap.com/blog.php?p=NDk=]
Please let us know if you have any issues.
Regards,
Ravi -
HowTo read file from app. server and store it in binary format (SDOKCNTBIN)
Hi
I need to upload Documents to Document Repository by using to function module RSOD_DOC_MAST_CHANGE.
My question is: How can I fill the "parameter" i_t_file_content_binary from a file which is stored on an application server.
br, michaelHi
I need to upload Documents to Document Repository by using to function module RSOD_DOC_MAST_CHANGE.
My question is: How can I fill the "parameter" i_t_file_content_binary from a file which is stored on an application server.
br, michael -
Problem in downloading file from app server using CG3Y in to .XLS fomat
hi All,
I have uploaded file in to application server through a program using open data set with the separater as "|" ( pipe ) . Now the user should be able to download the file from apps server to presenataion server in .XLS format using txn CG3Y. but when we download, the format appears wierd and the data is not consistent across columns in excel. i.e the data which is supposed to be in one column in the excel is in the other column. what precautaions should i take before moving data to apps server so that it will be downloaded in a good format.
Appreciate your help...
Regards,
Sreekanth.Separate each values with TAB space present in the application server .
Currently u r using | pipe character. Instead of that use CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB as delimiter.
Each value will displayed in separate cells in excel sheet when u download it frm app.server
Regards,
Lakshman. -
Transfer a file from App Server to a FTP site.
Hi, Abapers.
I need your help. Probably, this topic has already been posted in a similar way, but we need an answer to solve our problem.
We have to sent a PDF file from a directory of our app server (AIX) to a FTP directory... which would the FM sequence we should use to goal it?
Best Regards.Hi Santiago,
create fm to send file from APP server to FTP site.
if you want to Post file from desktop to Appl use Transaction - CG3Y
if you want to Post file from Appl to Desktop use Transaction - CG3Z
copy the code below....
* Author: Prabhudas Date: 02/21/2006 *
* Name: Z_FTP_FILE_TO_SERVER *
* Title: FTP File on R/3 Application Server to External Server *
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(DEST_HOST) TYPE C
*" REFERENCE(DEST_USER) TYPE C
*" REFERENCE(DEST_PASSWORD) TYPE C
*" REFERENCE(DEST_PATH) TYPE C
*" REFERENCE(SOURCE_PATH) TYPE C
*" REFERENCE(FILE) TYPE C
*" REFERENCE(BINARY) TYPE CHAR1 OPTIONAL
*" REFERENCE(REMOVE_FILE) TYPE CHAR1 OPTIONAL
*" TABLES
*" FTP_SESSION STRUCTURE ZMSG_TEXT OPTIONAL
*" EXCEPTIONS
*" CANNOT_CONNECT
*" SOURCE_PATH_UNKNOWN
*" DEST_PATH_UNKNOWN
*" TRANSFER_FAILED
*" COMMAND_FAILED
DATA: w_password TYPE zftppassword,
w_length TYPE i,
w_key TYPE i VALUE 26101957,
w_handle TYPE i,
w_command(500) TYPE c.
REFRESH ftp_session.
* Scramble password (new Unicode-compliant routine)
w_length = STRLEN( dest_password ).
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = dest_password
sourcelen = w_length
key = w_key
IMPORTING
destination = w_password.
* Connect to FTP destination (DEST_HOST)
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = dest_user
password = w_password
host = dest_host
rfc_destination = 'SAPFTPA'
IMPORTING
handle = w_handle
EXCEPTIONS
not_connected = 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
RAISING cannot_connect.
ENDIF.
* Optionally, specify binary file transfer
IF binary = 'X'.
w_command = 'bin'.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = w_handle
command = w_command
TABLES
data = ftp_session
EXCEPTIONS
command_error = 1
tcpip_error = 2.
IF sy-subrc <> 0.
CONCATENATE 'FTP command failed:' w_command
INTO w_command SEPARATED BY space.
MESSAGE ID 'ZW' TYPE 'E' NUMBER '042'
WITH w_command
RAISING command_failed.
ENDIF.
ENDIF.
* Navigate to source directory
CONCATENATE 'lcd' source_path INTO w_command SEPARATED BY space.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = w_handle
command = w_command
TABLES
data = ftp_session
EXCEPTIONS
command_error = 1
tcpip_error = 2.
IF sy-subrc <> 0.
CONCATENATE 'FTP command failed:' w_command
INTO w_command SEPARATED BY space.
MESSAGE ID 'ZW' TYPE 'E' NUMBER '042'
WITH w_command
RAISING source_path_unknown.
ENDIF.
* Navigate to destination directory
CONCATENATE 'cd' dest_path INTO w_command SEPARATED BY space.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = w_handle
command = w_command
TABLES
data = ftp_session
EXCEPTIONS
command_error = 1
tcpip_error = 2.
IF sy-subrc <> 0.
CONCATENATE 'FTP command failed:' w_command
INTO w_command SEPARATED BY space.
MESSAGE ID 'ZW' TYPE 'E' NUMBER '042'
WITH w_command
RAISING dest_path_unknown.
ENDIF.
* Transfer file
CONCATENATE 'put' file INTO w_command SEPARATED BY space.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = w_handle
command = w_command
TABLES
data = ftp_session
EXCEPTIONS
command_error = 1
tcpip_error = 2.
IF sy-subrc <> 0.
CONCATENATE 'FTP command failed:' w_command
INTO w_command SEPARATED BY space.
MESSAGE ID 'ZW' TYPE 'E' NUMBER '042'
WITH w_command
RAISING transfer_failed.
ENDIF.
* Disconnect from destination host
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
handle = w_handle.
* Optionally, remove file from source directory
IF remove_file = 'X'.
CONCATENATE source_path '/' file INTO w_command.
CONCATENATE 'rm' w_command INTO w_command SEPARATED BY space.
OPEN DATASET '/dev/null' FOR OUTPUT FILTER w_command.
CLOSE DATASET '/dev/null'.
ENDIF.
Regards,
Prabhudas -
Download PDF file from APP server!
Hi!
Has anyone tried uplaoding and downloding a PDF table from app server as I tried from a normal method by Open dataset, Transfer but it wont work.
Please provide any inputs.
Thanks.Hi park,
1. Using open data set, transfer , close etc,
also it will work.
( it will download / upload any kind of file from app server)
2. Just make sure the
FULL PATHNAME and the FILENAME
are mentioned in EXACT CASE
(small/CAPITAL).
3. U can check thru transaction AL11, to see the file and path.
regards,
amit m. -
System exception while deleting the file from app server in background job
Hi All,
I have a issue while the deleting the file from application server.
I am using the statement DELETE DATASET in my program to delete the file from app server.
I am able to delete the file from the app server when i run the program from app server.
When i run the same report from background job i am getting the message called System exception.
Is there any secuirity which i need to get the issue.
Thank You,
TaraginiHi All,
I get all the authorization sto delete the file from application serever.
Thing is i am able to run the program sucessfully in foreground but not in the background .
It i snot giving any short dump also just JOB is cancelled with the exception 'Job cancelled after system exception ERROR_MESSAGE'.
Can anybody please give me suggestion
Thanks,
Taragini -
Oracle read files from FTP Server
Hi,
Somebody knowns Oracle how to read files from FTP Server ? Which package I can use?Duplicate post
Oracle read files from FTP Server -
Problem in reading file from application server
while reading the file from application server i am succesful in reading from dataset but the program gets terminated giving a runtime error "CONVT_CODEPAGE".
the code written is as below :
open dataset d1 for input in text mode encoding default.
IF sy-subrc NE 0.
EXIT.
ENDIF.
do.
Read dataset d1 into btab.
if sy-subrc <> 0.
exit.
else.
condense btab NO-GAPS.
wtt_text-text1 = btab-wa+0(10).
wtt_text-text2 = btab-wa+10(1).
wtt_text-text3 = btab-wa+11(3).
append wtt_text.
clear wtt_text.
wt_counter = wt_counter + 1.
ENDIF.
enddo.
write : /10 ' number of records :'.
write : wt_counter.
kindly help me asap.
regards,
rachu.If I am not wrong you are working on a Unicode enabled system. That is why this error is coming.
Look at the link below, where the solution is provided.
http://help.sap.com/saphelp_nw2004s/helpdata/en/79/c554dcb3dc11d5993800508b6b8b11/content.htm
open dataset DSN in text mode for output encoding utf-8.
Regards,
Ravi
Note - Please close the thread by selecting PROBLEM SOLVED against the answer which helped your most, if the issue is resolved. -
Reading uploaded file from app. server
Hi All,
I am trying to upload a .csv format file to app. server thru txn CG3Z....
When i try to open the file in my code thru open dataset and read dataset ...it is giving it in the form of
30002058,1000#50055501,2000#
Now i want it to be in
30002058,1000
50055501,2000
format...
pleas suggest..
thnx
RkHi Rahul,
have you tried reading it in BINary format?
Kind regards,
Alvaro -
Dynamically Reading Files From Application Server
Hi Experts,
Presently I have to write a program which reads files from the application server dynamically. This program will be scheduled in the background with the frequency of half an hour.
I am Using the function module
CALL FUNCTION 'SUBST_GET_FILE_LIST'
EXPORTING
DIRNAME = '/usr/sap/xxx/xxx/'
FILENM = 'DATASET'
PATTERN = '.txt'
TABLES
FILE_LIST = IT_FILELIST
I am facing problem in specifying the parameter FILENM in the function module,
As I have to read many files from the apps server. How to assign the parameter of function module so it can take the many files generated in the apps server.
Thanks in Advance,
Regards,
Irfan HussainHi,
Instead of the above FM, you can use the following code :
AT SELECTION-SCREEN ON VALUE-REQUEST FOR po_ifile.
PERFORM get_current_directory USING 'PO_IFILE' po_ifile
rov-home_dir rov-curr_dir.
PERFORM get_filename-of-server TABLES itab_filename
USING rov-curr_dir rov-gen_name.
PERFORM help_values_get_with_table_ext TABLES itab_filename
USING rov-curr_dir
po_ifile.
*& Form get_current_directory
text
-->P_0023 text
-->P_PO_IFILE text
-->P_ROV_HOME_DIR text
-->P_ROV_CURR_DI text
-->P_CALL text
-->P_FUNCTION text
-->P_0029 text
-->P_IMPORTING text
-->P_FILE_NAME text
-->P_= text
-->P_PO_IFILE text
FORM get_current_directory USING _fieldname
_filename
homedir
currdir.
IF _fieldname <> space.
PERFORM dunp_value_read USING _fieldname _filename.
ENDIF.
IF _filename = space.
currdir = homedir.
ELSE.
rov-work_dir = _filename.
rov-fdpos = STRLEN( rov-work_dir ).
DO.
IF rov-fdpos = 0.
EXIT.
ENDIF.
rov-fdpos = rov-fdpos - 1.
ASSIGN rov-work_dir+rov-fdpos(1) TO <rov_p>.
IF <rov_p> = rov-delchar.
<rov_p> = space.
EXIT.
ELSE.
<rov_p> = space.
ENDIF.
ENDDO.
currdir = rov-work_dir.
ENDIF.
ENDFORM. " get_current_directory
*& Form get_filename-of-server
text
-->P_ITAB_FILENAME text
-->P_ROV_CURR_DIR text
-->P_ROV_GEN_NAME text
FORM get_filename-of-server TABLES nametab STRUCTURE itabfilename
USING _dirname _genname.
CALL 'C_DIR_READ_FINISH' " just to be sure
ID 'ERRNO' FIELD rov-errno
ID 'ERRMSG' FIELD rov-errmsg.
CALL 'C_DIR_READ_START' ID 'DIR' FIELD _dirname
ID 'FILE' FIELD _genname
ID 'ERRNO' FIELD rov-errno
ID 'ERRMSG' FIELD rov-errmsg.
IF sy-subrc <> 0.
EXIT.
ENDIF.
REFRESH _nametab.
DO.
CLEAR _nametab.
CALL 'C_DIR_READ_NEXT' ID 'TYPE' FIELD _nametab-type
ID 'NAME' FIELD _nametab-name
ID 'LEN' FIELD _nametab-len
ID 'OWNER' FIELD _nametab-owner
ID 'MTIME' FIELD _nametab-mtime
ID 'MODE' FIELD _nametab-mode
ID 'ERRNO' FIELD _nametab-errno
ID 'ERRMSG' FIELD _nametab-errmsg.
_nametab-dirname = _dirname.
MOVE sy-subrc TO _nametab-subrc.
CASE sy-subrc.
WHEN 0.
IF _nametab-name+0(1) = '.'.
ELSE.
APPEND _nametab.
ENDIF.
WHEN 1.
EXIT.
WHEN OTHERS. " SY-SUBRC >= 2
EXIT.
ENDCASE.
ENDDO.
CALL 'C_DIR_READ_FINISH' " just to be sure
ID 'ERRNO' FIELD rov-errno
ID 'ERRMSG' FIELD rov-errmsg.
ENDFORM. " get_filename-of-server
*& Form help_values_get_with_table_ext
text
-->P_ITAB_FILENAME text
-->P_ROV_CURR_DIR text
-->P_PO_IFILE text
FORM help_values_get_with_table_ext TABLES _filename
STRUCTURE itab_filename
USING _currdir
_selfile.
TYPES: BEGIN OF f4typ_head_struc,
tabname LIKE help_info-tabname,
fieldname LIKE help_info-fieldname,
head_text LIKE shstruc-keyword,
END OF f4typ_head_struc.
DATA itab_fields LIKE TABLE OF help_value WITH HEADER LINE.
DATA itab_selvals LIKE TABLE OF help_vtab WITH HEADER LINE.
DATA itab_values LIKE TABLE OF rlgrap-filename WITH HEADER LINE.
DATA itab_header TYPE TABLE OF f4typ_head_struc WITH HEADER LINE.
REFRESH itab_fields.
REFRESH itab_selvals.
REFRESH itab_values.
REFRESH itab_header.
itab_fields-tabname = 'PS0192'.
itab_fields-fieldname = 'BAA01'.
itab_fields-selectflag = ' '.
APPEND itab_fields.
itab_fields-tabname = 'RLGRAP'.
itab_fields-fieldname = 'FILENAME'.
itab_fields-selectflag = 'X'.
APPEND itab_fields.
LOOP AT _filename.
itab_values = itab_filename-type.
APPEND itab_values.
itab_values = itab_filename-name.
APPEND itab_values.
ENDLOOP.
CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE_EXT'
EXPORTING
CUCOL = 0
CUROW = 0
DISPLAY = ' '
FIELDNAME = ' '
TABNAME = ' '
TITLE_IN_VALUES_LIST = ' '
SHOW_ALL_VALUES_AT_FIRST_TIME = ' '
USE_USER_SHRINKING = ' '
titel = _currdir
NO_SCROLL = ' '
NO_CONVERSION = ' '
NO_MARKING_OF_CHECKVALUE = ' '
IMPORTING
index = rov-index
select_value = rov-selvalue
TABLES
fields = itab_fields
select_values = itab_selvals
valuetab = itab_values
HEADING_TABLE =
EXCEPTIONS
field_not_in_ddic = 1
more_then_one_selectfield = 2
no_selectfield = 3
OTHERS = 4.
IF sy-subrc = 0.
CLEAR itab_filename.
READ TABLE itab_filename INDEX rov-index.
IF itab_filename-type+0(3) = 'dir'.
CONCATENATE _currdir rov-delchar rov-selvalue rov-delchar
INTO _selfile.
ELSE.
CONCATENATE _currdir rov-delchar rov-selvalue INTO _selfile.
ENDIF.
ENDIF.
ENDFORM. " help_values_get_with_table_ext
Best regards,
Prashant -
How to fetch file from app. server without complete filename?
Hi,
In my report I have to read data from txt file on application server.
My file name on App. server conatain system id and date and time stam.
my file path :- /User/IDD/S10009112007101525
here,'User' is dirctory
'IDD' is folder in directory
'S100' is system id
'09112007' is date
'101525' is time in hour,miniute,second format.
From my program I can only pass directory , Folder name,System Id,Date only. I don't have time value in my program.
So please tell me how to fetch files without having time stamp value from app. server.
Plz send me exact code.It's urgent.
Message was edited by:
Manisha Kadam
Title was edited by:
Alvaro Tejada GalindoDo you want to return the file to the user on click of button or something?
Then, use web_show_document with http link which you are speaking about.
Else download the file to client using Webutil. -
Load Flat File from App Server
HI, all.
I want load flat file from appliation server. I created CSV file and loaded it on app. server with FM ARCHIVEFILE_CLIENT_TO_SERVER. After I created datasource and tried load data in the infocube. In this procedure I encountered with two problem
1. When I look file in AL11, I doesn't see cyrillic symbols, instead this symbols I see #.
2. When I try load data with data source, I get exception RS_EXCEPTION 000 "File don't open"
Anybody can help me resolve this problem?
wbr, Fanil.Hi, kodanda pani KV.
2. File is was closed.
1. Can me you clearly explain what you meen?
wbr, Fanil -
Uploading and reading file from application server
Hi
My problem is when am uploading a file to application server it is getting stored in
usr/sap/transyp1/prod/in directory
after that i want to read that file from application server to update database
when using below code it is showing some other directory in f4 help
DATA: lv_hostname TYPE msxxlist-name.
DATA: lv_server TYPE bank_dte_jc_servername.
PARAMETERS: p_file TYPE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'BANK_API_SYS_GET_CURR_SERVER'
IMPORTING
e_server = lv_server.
lv_hostname = lv_server.
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
dynpfield_filename = 'P_FILE'
dyname = sy-cprog
dynumb = '1000'
filetype = 'P'
location = 'A'
server = lv_hostname.
experts could you please help me out
Thanks & Regards
Nagesh.ParuchuriUser Transaction file. You will get all logical file path names.
used following fucntion module to read file name and use command open dataset to read the file.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
CLIENT = SY-MANDT
LOGICAL_FILENAME = C_LOGICAL_FILENAME
OPERATING_SYSTEM = SY-OPSYS
PARAMETER_1 = P_IN_FILENAME
IMPORTING
FILE_NAME = P_OUT_FILENAME
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2.
OPEN DATASET P_OPEN_FILE ENCODING UTF-8 IN TEXT MODE FOR OUTPUT.
IF SY-SUBRC <> 0.
MESSAGE E000(38) WITH 'Error in Opening file: ' V_PHY_FILENAME.
ENDIF. -
Hi all,
I have to read a file from FTP server, manipulate it and then create another file at the same location.
Currently, I am able to write a file onto FTP server ..but how do I read the file?
Any help will be greatly appreciated.
Thanks,
Harithacan i know how do u placing the file in FTP?
( default path specified in the FTP server, it might be Pre. server address)
Maybe you are looking for
-
Hi Guys, i'm wondering if the newly announced GTX970 from MSI has an HDMI 2.0 or HDMI 1.4a Port. The MSI Website states the latter, although the 'reference' model as well as some custom cards from other manufacturers having a HDMI 2.0 connection woul
-
Hi, The requirement is to print Release Order No. or all releases (with reference to Contract), for this any idea in which table this information is available? Thanks,
-
TROUBLE Converting .MOV to .WMV w-Quicktime Pro
I've been using the EXPORT feature to convert a .mov file to a .wmv file but it will only export 30 SECONDS of any .mov file I try!! I also tried converting to a .avi file first. That didn't work either. I have Quicktime pro. G5 MAC OS 10.3.9 I have
-
Changing yellow wall to white in FCP 7
I am editing a clip of a close up of my face. My face only fills half the screen as I intended. But unfortunately the viewfinder on the camera did not show that it had included a portion of one of my yellow walls in my flat. So half of the background
-
I have been using Photoshop Elements for years but today it will not open the program saying unretreivable error. I have uninstalled and installed again but the error message is the same... any advise please