Problem in accessing application server file using open dataset
Hi All,
I am trying to access application server file using open dataset command, its working fine for normal path which imention. But when i am giving path of XI server file, its not working. How to access XI server file using open dataset. Please let me know.
Thanks in advance.
Regards,
Vishal
Hi Vishal,
You need to verify if the location where you are trying to save the file is in the same server of SAP. In case that the location is in other server you need to map that directy into the same server of SAP.
You need to point always to a location in the same server of SAP, in order that the open dataset could work.
Regards,
Eric
Similar Messages
-
How to open a pdf file using OPEN DATASET
Im trying to convert a pdf into binary format. So im trying to read the contents of the pdf into a XSTRING. Using the FM 'SCMS_XSTRING_TO_BINARY' i can convert the XSTRING to binary format.
How to open a pdf file using OPEN DATASET and transfer its contents in a XSTRING variable.
What i've tried is....
DATA: f_name type string value 'C:\rep_output_pdf.pdf',
x1 type xstring,
LT_DATA TYPE STANDARD TABLE OF X255.
OPEN DATASET f_name FOR input IN BINARY MODE.
READ DATASET f_name INTO x1.
CLOSE DATASET f_name.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = x1
TABLES
BINARY_TAB = LT_DATA.
Im getting a short dump .
Short text: The file is not open.
Plz help me out.Hello Rajesh,
You are trying to do use OPEN DATASET with a local file. NOT POSSIBLE
You have to have the file in the app server to use OPEN DATASET.
BR,
Suhas -
Download file using open dataset
Hi all,
I download a .CSV file to sap server using open dataset. I have a column which stores a number with length upto 30 char. I get the output in this format '2.34234E+25' for '23423423423423400000000000' in that particular column.
Please send your suggestions to solve this issue.
Rajesh.Do you want to use the csv file in Excel or in another application.
If you display the CSV file created by open dataset using Notepad, you will probably see the 30 digit number. This is fine for many applications, but not Excel!
Excel cannot store a 30 digit number internally. Try entering a 30 digit number into an Excel cell and see what happens - it is converted to scientific format with only 14 decimal places.
If you need to see the number in Excel, you need to have it displayed as Text and not a number. There are a few options:
1. Put a character at the start of the field
2. Don't use CSV, but use OLE to start Excel and put the data in the cell with text format (complicated I know).
3. Save as a file with a .txt extension, open in Excel, and in the Text import wizard (step 3) specify that the column data format is Text
Michael -
Create an Excel File Using OPEN DATASET Command
Hey, everyone.
How can I create an Excel file by using OPEN DATASET command ??
The file is created but the columns are no seperated like thay should.
I need to seperate the internal table's fields with a comma - How can I do it ?
Here's my code:
OPEN DATASET filename1 FOR OUTPUT IN TEXT MODE.
IF SY-SUBRC = 0.
LOOP AT gt_vend_info into gwa_vend_info.
TRANSFER gwa_vend_info TO filename1.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
Thanks in advance.Hi Beki,
REPORT ZTESTAA.
TYPE-POOLS:TRUXS.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
END OF ITAB.
DATA:
ITAB1 TYPE TRUXS_T_TEXT_DATA.
SELECT VBELN
POSNR
UP TO 10 ROWS
FROM VBAP
INTO TABLE ITAB.
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ';'
TABLES
I_TAB_SAP_DATA = ITAB
CHANGING
I_TAB_CONVERTED_DATA = ITAB1
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.
OPEN DATASET filename1 FOR OUTPUT IN TEXT MODE.
IF SY-SUBRC = 0.
LOOP AT gt_vend_info into gwa_vend_info.
TRANSFER gwa_vend_info TO filename1.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
the above code give CSV format file, all fields will be separated by ';'
Regards
vijay -
Fetch excel file from app. server using open dataset...
Hello Experts,
Our functional consultant is asking me if it possible to get an excel file from the
application server file using OPEN dataset and in background mode? If yes, Please tell me on how to do this.
Thank you guys and take care!Hi Viraylab,
to download this the procedure:
you can use the FM 'EXCEL_OLE_STANDARD_DAT ' for this purpose.
this FM 'EXCEL_OLE_STANDARD_DAT' can be used to start Excel with a new sheet and transfer data from an internal table to the sheet.
Here are some of the parameters:
file_name: Name and path of the Excel worksheet file e.g. ?C:TEMPZTEST?
data_tab: Name of the internal table that should be uploaded to Exvcel
fieldnames: Internal tabel with column headers
How to build the field names table:
data: begin of i_fieldnames occurs 20,
field(60), end of i_fieldnames.
i_fieldnames-field = ?This is column 1?. append i_fieldnames-field.
i_fieldnames-field = ?This is column 2?. append i_fieldnames-field.
to upload follow this:
OPEN DATASET dsn FOR INPUT IN BINARY MODE.
DO.
READ DATASET dsn INTO itab-field.
IF sy-subrc = 0.
APPEND itab.
ELSE.
EXIT.
ENDIF.
ENDDO.
[/code]Rob
or Try this function module.
FILE_READ_AND_CONVERT_SAP_DATA
pass 'XLS' to I_FILEFORMAT..
Dont forgot to Reward me points .....All the very best....
Regards,
Sreenivasa sarma K. -
Application server file lentgh
Hi,
I am trying to read an application server file using open dataset in Binary Mode..
I want to find the file length of the file read.(number of bytes transferred as in the GUI_Download FM parameter Filelength)
How can i achieve it.
Appreciate ur ideas.
Rgds.
stckHello,
Use the FM EPS_GET_FILE_ATTRIBUTES passing the file name and the directory name and get the file_size.
Vikranth -
Application server file downloading
Hi Experts,
I have very urgent requiremnts for this :
1. The data extract needs to be downloaded on SAP application server ( take whatever path accessible to you).
2. Thereafter for every run, it should check if the file available in the same path and if yes then append data to this file instead of creating new one.
3. If file is not available then create new file.
please suggest me, how to do this.
it's very urgent
Regards
Mohithi,
use following logic
Compile the file path
CONCATENATE text-t10 sy-datum c_txt INTO v_fname_out.
Open the filepath on the application server for writing
OPEN DATASET v_fname_out FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
Check if the file could be opened
IF sy-subrc = 0.
Loop at the internal table and transfer the contents to the file specified at the path
LOOP AT itab INTO wa.
TRANSFER wa TO v_fname_out FOR APPENDING.
CLEAR wa.
ENDLOOP.
ENDIF.
Close the dataset
CLOSE DATASET v_fname_out.
regards,
srilatha -
File transfer Open dataset CSV file Problem
Hi Experts,
I have an issue in transferring Korean characters to a .CSV file using open dataset.
data : c_file(200) TYPE c value '
INTERFACES\In\test8.CSV'.
I have tried
open dataset c_file for output LEGACY TEXT MODE CODE PAGE '4103'.
open dataset c_file for output in TEXT MODE ENCODING NON-UNICODE.
open dataset c_file for output in TEXT MODE ENCODING Default.
Nothing is working.
But to download to the presentation server the below code is working. How can the same be achieved for uploading the file to application server.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = 'D:/test123.xls'
filetype = 'ASC'
write_field_separator = 'X'
dat_mode = 'X'
codepage = '4103'
write_bom = 'X'
CHANGING
data_tab = t_tab
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.Hi,
I would recommend to use OPEN DATASET ... ENCODING UTF-8 ...
If your excel version is unable to open this format, you can convert from 4110 to 4103 with report RSCP_CONVERT_FILE.
Please also have a look at
File upload: Special character
Best regards,
Nils Buerckel -
Datas in Application Server file is not aligned
Dear all,
I have created a program in SE38 and transfer the data to the Application server file using Transfer statement.
The datas are transferd to Application Server file , but datas are not aligned.
In out Application server file thd datas are displaied one after another..
But i want to display the datas in single row.
I have include program for your reference.
With Regards,
Baskaran.
report zsutest34 message-id ztcpo.
DATA AND VARIABLES DECLARATION
data: begin of leban occurs 0.
include structure eban.
data end of leban.
data new(1).
SELECTION-SCREEN
selection-screen begin of block 001 with frame title text-001.
selection-screen skip 1.
parameters filename(128) default '
192.168.100.33\SAPMNT\IDS\dvebmgs00\data\santhosh.dat'. "\SYS\GLOBAL\testfile1.txt' LOWER CASE.
select-options ldat for sy-datum.
parameters lwerks type eban-werks.
selection-screen skip 1.
selection-screen end of block 001.
START-OF-SELECTION
select * from eban into leban where erdat in ldat and werks = lwerks.
append leban.
endselect.
sort leban by banfn bnfpo.
clear leban.
REGARDING DATASET
perform value1.
form value1.
open dataset filename for output in text mode encoding default. " MESSAGE D_MSG_TEXT.
data: l_msg(255) type c.
if sy-subrc ne 0.
message i001.
exit.
endif.
concatenate 'The following file was opened:'(002) filename into l_msg separated by space.
write: l_msg.
uline.
TRANSFORMING TO APPLICATION SERVER FILE
loop at leban.
transfer leban-banfn to filename.
transfer leban-bnfpo to filename.
transfer leban-ekgrp to filename.
transfer leban-matnr to filename.
transfer leban-werks to filename.
AT FIRST.
WRITE: /10 TEXT-001, 30 TEXT-002, 45 TEXT-003, 50 TEXT-004, 65 TEXT-005.
' ITEMNO GRP MATERIAL PLANT QTY ' COLOR = 2.
ENDAT.
at new banfn.
uline.
write:/1 'PRNO-',leban-banfn.
new = 'x'.
uline.
skip.
endat.
if new = 'x'.
WRITE:/ ' ITEMNO GRP MATERIAL PLANT QTY ' color = 2.
write:/14 leban-bnfpo, leban-ekgrp, leban-matnr, leban-werks, leban-menge.
clear new.
else.
write:/14 leban-bnfpo, leban-ekgrp, leban-matnr, leban-werks, leban-menge.
endif.
endloop.
DATASET CLOSING
close dataset filename.
endform.wa_string type string
loop at leban.
concatenate leban-banfn
leban-bnfpo
leban-ekgrp
leban-matnr
leban-werks into wa_string
separated by CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
transfer wa_string to filename.
endloop. -
How to execute application server file from abap program
Hi Friends,
i have a requirement to execute application server file using abap program.
i got a file directory like '/home/im3/hrintf/xxx.sh' , it's of unix file, so they want me to execute through abap program.
pls suggest me with relevant logic.
Thank you.
Regards
Ramesh MDefine the external command in SM49/SM69
Try with SXPG_CALL_SYSTEM or SXPG_COMMAND_EXECUTE
Also check this link
link:[Execute Unix Script|http://searchsap.techtarget.com/tip/0,289483,sid21_gci774071,00.html] -
Application Server file Accessing problem
Hi all,
In my program i am writing data to the application server file ( temp.txt ) in Appending mode.
I am having 1000 records to write. In the mean time ( while temp.txt have 200 records ) i am running the same program using same application server file ( temp.txt ) same client but different user. That time writting option for both programs are successfully done.
But in my case i have to restrict the file writing at that time only one user.
Is there any way to lock the application server file for particular user while writting.
Thanks in Advance,
Florian.
Edited by: Florian Thiruselvan on Dec 22, 2008 6:51 AMHi Kishan Singh,
You are exactly write. Its working but i got some more problem in that.
Importing Parameter
VOLDIR_SET TYPE TXW_LOCK2-VOLDIR_SET
VOLDIR_SET TXW_VOLSET CHAR 10 0 Data file directory set
But the Data file directory set length is more than 10.
What shall i do? do you have any idea please suggest me.
Thanks
Florian -
Write internal table to a file on application server using OPEN DATASET
I have logical file path and XLS file name. I want to write internal table to a XLS or CSV file on application sever. Please give example.
Hi
see this program
EXCEL SHET to INTERNAL table and then to APPLICATION server
*& Report ZSD_EXCEL_INT_APP
REPORT ZSD_EXCEL_INT_APP.
parameter: file_nm type localfile.
types : begin of it_tab1,
f1(20),
f2(40),
f3(20),
end of it_tab1.
data : it_tab type table of ALSMEX_TABLINE with header line,
file type rlgrap-filename.
data : it_tab2 type it_tab1 occurs 1,
wa_tab2 type it_tab1,
w_message(100) TYPE c.
at selection-screen on value-request for file_nm.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = 'X'
MASK = ' '
CHANGING
file_name = file_nm
EXCEPTIONS
MASK_TOO_LONG = 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.
start-of-selection.
refresh it_tab2[].clear wa_tab2.
file = file_nm.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '10'
i_end_row = '35'
tables
intern = it_tab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at it_tab.
case it_tab-col.
when '002'.
wa_tab2-f1 = it_tab-value.
when '004'.
wa_tab2-f2 = it_tab-value.
when '008'.
wa_tab2-f3 = it_tab-value.
endcase.
at end of row.
append wa_tab2 to it_tab2.
clear wa_tab2.
endat.
endloop.
data : p_file TYPE rlgrap-filename value 'TEST3.txt'.
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.
loop at it_tab2 into wa_tab2.
write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
endloop. -
How to check whether the Application Server file has already been opened?
Hi Experts,
I have a query related to Application Server file. I am using multithreading concept to process the data and write it in to a single file.
For example, I have 4 workprocesses. Each workprocess will process the data and whenever it has a record available it will access the file and write it directly.
Problem is the statements that are written in the workprocess is same and I want to check the status whether the file has been opened or not ?
Thanks in advance!!!
Thanks,
Babu KilariDepends on the structure, and whether the data needs to be sorted in some way in the final file.
In any case, I don't think there will be a significant performance difference between using OPEN DATASET again and getting funny with Unix commands.
If you don't need to sort the final file, you can use strings to read, concatenate and write the data even without line-based DO ENDDO loops, this works pretty fast.
I hope we are not talking about GBytes of data
Thomas -
Error while accessing the application server file
Hello,
When I try to load the data from CSV file to PSA , I am getting following error message
"Error while accessing the application server file"
"Errors in source system"
I gave the right file path
I am not sure about this error message.
Thanks,Hi ram,
if you have more than one application server running in your BI system (see at transaction SM51) be aware that your infopackage will be executed on the right one. Each application server has its own file system and your job need to run on the server your file is stored on.
Also check if the os user of the SAP system itself (<sid>adm on Unix) has rights to read that file.
Bye
Frank -
Problem in XML to ITAB conversion - Application server files
Hi Friends
Earlier we used FTP concept, so I received XML file and length frpm FTP function modules, but now instead of FTP I am going to use the following function modules
SCMS_BINARY_TO_XSTRING
SMUM_XML_PARSE
for that I need to pass the lenght of the file.But I dont know how to calculate the file length while receiving the files using Open Dateset concept.
Kindly provide your inputs.
Thanks
GowrishankarCould you please tell us how you solve it?
Greetings,
Blag.
Maybe you are looking for
-
Hi friends, I have to create select options in module pool programming. Using subscreens i have created select option. But if i enter some value and if i press enter then the value is clearing automatically. I am not able to capture the values. Can a
-
Difference between date info object in characteristics and keyfigure
What is the difference between "date" data type in characteristic and keyfigure? Thanks in advance. Raj
-
DST issues? For OES2 to OES11 upgrade?
Hi all I have a client with DST working well on a couple of OES2 sp3 64-bit servers on vSphere 5.0 Does anyone here have any experience with such upgrades? I'd be pretty sure that the one upgrade path of just rebinding the NSS volumes to new servers
-
LoadMovie from inside a movieclip question
I have a scroll movieclip which contains 15 buttons each button is an instance of 1main button. I have the button frame inside the timeline of the movie clip and the actions in frame 1 of the clip. onrelease should call the loadMovie function and loa
-
UDO - Access the UDO from Wizard (2)
Hi, How do I access the User Defined Object (UDO) build in SAP B1 Wizard in my C# Add-On? Code sample could be nice! Thank you! Rune