Download File from BSP-Application
Hello !
i hope i can get some help for my problem.
from my BSP-Application i want to download an internal table to p:\eigenedateien\bv.txt (always the same filename)
the internal table ist type table of string.
i read that gui_download doesn't work in my BSP
so i went through this weblog 756
but it is really hard.
i put some code from the weblog in my application:
concatenate 'attachment; filename='
w_para-pwert = p:\eigenedatieen\bv.txt
w_para-pwert into dl_pathfile.
Download der Datei
Create the cached response object that we will insert our content into
dl_xstring = 'Test'. "nur zum testen
CREATE OBJECT CACHED_RESPONSE TYPE CL_HTTP_RESPONSE
EXPORTING ADD_C_MSG = 1.
set the data and the headers
CACHED_RESPONSE->SET_DATA( DL_XSTRING ).
CACHED_RESPONSE->SET_HEADER_FIELD( NAME =
IF_HTTP_HEADER_FIELDS=>CONTENT_TYPE
VALUE = 'text/html' ).
Set the filename into the response header
CACHED_RESPONSE->SET_HEADER_FIELD( NAME = 'Content-Disposition'
VALUE = DL_PATHFILE ).
Set the Response Status
CACHED_RESPONSE->SET_STATUS( CODE = 200 REASON = 'OK' ).
Set the Cache Timeout - 60 seconds - we only need this in the cache
CACHED_RESPONSE->SERVER_CACHE_EXPIRE_REL( EXPIRES_REL = 60 ).
Create a unique URL for the object
CALL FUNCTION 'GUID_CREATE'
IMPORTING
EV_GUID_32 = GUID.
CONCATENATE RUNTIME->APPLICATION_URL '/' GUID INTO URL.
Cache the URL
CL_HTTP_SERVER=>SERVER_CACHE_UPLOAD( URL = URL
RESPONSE = CACHED_RESPONSE ).
Ende Download
now it should be cached.
but hot can i start the download to p:\eigenedateien... now?
thanks very much for your help
Helmut
Hi,
Could you try adding at the end:
navigation->response_complete( ).
and/or
data: guid type guid_32,
display_url TYPE string.
call function 'GUID_CREATE'
importing
ev_guid_32 = guid.
concatenate runtime->application_url '/' guid into display_url.
cl_http_server=>server_cache_upload( url = display_url response = cached_response ).
Best regards,
Guillaume
Message was edited by: Guillaume Garcia
Similar Messages
-
Download File from BSP to presentation server.
Hi all,
We have a requirement to Download and Upload a file in Standard BSP application HRECM_BDG_MAINT.
Flow of the logic is :
1. On click on Download button. A Save file dialog should come and then user will select the path for saving the file. Then the internal table sholud be save in excel on the presentation server.
2. User will modify the excel file.
3 on click of upload button again the open dialog should come and then user will select the excel file from the presentation server and then file will be uploaded into the BSP application.
Note : We are very much clear with the functionality. Over main concern is to get the file dialog popup on the BSP application.
Changes in the layout (Download & Upload Button) has been created.
Actually HRECM_BDG_MAINT call another BSP application HR_ECM_BDG_SRV02.
Controller class of of page budget_details.bsp (HR_ECM_BDG_SRV02) is CL_HRECM00_BSP_BDG_DETAILS.
All the button displayed in this BSP page are created at runtime in class (CL_HRECM00_BSP_BDG_DETAILS) in method DO_REQUEST. We have used enhancement spot and added two more buttons (Download and Upload).
Now our main problem is to get file dialog popup on the BSP screen when we click on that button.
Kindly help
Ankit GuptaHello
I have a BSP that shows all the client data and generate a file when a boton is push.
What I need to know is; how can i made that the system generate a file for each client without having the internet explorer pup-up for download each time, furthermore, I want that these files to be located at the local unit C:\.
The code i have is as follow:
DATA: fichero TYPE string.
CONCATENATE 'F' vnomfich '.xls' INTO vnomfich.
some Browsers have caching problems when loading Excel format
response->delete_header_field( name = if_http_header_fields=>cache_control ).
response->delete_header_field( name = if_http_header_fields=>expires ).
response->delete_header_field( name = if_http_header_fields=>pragma ).
start Excel viewer either in the Browser or as a separate window
response->set_header_field( name = if_http_header_fields=>content_type
value = 'application/vnd.ms-excel' ).
CONCATENATE ' attachment; filename= ' vnomfich INTO fichero.
response->set_header_field( name = 'Content-Disposition'
value = fichero ).
finally display Excel format in Browser
response->set_cdata( data = l_output ).
do not process Layout, response has been rendered
navigation->response_complete( ). -
Download Text file to Local drive from BSP Application
Hi Guys,
I am new to BSP, and I am doing a BSP application in which i want to download a text file to local drive C: on click of button. For that I am having a data in Internal table and Onclick event, in model class method DO_HANDLE_EVENT i want to download text file to local machine drive.
Can anybody provide me full code with all data declaration and all?
Your help would be appriciable. Thanks in Advance.Hi Jessy ,
You can download the file from BSP pages using the method
CL_BSP_UTILITY=>download.
Please follow the below mentioned steps.
1.Convert the text to a text table ie Internal table with a line type char255 or some others.
2.Convert the text table into a string.
3.Convert the string to XSTRING.
4.Download that XSTRING as text file using the method
CL_BSP_UTILITY=>download.
Parameters:
OBJECT_S - XSTRING data
CONTENT_TYPE = ' application/download'
CONTENT_DISPOSITION = 'attachment; file=test.txt'
RESPONSE = runtime->server->response
NAVIGATION = navigation
OBJECT_T
I dont have system to give a programatical explanation to u.
If you have any doubt kindly post.
Reward for every useful solutions..
Best Regards
Renga -
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 -
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 -
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. -
Download files from application server - unknown file name
Hello everybody,
I am working on a report allowing users to download XML files from the application server. All these XML files are created by the SAP system and their names can be found in a table. I can simply use OPEN DATASET for these files, put all file content to a buffer and send them to the GUI with CALL METHOD cl_gui_frontend_services=>gui_download.
The problem is now that some files are touched by an external document management system. These files are moved to another directory and timestamped. The first is no problem since the folder name is always the same and can be replaced before the OPEN DATASET statement. But additionally, the file gets a timestamp, when the filename was xyz.xml before, it now gets xyz.xml.01012008123456123456. As I cannot try all possible values (mircoseconds!), I need a way to search for the right filename on the application server. Is there a function module for this available?
It can always be stated that the former name (xyz.xml) is still a unique prefix, so I don't have to worry that xyz.xml.* will return multiple files.
Thanks in advance for any suggestions.
ChristophHI!
I copy the function GET_DIRECTORY_FILE. In the eyelash of tables create one structures:
DIR_FILES LIKE ZDIR_FILES
The single structure has component NAME (char 250).
I code of the function that I use is:
FUNCTION zget_directory_file.
""Interfase local
*" IMPORTING
*" REFERENCE(NAME_OF_DIR) TYPE CHAR120
*" REFERENCE(NAME_OF_FILE) TYPE CHAR120 OPTIONAL
*" REFERENCE(SP_CS) TYPE CHAR120 OPTIONAL
*" TABLES
*" DIR_FILES STRUCTURE ZDIR_FILES
DATA: a_dir_name TYPE char120,
a_generic_name TYPE char120,
a_must_cs TYPE char120.
a_dir_name = name_of_dir.
a_generic_name = name_of_file.
a_must_cs = sp_cs.
DATA: errcnt(2) TYPE p VALUE 0.
IF a_dir_name IS INITIAL.
MESSAGE e220. " 'Place cursor on valid line !'.
ENDIF.
CALL 'C_DIR_READ_FINISH' " just to be sure
ID 'ERRNO' FIELD file_list-errno
ID 'ERRMSG' FIELD file_list-errmsg.
CALL 'C_DIR_READ_START' ID 'DIR' FIELD a_dir_name
ID 'FILE' FIELD a_generic_name
ID 'ERRNO' FIELD file-errno
ID 'ERRMSG' FIELD file-errmsg.
IF sy-subrc <> 0.
sy-subrc = 4.
EXIT.
ENDIF.
file-dirname = a_dir_name.
DO.
CLEAR file.
file-name = '*.zip'.
CALL 'C_DIR_READ_NEXT'
ID 'TYPE' FIELD file-type
ID 'NAME' FIELD file-name
ID 'LEN' FIELD file-len
ID 'OWNER' FIELD file-owner
ID 'MTIME' FIELD file-mtime
ID 'MODE' FIELD file-mode
ID 'ERRNO' FIELD file-errno
ID 'ERRMSG' FIELD file-errmsg.
file-dirname = a_dir_name.
MOVE sy-subrc TO file-subrc.
CASE sy-subrc.
WHEN 0.
CLEAR: file-errno, file-errmsg.
CASE file-type(1).
WHEN 'F'. " normal file.
PERFORM filename_useable USING file-name file-useable.
WHEN 'f'. " normal file.
PERFORM filename_useable USING file-name file-useable.
WHEN OTHERS. " directory, device, fifo, socket,...
MOVE sap_no TO file-useable.
ENDCASE.
IF file-len = 0.
MOVE sap_no TO file-useable.
ENDIF.
WHEN 1. " end of directory
EXIT.
WHEN 4. " filename too long
MOVE sap_no TO file-useable.
WHEN OTHERS.
ADD 1 TO errcnt.
IF errcnt > 90.
EXIT.
ENDIF.
IF sy-subrc = 5.
MOVE: '???' TO file-type,
'???' TO file-owner,
'???' TO file-mode.
ELSE.
ULINE.
WRITE: / 'C_DIR_READ_NEXT', 'SUBRC', SY-SUBRC.
ENDIF.
MOVE sap_no TO file-useable.
ENDCASE.
PERFORM p6_to_date_time_tz(rstr0400) USING file-mtime
file-mod_time
file-mod_date.
* Does the filename contains the requested pattern?
* Then store it, else forget it.
MOVE-CORRESPONDING file TO file_list.
APPEND file_list.
MOVE file-name TO dir_files-name.
APPEND dir_files.
IF a_must_cs = no_cs.
MOVE-CORRESPONDING file TO file_list.
APPEND file_list.
ELSE.
IF file-name CS a_must_cs.
MOVE-CORRESPONDING file TO file_list.
APPEND file_list.
ENDIF.
ENDIF.
ENDDO.
ENDFUNCTION.
*& Form filename_useable
text
-->A_NAME text
-->A_USEABLE text
FORM filename_useable USING a_name a_useable.
*--================--
DATA l_name(75).
l_name = a_name.
IF l_name(4) = 'core'.
a_useable = sap_no.
ELSE.
a_useable = sap_yes.
ENDIF.
ENDFORM. "FILENAME_USEABLE
With this I obtain all the archives XML of that route in a table
DATA: zfiles LIKE STANDARD TABLE OF zdir_files WITH HEADER LINE.
CALL FUNCTION 'ZGET_DIRECTORY_FILE'
EXPORTING
name_of_dir = dsn
TABLES
dir_files = zfiles.
IF sy-subrc = 0.
LOOP AT zfiles .
IF zfiles-name+0(2) = 'O_' AND
zfiles-name+2(3) = sy-mandt AND
zfiles-name+5(1) = '_' AND
zfiles-name+22(4) = '.xml'.
file = zfiles-name.
endloop.
endif.
I hope this helps you.
Regards. -
PDF download from BSP application
hi all,
With the bellow code i am able to download to PDF from BSP application
Issue is when i click on the download button waiting popup window is not disappearing even after PDF displayed.
Please help me to resolve how to stop this waiting popup window.
response->delete_header_field( name = 'Cache-Control' ). "#EC NOTEXT
response->delete_header_field( name = 'Expires' ). "#EC NOTEXT
response->delete_header_field( name = 'Pragma' ). "#EC NOTEXT
Deactivated because of Note 904314 and Kompression in Kernel
response->set_compression( options = '4' ).
response->set_header_field( name = 'content-type'
value = 'application/pdf' ).
response->set_header_field(
name = 'cache-control'
value = 'max-age=0' ).
response->set_header_field(
name = 'content-disposition'
value = 'attachment; filename=candidate.pdf' ).
l_pdf_len = XSTRLEN( l_pdf_xstring ).
response->set_data( data = l_pdf_xstring
length = l_pdf_len ).
navigation->response_complete( ).
Any help on this is highly appreciated.
Thanks,
RaviMay be you can navigate to another page AFTER the response_complete() method and show the message that 'PDF is downloaded successfully'
or something meanful message. so that it will get a response back from server and 'wait...Processing' message might disappear.
I'm not sure and didnt try..may be you can give it a try and let us know..
navigation->response_complete( ).
navigation->goto_page(....) -
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. -
when i try downloading adobe pro i am getting an error message that is saying: The application could not be installed because the installer file is damaged. Try obtaining a new installer file from the application author.
Hi Kashmore,
Seems like the downloaded file was corrupt that could be because of either network restriction or the anti virus might have blocked it. My suggestion would be to try and download the product either by turning off the Antivirus or try a different network.
Cheers,
Kartikay Sharma -
Trying to download the free trial of Adobe Acrobat XL Pro. I keep getting the message "The application could not be installed because the installer file is damaged. Try obtaining a new installer file from the application author." I've repeatedly tried getting a new installer file, but get the same message every time.
K_don52 and Ande8135 please remove your current installation of the Adobe Download Assistant and reinstall. You can find more details in the known issues section of Troubleshoot Adobe Download Assistant.
-
i have created a ITS screen which in turn calls a Abap report
I want to call this ITS screen from a BSP application .
Could you please provide some sample code which is used to call ITS from BSP application..
Useful answers will be rewarded
ThanksSince it is related to both ITS and BSP i thought i can post it in both. and also i didnt get answers for the queries..... for a long time. Anyhow i will take your suggestion for my future query.
i hv done using iframe to call my ITS application.
I can able to call the Bsp application whichin turn calls its screen abap program.
while executing , the selecting the directory from the file browse pop up doesnt work for downloading the file
becos the client , they will not change the settings related to applet in the internet browser for security reasons.
I hav to make it some how to make it work in the portal which calls this BSP application..
at the moment i mapped this BSP application to the user role in the SUS Portal . but it appears in the SUS portal . but i m not able to click the application and also handsymbol is not seen while bringing the mouse to that area.
Could you please tell me , how to use Action_id for that particular application, Authorisation profile settings.
Kindly give your suggestions asap. -
Problem with downloading file from FTP server
Hello all
I have uploaded a file from an application i developed and i want to download this file from another application. The code is
public static void FTPcon() throws FtpException{
String hostname = "my.ftp.server";
String username = "myusername";
String password = "mypass";
Ftp ftp = new Ftp(hostname,username,password);
ftp.setHostname(hostname);
ftp.setUsername(username);
ftp.setPassword(password);
ftp.connect();
ftp.setBinary();
ftp.download("file.dat");
ftp.disconnect();
}The error i receive is java.io.FileNotFoundException: public.dat (The system cannot find the file specified) but the file is on the server.
Thanks in advance for any helpCotton thank you for your reply
Any other sugestions please?The server disagrees. So...
- the file does not existThe file exists.I checked it with an FTP client program.
- the file has a different nameThe file name is correct
- you are connected to the wrong serverI am connecting to the correct server
- you are in the wrong ftp directoryThe file is placed in the home directory
- the ftp library you are using is broken (less
likely)I am using the library from jscape.I dont think is broken because i can upload the file from the first application.
>
FTP isn't somehow broken in Java. I use it all the
time. The problem is something listed above. I would
check all of the first four if I were you because
that's most likely where the problem is.Message was edited by:
flightcaptain -
Uploading and downloading files from a web app (Urgent!!)
Hi everyone:
I'm developing an application in PL/SQL to upload and download files from an HTML webpage. I congured the document table and the parameters necessary in the DAD of my application.
when I upload the file using my webpage that file info is automatically uploaded to the doc table. This is as far as I have gotten.
I need to do the following:
- Place the uploaded file into a column in another table in my database as part of a text message (think of it as an email message), and delete the file from the doc table (as this is thought to be a temp table that holds the file when uploaded from my webpage)
- Retreive the file so that it can be downloaded from another web page.
The file can be a PDF, WORD DOC, etc...
I now that I can do this with InterMedia but I haven't figured out how :(
Can anyone please point me to an example or some documentation that can guide me through the process.
DB VERSION: 8.1.7
IAS VERSION: 1.0.2.2
Thanks,
Carlos AbarcaThe idea was for you to look at the code and get an idea of how to access the BLOB in the document table. IF you look at the procedure
insert_new_photo( new_description IN VARCHAR2,
new_location IN VARCHAR,
new_photo IN VARCHAR2 )
It shows how to access the blob that is stored in the document table. You can then copy this blob to your own table using the DBMS_LOB package.
Hope this helps,
Larry -
DATA TRANSFER - How to get a SINGLE SPACE in the downloaded file from UNIX?
Hi Experts,
Am sending data from SAP to UNIX/ Application server and text file on desk top as well.
So, I am keeping a single character just SPACE at the END of each record.
Then, When I see the downloaded text file, I found a SINGLE SPACE at the end of each record, fine.
Then, by using CG3Y t code, I downloaded the UNIX file to my desk top.
But, When I see this UNIX downloaded file from UNIX, I did NOT find any SPACE at the end of each record!!!
Am doing every thing same in both cases.
So,
1 - Why its happening in case of UNIX file?
2 - How to get a SINGLE SPACE at the END in the downloaded file from UNIX?
thanqHi,
I don't know if this works:
perform SET_TRAIL_BLANKS(saplgrap) using 'X'.
perform SET_FIXLEN(saplgrap) using '0' '060'. "put length of your line from-to
... download ...
It will put space at the end of your line, according to the length.
Hope it works,
Chang
Maybe you are looking for
-
Team calibration in flexible PMS EHP4
Hi PMS Gurus, Need your expert advise. We are implementing flexible PMS on EHP4 . Team calibration is a standard feature of Predefined PMS (EHP4 onwards). Due to heavy customization we are not implementing Predefined PMS but going for Flexibl
-
I would like to save (in Downloads) multi-page articles off the web
Dear Sir/Madam, Using the Save Page As....from the drop down window of Firefox 4 I could not save moe than the first page of a multi-page article. I could not figure out, from the available options, what else to use to achieve it.
-
How do i get the installation package for Adobe Bridge
Hello, Our Creative services Department have taken a Creative Cloud account and they only want to install Adobe Bridge, however when i access the Creative Cloud account there is no installer for Adobe Bridge. Now i believe Bridge is installed as part
-
How to optimize query in oracle??
hello all, i want to question this forum. How i can optimize query sql in oracle where i have data > 100.000 record in my table.. This is my query: select avg( select /*+ NO_USE_NL(B) */ (SUM(A.QTY_INSTORE) + SUM(A.QTY_DELIVERED)) TOTAL_DUMMY
-
Can multiple reports be clubed
dear all, i need to produce a report which contains the data from multiple tables. The queries are as follows: Query1: some no.of tables(with relations) Query2: some no.of tables(with relations) query3: some no.of tables(with relations) here there ar