Open Dataset : File creation in server
Hi Guys,
I am trying to use
Open dataset dsn for output in text mode encoding default. " dsn = '
pt-net\taskout\outfile.txt'.
loop at itab.
transfer itab to dsn.
endloop.
to write a file at a destination on a windows NT server For eg :
pt-net\taskout\outfile.txt
I see sy-subrc = 0 at both open dataset and transfer commands in the debugger. But the file is not written.
I can manually create files when I access this path in my explorer. So it is not an access issue.
Also, my SAP application server is a Unix server. But the file I am trying to write is in NT server. THis is for a 3rd party application. Where am I possibly going wrong ? I am able to write this file to the Unix application server path using the above command. But I need to write this in the Windows server.
Do I need first write to Unix path and then FTP it to Windows server ? I can manually do this. But since this program is going to run as a job, I want to automate this..
THanks in advance!!
Hi,
This is my advice:
First write the file in the file system of your application server.
After that find out, what to do for transport on operation system level.
Since SAP allows system calls, you can do it in the same way by program.
I give you some code. Unfortunately it is from Windows to Windows. Nevertheless I hope you can profit by it.
*& Form file_to_l66
FORM file_to_l66 USING src_fpath
dest_fname.
- src_fpath full path of source file
- dest_fname intended file name for destination
DATA:
parcom(250),
BEGIN OF tabl OCCURS 0,
line(200),
END OF tabl,
str(250).
drive y free
parcom = 'y:'.
CALL 'SYSTEM' ID 'COMMAND' FIELD parcom
ID 'TAB' FIELD tabl-sys.
IF sy-subrc IS INITIAL.
RAISE file_to_l66_err_drive_y.
ENDIF.
mapping y
128.1.123.1 ServerL66
parcom =
'net use y:
128.1.123.1\SAPDATA passwd /user:usr01'.
CALL 'SYSTEM' ID 'COMMAND' FIELD parcom
ID 'TAB' FIELD tabl-sys.
IF NOT sy-subrc IS INITIAL.
RAISE file_to_l66_err_mapping_y.
ENDIF.
copying
CONCATENATE 'copy' src_fpath 'y:\' INTO str SEPARATED BY space.
CONCATENATE str dest_fname INTO parcom.
example:
src_fpath = 'e:\trans\l66.xml'
dest_fname = 'l66_20080531235959.xml'
-> parcom = 'copy e:\trans\l66.xml y:\l66_20080531235959.xml'.
CALL 'SYSTEM' ID 'COMMAND' FIELD parcom
ID 'TAB' FIELD tabl-sys.
IF NOT sy-subrc IS INITIAL.
RAISE file_to_l66_err_copying.
ENDIF.
release y
parcom =
'net use y: /delete'.
CALL 'SYSTEM' ID 'COMMAND' FIELD parcom
ID 'TAB' FIELD tabl-sys.
IF NOT sy-subrc IS INITIAL.
RAISE file_to_l66_err_unmapping_y.
ENDIF.
ENDFORM. " file_to_l66
Edited by: Walter Habich on May 22, 2008 4:24 PM
Similar Messages
-
Open Dataset - File Creation with [] as delimiter
All,
I need to create a file in the App Server with each field needs to separated with a Square Symbol ( I don't have any info what is this Square Symbol ) and also i cannot able to recreate the same that over here. But i can see that in notepad and wordpad
APO 529578790000 001
ACO 529578790000 001 01 00001
AED 529578790000 001 N380
a®But i tried in notepad and wordpad there is no tab available
or it can be generate thru binaray format of 1D ?
a® -
Is there a way to open Excell file from the server and display in the UI and save it back on to the
Hello there,
Is there a way to open Excell file from the server and display in the UI and save it back on to the server? (like showing xell file as a datagrid - add rows, columns etc.)Hi Mike,
Welcome you to the forum.
You may try:
SELECT * FROM MyDBNameHere.dbo.OUSR T0
Thanks,
Gordon -
How to open sdf files in SQL server 2012?
How to open sdf files in SQL server 2012?
I couldn’t figure out how to open the sdf files in SQL server 2012
Thank you
Best
JamalI don't think it's hard if understood the question properly you can try this I do it most of the time and this might be the solution for you, sometimes minor simple click is a life saver:)
1.
Open SQL Server Management Studio, or if it's running select File -> Connect Object Explorer... and click the
connect drop down arrow
2.
In the Connect to Server dialog you will see Database Enghine, Analaysis Servie on so on and you go head change Server type to
SQL Server Compact Edition
3.
From the Database file drop-down as shown below click the drop down arrow and select <
Browse for more...>
4.
And you will see C:\, D:\, G:\
drive and so on and open, your SDF file where it is located
I hope this has been informative for you and good luck
Please remember to click “Mark as Answer” on the post that has answered your question as it is very relevant to other community members dealing with same problem in seeking the right answer -
How to open a file located at server using JSP
hi,
i would like to open a file located at server as it is. I mean to say, if it a MS Word file, i wanna open it in MS Word, if it an Excel file, i wanna open it in Excel. i know the location (path) of the file. Can someone help me please.
ThanxThe best way would simply be to HREF it.
ie<a href="excelfiles/spreadsheet.xls">Open spreadsheet</a>When a user then clicks on that lick in their browser they should be given the option to either download or (if they have the appropriate program, in this case MS Excel, installed) open it.
This works best if the client is using a version of Internet Explorer (if you're dealing with MS files), but any browser should potentially offer you the option of opening the file.
Beyond that there's no way to specifically open a program on a client machine (it'd be a bit of a security loophole if you could! - Imagine a JSP page being able to open FDISK...). All you can do is pass the file (via the HREF) and let the client decide what to do with it. -
Cant open doc files from the server on MacBook Air after upgrading to Maverick
Cant open doc files from the server on MacBook Air after upgrading to Maverick, I can only open up docx file. Thank you!
Thanks for the suggestion! I don't use Phantasm or VectorScribe (or any Astute Graphics plugins for that matter). I do, however, have a Wacom tablet and have a few plugins that concern using Blurb Book Creator as well as LiveSurface Context.
I did the very unfortunate and foolish act of upgrading to Maverick without a backup, so postponing isn't an option for me.
I geuss my question at this point would be, would it be worthwhile to wipe all the adobe products from my harddrive and re-install them? Or would that be a useless endeavor.
I don't have an external hard-drive so backing up and re-installing the entire OS would be a bit much. Any suggestions? -
Hi All,
The macro OPENFILE is working fine for opening the files in the local.
The same macro if used to open the file in the server its not working fine.
I tried both in the following,
evmnu("OPENFILE","link name","HTTP://server name/appsetname/application name/eEXCEL/REPORTS/Report1.xlt")
evmnu("OPENFILE","link name","//server name/appsetname/application name/eEXCEL/REPORTS/Report1.xlt")
both they are not working,
Please let me know, if there is any problem in this or the procedure for accessing the files from the server.
Thanks in Advance..
Regards,
G.Vijaya Kumar.Here is a working example if u want to open a report that is located in your local folder:
=EVMNU("OPENFILE";"Description";"/REPORTS/WIZARD/template1.xlt")
To open file that is located in a company folder on the root lvl u can use next formula:
=EVMNU("OPENFILE";"Description";"CompanyLVLFile.xlt")
Hope that was helpful,
Dzmitry -
Open (.sdf) file with SQL server 2005 Management Studio
In VS2005, I have created a SQL Mobile database, (.sdf).
Copied that (.sdf) file to Desktop, and when I try to open with SQL Server 2005 management studio, its showing error "make sure the application for the file type (.sdf) is installed."
How can I open this file with SQL server?
Regards
AbinashYou must install SP2 if using Management Studio Express (http://www.microsoft.com/downloads/details.aspx?familyid=6053C6F8-82C8-479C-B25B-9ACA13141C9E&displaylang=en)Erik Ejlskov Jensen, MCTS: WM App, MCITP: SQL 2008 Dev - http://erikej.blogspot.com
Please mark as answer, if this was it. -
Unable to open a file in Application server
This path exist in the Application server.
DR1/interfaces/Esker
ORDHIST - This is the File name in whihc i need to save the data.
I had specified the whole path as DR1/interfaces/Esker/ORDHIST
I am trying to upload the data from the Internal table to the above specified file ORDHIST.
It is not opening the File on the application server, it says that it 'could not open file'.
Any suggestions will be apprecaited to open the file and transfer the data from
Final Internal table to --> Application server
Below is my code....If found any mistakes then plz correct me...
*& Form UPLOAD_APPLSERVER
* text
* --> p1 text
* <-- p2 text
FORM UPLOAD_APPLSERVER .
DATA : GV_OUTPUT(275) TYPE C.
DATA : P_FILE TYPE STRING.
P_FILE = 'DR1/interfaces/Esker/ORDHIST'.
OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC <> 0.
MESSAGE : I002(ZMSSG) WITH 'Could not open file'.
STOP.
ENDIF.
LOOP AT T_FINAL1 INTO WA_FINAL1.
CONCATENATE WA_FINAL1-VBUND
WA_FINAL1-BSTNK
WA_FINAL1-KUNNR
WA_FINAL1-AUDAT
INTO GV_OUTPUT
SEPARATED BY ','.
TRANSFER GV_OUTPUT TO P_FILE.
IF SY-SUBRC <> 0 .
MESSAGE : I003(ZMSSG) WITH 'Trasnfer is failed'.
STOP.
ENDIF.
ENDLOOP.
CLOSE DATASET P_FILE.
ENDFORM. " UPLOAD_APPLSERVER
Thanks & Regards,
KrishnaHello Kittu,
What was the Sy-Subrc value after executing the Open Dataset statement?
If it is 8, then the problem could be with
1) The path name not mentioned properly (or)
2) User Id might not be having access to the file mentioned in the path
Also, if you are using the App Server as UNIX then the filenames should be of case sensitive.
Check the path first and note it down as per the actual case
Hope this is helpful
Thanks,
Babu Kilari
Edited by: Babu Kilari on Apr 6, 2009 6:18 AM -
Data transfer error open dataset files
hi,
When i try to create a excel or text in my application server using open dataset.
i.e
l_filename type rlgrap-filename value '/tmp/down.txt'.
I got a short dump during the run time
i got the output and put into an internal table.
the following code has been used.
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
if r_ucomm = 'confirm' .
OPEN DATASET l_fname FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT it_out INTO wa_out.
IF sy-subrc = 0.
TRANSFER wa_out TO l_filename.
ENDIF.
ENDLOOP.
endform.
during the execution i hv a button alv grid outpu. when i click the button the file should be transferred.
but NO authorization to open the file "/tmp/down.txt".
and the error is pointed in the opendataset line.
Please tell me where i am wrong . and help me in resoving this.Try this..instead of moving field by field into the file 1st convert all he fields to a character stream..and then move that steam to file. Ex:
loop at internal table into l_h_tbl_file.
concatenate l_h_tbl_file-f1 l_h_tbl_file-f2 l_h_tbl_file-f3
l_h_tbl_file-f4 l_h_tbl_file-f5 into g_string.
TRANSFER g_string TO fu_wk_get_file.
endloop. -
Opening a file in Application Server
Hi Friends,
I have a file 'abc' in application server, and i don't know the extension of it . while trying to open it using OPEN DATASET statement, it fails because of no extension.
I have tried using 'abc.*' in the open dataset statement but it doesnt work....so is there any function module or is there any other way to open and read it.........>
Shylaja t wrote:
> I have a file 'abc' in application server, and i don't know the extension of it . while trying to open it using OPEN DATASET statement, it fails because of no extension.
Its totally wrong to say OPEN DATASET statement failed because of no extension of the file! Actually, the ABAP run-time does not care whether the file has an extension or not. In most cases, the app server (file system) datasets/files are stored without any extension.
Here's how to approach your issue:
1. Read the Keyword Documentation of OPEN DATASET
2. Check the Sy-Subrc after OPEN DATASET statement and if its unequal to 0;
a. Check the file name/path you are passing is correct
b. Check you are using OPEN DATASET for READ
c. Depending you are in a Unicode/Non-Unicode system, check the file is not already open
d. Make sure the file you are trying to open physically exists in the app server!
Once you are able to OPEN the file then use READ DATASET command to read it.
Hope this helps.
Cheers,
Sougata. -
OPEN DATASET file FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE
Hi There,
I also have the similar issue. I am able to write the data into appliaction server in Chinese Characters using :OPEN DATASET datei FOR OUTPUT IN TEXT MODE ENCODING DEFAULT or OPEN DATASET datei FOR OUTPUT IN TEXT MODE ENCODING UTF-8. But when i save that file into my presentation server manually, all the chinese characters are showing as Junk.
When i use OPEN DATASET datei FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE, giving runtime error and when i use OPEN DATASET datei FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE IGNORING CONVERSION ERRORS, No error but application server output itself showing as Junk characters.
Could you please suggest me what you have done?
Regards,
Chaitanya AHi,
Use this
OPEN DATASET File_path FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE
WITH SMART LINEFEED
it will definitely work.
Regards,
Manesh. R -
Hi Friends,
I am uploading a file into SAP server and I would like to upload with 300 length char. ( I mean The file should contian 300 coloms)
where we can declare the length of the file?
Thanks,
SridharHi Sridhar,
Define variable of type string or type CHAR(XXX), XXX should be equal or more than expected length of record.
Open dataset in text mode or binary mode.(prefer binary mode - if user will go to OS and see the file by double click prefer text mode so that it will get downloaded in readable format).
if dataset is opened successfully -
Loop at your internal table into string or defined variable .
Use transfer command to transfer each line.
Close the dataset.
Here goes some code:
DATA: lv_file1 TYPE string.
FIELD-SYMBOLS: <f_t_table> TYPE ANY.
lv_file1 = lfile_path.
IF im_binary_mode IS NOT INITIAL.
OPEN DATASET lv_file1 FOR OUTPUT IN BINARY MODE.
ELSE.
OPEN DATASET lv_file1 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT .
ENDIF.
IF sy-subrc EQ 0.
LOOP AT t_table ASSIGNING <f_t_table> .
TRANSFER <f_t_table> TO lv_file1.
ENDLOOP.
CLOSE DATASET lv_file1.
MESSAGE s027(zdev) RAISING download_success.
ELSE.
MESSAGE e028(zdev) RAISING download_error.
ENDIF.
Now important thing:
Record with length more than 255 gets downloaded successfuly intext mode but when you try to read it via AL11, CG3Y, or with OPEN dataset- READ- write ..CLOSE dataset you can see only 255 character.
Dont worry about this.
AL11 and CG3Y is unable to display more than 255 char in text mode. if you are writing content of the file on list screen, use OFFSET, like WRITE: /01(500) lv_string.
write statement in AL11/cg3y doesnt have this offset in write so more than 255 length cant be seen.
I hope u get the answer and able to understand this solution.
Bless u. -
Hi all,
Using the "OPEN DATASET", I am trying to create a file in a directory having spaces embedded in the name, e.g.
INTRANET.BARCAPINT.COM\DFS-EMEA\GROUP\GLB\FMCSGLB\WEALTH MANAGEMENT\WM REGION\SHARED\MANAGEMENT\SAP HR TEST\FSTEST.TXT where there is space between "Wealth" and "Management".
The problem I have is that only part of the directory up to "WEALTH" gets picked up(
INTRANET.BARCAPINT.COM\DFS-EMEA\GROUP\GLB\FMCSGLB\WEALTH) and the rest gets discarded. I want to use the full directory name, which in this case has spaces in between, to create files in.
How can I do this? Any ideas?
Regards,
Shabbarhi syntax is
reward if useful
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*--- Display error messages if any.
IF sy-subrc NE 0.
MESSAGE e001(zsd_mes).
EXIT.
ELSE.
*---Data is downloaded to the application server file path
LOOP AT it_tab2 INTO wa_tab2.
TRANSFER wa_tab2 TO p_file.
ENDLOOP.
ENDIF.
*--Close the Application server file (Mandatory).
CLOSE DATASET p_file. -
How to open dataset on a specific server
I have no problem outputting my dataset online after unicode conversion.
However, when running in background mode and without specifying the server to run(we have a number of application server), ie t dump.
Now, how can I set a background job to open the dataset on the central server within the program code?
ThanksYou can specify the complete path of central application server when you use Open data set statement. e.g you want to open a file from cent_serv on Z directory.
Open dataset '\\cent_serv\z\file.txt'
Hope it works.
Maybe you are looking for
-
Hi Gurus, I have an asset (equipment) which was capitalized on Aug 2007 and with useful life of 3 years. It was fully depreciated last July 2010. This asset needs to be repaired this Feb 2011. Kindly advise if we need to create a new asset number for
-
Call of API for IBase contains errors Message no. CRM_IB050
Call of API for IBase contains errors Message no. CRM_IB050 Diagnosis No import data was entered for one of the function modules (APIs) for Installed Base Management. Therefore, the function cannot be executed. System Response The system terminates p
-
Criticial VLAN for Wireless Users
Hi I have a setup were all users (LAN & WIRELESS) Are being authenticated using Dot1x with ACS In case of ACS failure (without a secondary one), I know i can configure the switch port on the LAN to have a critical VLAN, so in case ACS was detected as
-
Trouble creating user accounts
I am looking for some help in establishing a Administrative user account for my wife. Mysteriously, the dock on the new account contains only question marks (except for Quicktime, Finder & Trash), the application folder is nearly empty, system prefer
-
Any way to create a simple report selection menu for end user?
Hello. We purchased two full versions of Crystal Reports 2008, version 12.3.1.684. One copy is for me, where I create reports and the second copy is for an end user who runs them. I would like to create a basic menu so when he starts his copy of C