Problem in Downloading File from Application Server
Hi All,
We have an Requirement that, iam putting the Flat File
( Output Of a Report ) in to the
Application Server(AL11) By using the OpendataSet, Transer , Close DataSet.
When iam trying to Downloading the Flat File through the FM, GUI_DOWNLOAD, the Data is coming Correctly.
But the Problem is , when trying to Downloading through AL11 i.e System -> List -> Local File it is not coming Correctly.
( Java People is going to Connect with the Application Server for the Flat File )
Kindly Clarify the Problem.
Points will be Rewarded.
Regards,
Kiran.I
Hi nl,
1. this program will display
selection screen
and ask two things :
a) application server filename
b) local file name
2. then it will download the file
(the file name is CASE Sensitivie)
3. just try it (just copy paste )
*& Report YBCR_FILEDOWNLOAD *
REPORT ybcr_filedownload .
DATA
DATA : file_name TYPE string.
DATA : BEGIN OF itab OCCURS 0,
ln(255) TYPE c,
END OF itab.
SCREEN
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : appfn(150) TYPE c LOWER CASE OBLIGATORY.
PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
file_name = p_file.
START-OF-SELECTION
START-OF-SELECTION.
OPEN DATASET appfn FOR INPUT IN TEXT MODE ENCODING DEFAULT .
IF sy-subrc <> 0.
MESSAGE s999(yhr) WITH 'COULD NOT OPEN FILE ON APP SERVER'.
LEAVE LIST-PROCESSING.
ENDIF.
DO.
READ DATASET appfn INTO itab.
IF sy-subrc = 0.
APPEND itab.
ELSE.
EXIT.
ENDIF.
ENDDO.
file_name = p_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = file_name
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = itab
FIELDNAMES =
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
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
regards,
amit m.
Similar Messages
-
Error in PDF Conversion while downloading file from application server
Hi,
I am facing a problem in which i have to download file from application server which is a PDF file (output of SAP Script). I am downloading this file using following code in BSP technology:
* event handler for data retrieval
EMPCD = REQUEST->GET_FORM_FIELD( 'emp' ).
MONTH = REQUEST->GET_FORM_FIELD( 'mn' ).
YEAR = REQUEST->GET_FORM_FIELD( 'yr' ).
W_IND = 'N' .
DATA : wa_zform16 type zform16.
DATA : file_path type string.
DATA : l_pdf_len type string.
DATA STR TYPE STRING.
DATA: OUTPUT TYPE STRING ,
L_XSTRING TYPE XSTRING ,
APP_TYPE TYPE STRING.
DATA: PDF_TABLE TYPE RCL_BAG_TLINE.
DATA PHY_NAME_OUT TYPE SAPB-SAPPFAD.
concatenate '/usr/sap/put/form16/' EMPCD '_' YEAR '.PDF' into file_path
*PHY_NAME_OUT = '/usr/sap/put/form16/01000200_2007.PDF'.
PHY_NAME_OUT = file_path.
OPEN DATASET PHY_NAME_OUT FOR INPUT IN TEXT MODE ENCODING default.
IF SY-SUBRC IS INITIAL.
DO.
READ DATASET PHY_NAME_OUT INTO STR.
IF SY-SUBRC IS INITIAL.
CONCATENATE
OUTPUT
STR
CL_ABAP_CHAR_UTILITIES=>CR_LF
INTO OUTPUT.
ELSE.
EXIT.
ENDIF.
ENDDO.
APP_TYPE = 'APPLICATION/PDF'.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = OUTPUT
MIMETYPE = 'APPLICATION/PDF'
* MIMETYPE = 'APPLICATION/PDF;charset=utf-16le'
IMPORTING
BUFFER = L_XSTRING.
CALL METHOD CL_BSP_UTILITY=>DOWNLOAD
EXPORTING
OBJECT_S = L_XSTRING
CONTENT_TYPE = APP_TYPE
CONTENT_DISPOSITION = 'attachment;filename=webforms.pdf'
RESPONSE = _M_RESPONSE
NAVIGATION = NAVIGATION.
Result of this code is : there is a pop up asking to open or save pdf format and process is complete, but i have problem in downloaded file.
At the time of creation i have put BMP image for signature in PDF file and it is working fine but when i upload that file in Application server and then download it with above used code it save the PDF file but when i open that file so whereever i have used signature that page gives error and could not display that scanned signature.
Can anyone please help me in this regard.
or is there any possibility from which i can download that file just like File transfer from BSP.
Keep in mind that i am using BSP technology so all GUI based function module to download file are not working.
waiting for your reply.....
Regards,
GaganHi Raja,
I have standard sap form for TDS Certificate on which i have include an BMP image for digital signature and download that script into pdf format.While i download that PDF looks ok but it is not working in BSP.
Regards,
Gagan -
Downloading file from application server to presentation server
Hi,
We have a requirment to download file from application server to presentation server. The problem is while down loading, some of the filds showing some junk values. Instead of that junk values we have some Russian texts there. These Russian texts only coming as junk all other data is correct. The file in the appplication server is in .dbf format. We are downloading using WS_DOWNLOAD. file type is BIN and code page we didn't specified.
Thanks in Advance
Jijeesh.P.G
Message was edited by: Jijeesh.P.G
Jijeesh P Ghi jijeesh,
Welcome to SDN.
u can use to download file from application server to presentation server using the t/c CG3Y. in that it will ask the source file path and the target file path.
if u want to find the source file path in the application server, u can use the transaction AL11 to find that one.
Regards....
Arun.
Reward points if useful. -
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 download files from Application Server of Unix o.s to local director
Hi All,
I am trying to download files from Apllication server of Unix operating Systems to local file in excel sheet format using a z-program.but whenever I am trying to use OPEN dataset ........
it is showing sy-subrc = 8.
Can I have any clew please.
Thanks in advance,
Regards,
AMEER.Hi Sreekanth,
Thanks a lot for quick reply.I have to download that files from z-program only. I am giving you my code below.
*& Report ZTRAK_DOWNLOAD *
REPORT ZTRAK_DOWNLOAD MESSAGE-ID ZCT .
SELECTION-SCREEN BEGIN OF BLOCK DOWNLOAD WITH FRAME TITLE TEXT1.
PARAMETERS :
SERDIR LIKE RLGRAP-FILENAME DEFAULT '/usr/trak',
LOCDIR LIKE RLGRAP-FILENAME DEFAULT 'C:\Trak'.
SELECTION-SCREEN END OF BLOCK DOWNLOAD .
SELECTION-SCREEN BEGIN OF BLOCK INFO2 WITH FRAME.
SELECTION-SCREEN COMMENT 1(79) TEXT2.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT 1(79) TEXT3.
SELECTION-SCREEN END OF BLOCK INFO2 .
SELECTION-SCREEN BEGIN OF BLOCK INFO3 WITH FRAME.
SELECTION-SCREEN COMMENT 1(79) TEXT4.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT 1(79) TEXT5.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT 1(79) TEXT6.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN COMMENT 1(79) TEXT7.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN COMMENT 1(79) TEXT8.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN COMMENT 1(79) TEXT9.
SELECTION-SCREEN END OF BLOCK INFO3.
*- Internal Table to output data in Excel
DATA: BEGIN OF tab_excel OCCURS 0,
col1(50),
col2(132),
col3(255),
col4(100),
col5(100),
col6(50),
COL7(60),
col8(30),
col9(30),
col10(30),
col11(20),
col12(15),
col13(15),
END OF tab_excel.
DATA: FILE LIKE RLGRAP-FILENAME .
DATA: W_DATASET(80).
INITIALIZATION.
TEXT1 = 'Download Reports'.
TEXT2 = 'The Program downloads the reports generated by Trak'.
TEXT3 = 'Utility from Server to Local PC.'.
TEXT4 = 'Check the following before executing the Program.'.
TEXT5 = ' 1. A valid Server path is provided.'.
TEXT6 = ' 2. A valid Local PC path is provided.'.
TEXT7 = ' 3. Local PC has 10 MB free space.'.
TEXT8 = 'The report can be executed in the forground.'.
TEXT9 =
'The report should be executed after execution of Transaction TRAK'.
AT SELECTION-SCREEN.
IF SERDIR EQ ''.
MESSAGE E001(ZCT).
ENDIF.
IF LOCDIR EQ ''.
MESSAGE E002(ZCT).
ENDIF.
START-OF-SELECTION.
Download ABAP Development Summary Report
FILE = '\ABAP_Report_Developments.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/ABAP_Report_Developments.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download BDC Development Report
FILE = '\BDC_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/BDC_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Development Summary Report
FILE = '\Developments_Summary_Report.XLS' .
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/Developments_Summary_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Enhancement Development Report
FILE = '\Enhancement_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/Enhancement_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download field exit Development Report
FILE = '\Field_Exit_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/Field_Exit_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Frequency & Purpose Report
FILE = '\Frequency_And_Purpose_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/Frequency_And_Purpose_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Function Group Developments Report
FILE = '\FunctionGroup_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/FunctionGroup_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Function Module Developments Report
FILE = '\FunctionModule_Developments_Report.XLS' .
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/FunctionModule_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Include Developments Report
FILE = '\Include_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/Include_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download UserGroup Developments Report
FILE = '\UserGroup_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/UserGroup_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Modified_Standard_SAP_Objects_Report
FILE = '\Modified_Standard_SAP_Objects_Report.XLS' .
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/Modified_Standard_SAP_Objects_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Include Developments Report
*FILE = '\Include_Developments_Report.XLS'.
*CONCATENATE LOCDIR FILE INTO FILE.
*W_DATASET = '/Include_Developments_Report.dat'.
*CONCATENATE SERDIR W_DATASET INTO W_DATASET.
*PERFORM INIT.
Download SAP Script Developments Report
FILE = '\SAP_Scipt_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/SAP_Scipt_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Transaction Developments Report
FILE = '\Transaction_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/Transaction_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download User Exits Developments Report
FILE = '\UserExits_Reports.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/UserExits_Reports.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download ABAP Query Developments Report
FILE = '\ABAPQuery_Developments_Reports.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/ABAPQuery_Developments_Reports.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Functional Area Developments Report
FILE = '\FunctionalArea_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/FunctionalArea_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
MESSAGE S003(ZCT) WITH LOCDIR.
END-OF-SELECTION.
This routine checks whether file exists if yes downloads it to
the Local PC
FORM INIT.
OPEN DATASET W_DATASET FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
READ DATASET W_DATASET INTO tab_excel.
APPEND tab_excel.
CLEAR tab_excel.
ENDDO.
PERFORM DOWNLOAD_FILE.
ENDFORM.
This routine downloads the data in an XL format on local PC
FORM Download_File .
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = FILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = tab_excel
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF sy-subrc <> 0.
message ''. " Error in file transfer
ELSE.
CLEAR TAB_EXCEL.
REFRESH TAB_EXCEL.
FILE = ''.
W_DATASET = ''.
ENDIF.
ENDFORM.
I have created those files in Application Server running in another z-program in background mode.Then I am trying to download those files using above the program.I am creating those trak/Trak files manually and I can able to see those files in A.S level.But when downloading the same files I am facing the problem.
regards,
Ameer -
Problem in uploading file from Application Server
Hi everyone,
i got a problem in uplaoding a file from application server.i am having two folder (one folder name is current and another one is processed)in application server. In current folder i am having N no of files.I want to upload all the files names into one internal table and i want to process one by one file.After processing each file the file should be moved to processed folder and the files should not exist in current folder.All these process must be done everyday.Please rectify my problem asap.Ramesh,
Take authorization from basis guy.
Use the below code to get the list of files from require directory
*& Report ZDIRFILES *
REPORT ZDIRFILES .
PARAMETER: p_fdir type pfeflnamel DEFAULT '/usr/sap/tmp'.
data: begin of it_filedir occurs 10.
include structure salfldir.
data: end of it_filedir.
*START-OF-SELECTION
START-OF-SELECTION.
Get Current Directory Listing for OUT Dir
call function 'RZL_READ_DIR_LOCAL'
exporting
name = p_fdir
tables
file_tbl = it_filedir.
Now in internal table "it_filedir" will have all your files.
For moving and deleting
report zrich_0001.
Parameters: d1 type localfile default '/usr/sap/TST/SYS/fld1/Data1.txt',
d2 type localfile default '/usr/sap/TST/SYS/fld2/Data1.txt'.
data: begin of itab occurs 0,
rec(20) type c,
end of itab.
data: wa(20) type c.
start-of-selection.
open dataset d1 for input in text mode.
if sy-subrc = 0.
do.
read dataset d1 into wa.
if sy-subrc <> 0.
exit.
endif.
itab-rec = wa.
append itab.
enddo.
endif.
close dataset d1.
open dataset d2 for output in text mode.
loop at itab.
transfer itab to d2.
endloop.
close dataset d2.
delete dataset d1.
Check below FM if required
To move the file to archive directoryuse FMs 'PFL_COPY_OS_FILE'
To Delete 'EPS_DELETE_FILE'.
Don't forgot to reward if useful -
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. -
Urgent : Download file from Application Server via Process Chain.
Hi Experts,
My requirement is to download the file from Application Server to local work station using an ABAP Program .
I want including the above ABAP program in a process chain to execute the program daily,
I tried to use ARCHIVFILE_SERVER_TO_CLIENT and GUI_DOWNLOAD but unfortunately both the above FM doesn't support to run through Process chain.
Can any one of you help me to send the code which selects a file from application server, downloads to local system and deletes it.
Thank you very much for spending your precious time in this regard.Hi Sailekha,
Regarding your case ..
I suggest you to create the program where it run this function: WS_DOWNLOAD.
After it, the program is run by your process chain.
Hopefully it can help you a lot.
Regards,
Niel.
thanks for the points you choose to assign. -
Problem while downloading data from Application server.
Hi
I have create a file on the application server.
When i tried to download the file from application server into Excel file , all the fields in the file appear in the same column.
How can place the fields separately in different columns in the Excel.
Thanks
Subha
Edited by: subhacp on Sep 5, 2011 8:32 AMHi,
Try to use below function module where you need not to do anything new, just give path of the directory where you want to store on your workstation in the parameter I_FILE_FRONT_END and give path of your application server from where you want to pick file which is in .XLS format in the FM parameter I_FILE_APPL .
It will simply copy the file from Apllication server to your workstation in the same format and with the same characters.
CALL FUNCTION 'C13Z_FILE_DOWNLOAD_BINARY'
EXPORTING
I_FILE_FRONT_END = pr_down
I_FILE_APPL = l_w_file
I_FILE_OVERWRITE = 'X'
* IMPORTING
* E_FLG_OPEN_ERROR =
* E_OS_MESSAGE =
EXCEPTIONS
FE_FILE_OPEN_ERROR = 1
FE_FILE_EXISTS = 2
FE_FILE_WRITE_ERROR = 3
AP_NO_AUTHORITY = 4
AP_FILE_OPEN_ERROR = 5
AP_FILE_EMPTY = 6
OTHERS = 7
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 will solve your query. -
Downloading file from application server in Binary mode
Hi,
I am trying to read an application server file using open dataset in Binary Mode..
While downloading using gui_download method the file is getting truncated because of its size.
My questions are,
How to increase the size of the internal table dynamically. Already tried using STRING type but it is not accepting.
If I use the CHAR type with maximum length 65535 and if the length of the file is less than that then in the remaining spaces box like symbols are printed .
How can I achieve it.
Thanks & Regards,
NJTYPES: BEGIN OF type_download,
data1 TYPE zchar20000,
data2 TYPE zchar20000,
data3 TYPE char3000,
data4 TYPE char2000,
END OF type_download.
DATA: lt_download TYPE STANDARD TABLE OF type_download,
lx_download TYPE string,
lv_filename TYPE string.
Read data from application server to internal table
OPEN DATASET p_p_ftappl FOR INPUT IN BINARY MODE.
IF sy-subrc = 0.
Read file
DO.
CLEAR lx_download.
READ DATASET p_p_ftappl INTO lx_download.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND lx_download TO lt_download.
ENDDO.
Download data to presentation server from internal table
lv_filename = p_p_ftfron.
Download data from application server to PC
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize =
filename = lv_filename
filetype = c_bin
append = space
write_field_separator = space
header = '00'
trunc_trailing_blanks = 'X' "space "commented
trunc_trailing_blanks_eol = 'X' "added
IMPORTING
filelength =
CHANGING
data_tab = lt_download.
*Exceptions deleted .
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Close file
CLOSE DATASET p_p_ftappl.
Edited by: NewJoinee123 on Mar 25, 2010 8:45 AM -
Problem during retriving file from application Server
Hi all,
i am trying to upload a world file (from desktop ) on application server and
retrieve it back on local desktop.
during retrieval of file from application server i am getting all the data in encoded format .
i am using -
open DATASET p_fpath for output in text mode encoding UTF-8 WITH SMART LINEFEED.
plz help.Hi,
use the tcodes CG3Y and
CG3Z
Or
try with this command
open DATASET p_fpath for output in text mode encoding default.
Regards,
nagaraj -
Problem in download file from FTP server
Hi
I want to download a file from FTP server for that i am using the apache FTP module but i am not getting how to download a file with that api i can dispaly the list of files and folders but not able to download the file or folder can any one help me in this
Thanks
NinadHi
I think you miss understood something I am writing a program to download the file in Java where i have used the jakarta.apache api for that and getting problem in that bellow is the code where I have written to print the directory & file names but I don't know how to download the file
FTPClient ftpConnection = new FTPClient();
ftpConnection.connect(host);
ftpConnection.login(FTPConnection.userName,FTPConnection.password);
FTPFile fileList[] = ftpConnection.listFiles();
for(int i=0;i<fileList.length;i++)
System.out.println(fileList.getName());
thanks
Ninad -
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. -
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. -
Japanese character problem while downloading file to application server
Hello All,
We are facing a strange problem while downloading a file to application server when file contains japanese text.
We are downloading vendor and customer information in a flat file format on application server. When the login language is EN program show ouput in a properly formatted manner.
When the login language is JA (japanese) program does download file with customer vendor data. I can see the description is japanese language but the formatting is gone for a toss.
We are facing similar issue with other programs downloading files on the application server.
I am using OPEN DATASET........ENCODING DEFAULT. and working on unicode enabaled ECC 6.0 system
Quick help appriciated.
Thanks!Hi
Sometimes this also happens because of your desktop setting.Make sure that your OS also supports the JAPANESSE language.
Ask your technical support team to enable them in your desktop.
Thanks & Regards
Jyo
Maybe you are looking for
-
Please help new (senior) convert to Mac Pro (OS X). Am following the 'switching to a Mac' portable genius 2nd ed, and as it advised, I bought an external hard drive (a Mac My Word) and partitioned it with one partition for a secondary boot device an
-
HT3847 How is the best way to separate copied MP3 from AIFF files in my library?
How is the best way to separate duplicate MP3 from AIFF files in my library?
-
New iWeb Weblog - Where is Save As option?
Hi. I am using iWeb for the first time. It is version 3.0.2 (489). I used *New Page* (and *New Site* too when trying to figure this out) under the File menu and then selected a template as prompted. After making my changes to the template to what I w
-
Organizing iPhoto Library in Finder
I was wondering if someone could tell me how to better organize my iPhoto library in Finder. Right now, the automatic setting, it is organzing them by year, month, day. I dont know if there is a way to have them organized in Finder by the albums you
-
Hi, I have a servlet deployed in Tomcat (v5.0.12) that invokes a C++ DLL written by me. Some other Java classes that are used by my Servlet are stored in a folder C:\MyClasses (in a package called com.batra.amit). The folder C:\MyClasses is in Tomcat