How to read file from prsntn server in Inbound idoc FM.
Hi Experts,
I am new to idoc.
I have requirment that i need to read a file from presentation and application server and put in inbound idoc FM.Idoc will be processed in batch.
How can i put selection screen in FM and read the file?or how can i proceed with the solution?
Please help..
Umesh
Hi Umesh,
My understanding on your requirement is to read a file from pres. server and pass the data to an IDoc function module. Am I correct?
If this is the case then you can create a report which picks up the file from pres. server and then read data from the file and pass it to the parameters of the required function module.
Hope this helps.
Regards,
-Sandeep
Similar Messages
-
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 -
How to download file from application server
Hi Experts,
I developed report and execute in background mode. for this i used Open dataset transfer and close dataset . i got the requried output . But in this case user want downloaded file on presentation server so can anyone tell me How to download file from application server?
i know it is possible through Tcode CG3Y. but i want code in program.This code will download a file to your Client package by package, so it will also work for huge files.
*& Report ZBI_DOWNLOAD_APPSERVER_FILE
REPORT zbi_download_appserver_file.
PARAMETERS: lv_as_fn TYPE sapb-sappfad
DEFAULT '/usr/sap/WBP/DVEBMGS00/work/ZBSPL_R01.CSV'.
PARAMETERS: lv_cl_fn TYPE string
DEFAULT 'C:\Users\atsvioli\Desktop\Budget Backups\ZBSPL_R01.CSV'.
START-OF-SELECTION.
CONSTANTS blocksize TYPE i VALUE 524287.
CONSTANTS packagesize TYPE i VALUE 8.
TYPES ty_datablock(blocksize) TYPE x.
DATA lv_fil TYPE epsf-epsfilnam.
DATA lv_dir TYPE epsf-epsdirnam.
DATA ls_data TYPE ty_datablock.
DATA lt_data TYPE STANDARD TABLE OF ty_datablock.
DATA lv_block_len TYPE i.
DATA lv_package_len TYPE i.
DATA lv_subrc TYPE sy-subrc.
DATA lv_msgv1 LIKE sy-msgv1.
DATA lv_processed_so_far TYPE p.
DATA lv_append TYPE c.
DATA lv_status TYPE string.
DATA lv_filesize TYPE p.
DATA lv_percent TYPE i.
"Determine size
SPLIT lv_as_fn AT '/' INTO lv_dir lv_fil.
CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
EXPORTING
file_name = lv_fil
dir_name = lv_dir
IMPORTING
file_size_long = lv_filesize.
"Open the file on application server
OPEN DATASET lv_as_fn FOR INPUT IN BINARY MODE MESSAGE lv_msgv1.
IF sy-subrc <> 0.
MESSAGE e048(cms) WITH lv_as_fn lv_msgv1 RAISING file_read_error.
EXIT.
ENDIF.
lv_processed_so_far = 0.
DO.
REFRESH lt_data.
lv_package_len = 0.
DO packagesize TIMES.
CLEAR ls_data.
CLEAR lv_block_len.
READ DATASET lv_as_fn INTO ls_data MAXIMUM LENGTH blocksize LENGTH lv_block_len.
lv_subrc = sy-subrc.
IF lv_block_len > 0.
lv_package_len = lv_package_len + lv_block_len.
APPEND ls_data TO lt_data.
ENDIF.
"End of file
IF lv_subrc <> 0.
EXIT.
ENDIF.
ENDDO.
IF lv_package_len > 0.
"Put file to client
IF lv_processed_so_far = 0.
lv_append = ' '.
ELSE.
lv_append = 'X'.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = lv_package_len
filename = lv_cl_fn
filetype = 'BIN'
append = lv_append
show_transfer_status = abap_false
TABLES
data_tab = lt_data.
lv_processed_so_far = lv_processed_so_far + lv_package_len.
"Status display
lv_percent = lv_processed_so_far * 100 / lv_filesize.
lv_status = |{ lv_percent }% - { lv_processed_so_far } bytes downloaded of { lv_filesize }|.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING "percentage = lv_percent - will make it fash
text = lv_status.
ENDIF.
"End of file
IF lv_subrc <> 0.
EXIT.
ENDIF.
ENDDO.
"Close the file on application server
CLOSE DATASET lv_as_fn. -
How to transfer file from application server to presentation server in background?
Hi Experts,
How to transfer file from application server to presentation server in background?
Thanks in advance
NamitaThanks Raman and Challa,
We want to move file from application server to Shared folder, not on local machine. We checked FM which you guys have provided but those are not able to read file from application server.
We need this program to run in background so that we can use this in daily process chain.
Appreciate your inputs on this.
Thanks,
Namita -
How to upload file from Application Server?
Dear Friends,
How to upload file from Application Server?
Plz. with example...
Regards,
Dharmeshhi,
check the code for upload from application server.
tables: kna1.
types: begin of s_file,
customer type kna1-kunnr,
country type kna1-land1,
name type kna1-name1,
region type kna1-regio,
end of s_file.
*--Internal tables
data: it_file type s_file occurs 0 with header line.
*-- Selection screen
selection-screen: begin of block b1 with frame title text-001.
parameter: p_file type rlgrap-filename default 'C:/customer.txt'
obligatory.
selection-screen: end of block b1.
*-- At selection screen
at selection-screen on value-request for p_file.
perform file_help using p_file.
*-- Process File
start-of-selection.
perform upload_file using p_file.
*-- write File data to o/p
end-of-selection.
perform write_data.
*& Form file_help
form file_help using p_p_file.
data: l_filepath type ibipparms-path.
call function 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
importing
file_name = l_filepath
p_p_file = l_filepath.
endform. " file_help
*& Form upload_file
form upload_file using p_p_file.
call function 'WS_UPLOAD'
exporting
filename = p_p_file
filetype = 'DAT'
IMPORTING
FILELENGTH =
tables
data_tab = it_file
exceptions
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
others = 11
if sy-subrc <> 0.
message i001.
endif.
endform. " upload_file
*& Form write_data
form write_data .
loop at it_file.
write:/ it_file-customer, it_file-country, it_file-name,
it_file-region.
endloop.
endform.
regards,
keerthi. -
[Urgent] How to read files from different directories?
I am new to Java Programming, I would like to know how to read files from directories other than the current one? (example as follows)
ProjectDirectory
|--MainDirectory
|--MainProgram.java
|--SupplementDirectory
|--SupplementProgram.java
|--Pictures
|--Image.gif
What should I write in the MainProgram.java so that I can use the supplementProgram.java from MainProgram and read the Image.gif file from the MainProgram.java?
ThanksRun through the I/O tutorial here. It should get you up to speed on this sort of thing...
-
How to Read file from Application in DMZ Server (page on DMZ)
Hi All,
i am trying open a file from application server from OAF page on DMZ server .
i am getting the error 'either not supported file type or file is damaged '.
i am taking the path of production server to read the file from DMZ server .
Please let me know what is the issue .
Thanks
RajuPlease post the details of the application release, database version and OS.
i am trying open a file from application server from OAF page on DMZ server .Is the issue with all OAF pages or with specific ones only?
i am getting the error 'either not supported file type or file is damaged '.Please check Apache log files for details about the error (error_log* and access_log*).
i am taking the path of production server to read the file from DMZ server .What type of DMZ configuration you have?
Thanks,
Hussein -
Hi,
When i try to read file from server,the following message is displayed .
ORA-29532: Java call terminated by uncaught Java exception: java.security.AccessControlException: the Permission (java.io.FilePermission /tmp read) has not been granted to EWMTRACKTEST. The PL/SQL to grant this is dbms_java.grant_permission( 'EWMTRACKTEST', 'SYS:java.io.FilePermission', ' /tmp', 'read' )
ORA-06512: at "EWMTRACKTEST.GET_DIRLIST_EWM", line 1
ORA-06512: at line 1
thanks and regards
P Prakashit seems obvious, user EWMTRACKTEST doesn`t have access to directory /tmp and the file under that.
try to give read permission and try again.
you could use command line like 'chmod' to grant permissions. -
How to delete file from application server(Unix)
Hi All,
Using the below code downloading a file from application server(Unix) to client machine. I want to delete the file from application server once it is downloaded to client
We work on Forms 11.1.1.4.0 and Oracle DB 10g. Client machine are Windows 7.
BEGIN
IF webutil_file_transfer.AS_to_Client
(clientFile => Name_In('global.g_file_name')
,serverFile => ls_AppServer_Loc)THEN
message('Data exported Successfully');
ELSE
message('File download from Application Server failed');
END IF;
EXCEPTION
WHEN OTHERS THEN
message('File download failed: '||SUBSTR(sqlerrm,1,200));
END;
I have search for solution on OTN. Few suggested to use HOST.
Can any one help me how to use Host() built_in to delete the file.
Thanks,
MaddyCan any one help me how to use Host() built_in to delete the file.
Host('/bin/rm <complete file path>'); -
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) -
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 -
HOw to delete files from remote server?
Hi,
I want to delete files from a directory on remote server.
I use the following command to delete on current server:
find $srcdir -mtime +90 -name "COR*.txt" -exec rm -f {} \;
Now, how can I delete files from remote server ?
Thanks!
YoginiSome possible options:
1. There exists SSH implementation for Windows.
2. You can make a workaround. You can setup share for specific/wanted directory.
Then you can mount it on Linux machine and execute command localy and delete files "localy" in mounted directory.
3. You can setup FTP server on Windows machine and do that remotely via FTP commands. -
How to copy file from application server
Hello experts,
How to copy file from one folder of application server and paste it to other folder of application server(application server is same)?
Is there any function module exists???
thanks in advance
SaurabhHi you can use this function module to move a file from application server to another folder on application server.
call function 'WS_FILE_COPY'
exporting
destination = m_destination
source = m_source
importing
return = return.
Plus u can use this function module to delete the file from that folder from which u want to replace it.
call function 'WS_FILE_DELETE'
exporting
file = m_source
importing
return = return.
The above FM can help u copy a file from one folder to another and delete the file from that folder. -
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 get file from FTP Server using File Control
Hi,
Any one did getting file from FTP Server?
Please let me know any one help me.
I would need to get file from FTP Server.
Thanks,
MadhuYes I have done that. But In FTP Server I cannt read file, because no previliges. Only I need to copy file from FTP Server to local server then only I can read that file.
I tried all options using FileConrol(getFiles(),read()).
getFiles() - It wont copy the file, it give information about file.
read() - I dont have previliges to read the file.
Please tell me any other procedure would be there for getting file from FTPServer.
Thanks,
Madhu
Maybe you are looking for
-
I can no longer print e-mails now that I've made my Brother printer wireless.
Until I added my Brother MFC-495CW to my home network so I could print wirelessly, I could print e-mails. Now I cannot using Mozilla Firefox. However, Word, Excel, Adobe, Internet Explorer will all print documents. The printer just sits there as if i
-
Extraction of 2LIS_11_VAHDR and 2LIS_11_VAITM
Experts, We have new BI system and connected to ECC. I have activated the captioned DataSources in RSA5 and can see them in RSA6. In LBWE, I have activated the MC11VA0HDR and MC11VA0ITM by changing the Inactive on right side to active. Then filled th
-
I have KOBO on my Android A500, silver / Adobe Digital Editions?
I have a KOBO app uploaded on my Android A500, silver. How do I upload a book into my Adobe Digital Editions? I am just getting used to the android way of doing things. Thank you for any assistance that you can give.
-
ECL Viewer on 2 different locations in the SAPGui Installation server
I've installed the SP 13 of the SAPGui Installation Server. Can anyone explain me why the ECL Viewer is installed 2 times in the SAPGui Installation server. One time as a separate product and one as a General Add-On in the SAPGui 7.1 Product. Does
-
Hi all. I've installed all. I've try to execute this to check if I can use the scanner (the scanner work well on open office and others): [cut] public Scan() { java.util.Vector v; CaptureDeviceInfo deviceInfo; System.out.println("new FirstConnection(