Exception in CL_GUI_FRONTEND_SERVICES= FILE_COPY
Hi,
I am trying to use FILE_COPY method and getting an exception 'CNTL_ERROR'. I am also using another method as FILE_EXIST and getting same exception. But in this method 'GET_WINDOWS_DIRECTORY' I don't get any error and I am getting the windows directory as expected. And the interesting method is DIRECTORY_CREATE. After I called this method I am getting 'OTHERS' as exception, but the directory is created. Additonally, these methods are called with SAP 4.6 for this computer.
When I use these method on another computers which have SAP 6.4 or 6.2, I don't get these errors/exceptions.
Although all of the Application SAP Server are same for three computers, why there is a difference? And how can I solve the problems for first computer?
Thanks.
John,
1. I am sure that source file is exist. And the path is true.
2. The destiantion is true also. and before copy operation, destination path has not have this file. Also, I have declared overrite to true in FILE_COPY method.
I want to ask CNTL_ERROR when happens? And I have seen some topics about CL_GUI_FRONTEND_SERVICES can not be used in SAP Gui 4.6. Is it possible to get more information about not to use in 4.6?
Additionally, I am connecting for all three computers using remote desktop. But as I said in previous message, problem only occurs the computer which's SAP Gui is 4.6
Similar Messages
-
Runtime Error : cl_gui_frontend_services file_copy
Dear Experts,
I am using the method cl_gui_frontend_services=>file_copy to copy file from one location to another location.
But when either of the input parameters are invalid, the program throws a short dump like path_not_found, access_denied, file_not_found.
I think internally, the program calls raise satement.
How to handle these exceptions in order to avoid runtime errors/short dump?
Is there any exception class for all these type of exceptions?
Thanks in AdvanceHi,
You may use ST22 and check which exception is beign raised under which scenarion.
Once you are ready with list of all Exceptions keep the Method call in TRY. ENDTRY. Block
and after the Method call use Catch Exception to catch all the possible exception into their Class Reference.
Thanks,
Preyansh -
File copy through cl_gui_frontend_services= file_copy
Hi,
Can I use
call method cl_gui_frontend_services=>file_copy
exporting
source = filenam
destination = ifile2
overwrite = abap_true
exceptions
others = 13.
for copying file from local machine to folder which is created on server.
thanxs
Pratibha
Edited by: pratibhas on Jan 15, 2010 12:46 PMHi,
You will not be able to use CL_GUI_FRONTEND_SERVICES. U can use FILE_UPLOAD ui element to upload the data from local system to the internal table.
Rangananthan -
Hello
I have an existing program which uses FM WS_FILE_COPY to copy file from presentation server to destination server.
This function modules return code is 1.
Need to investigate what is the reason for return code <> 0.
Have also tried the method CL_GUI_FRONTEND_SERVICES-FILE_COPY this returns 5 --> access denied...
Can anyone help me to find what the problem is ...
Thanks!!Hi ,
That means you do not have the permission.
Please find the series of errors you will get by using CL_GUI_FRONTEND_SERVICES-FILE_COPY
No ERROR_NO_GUI Description
1 CNTL_ERROR Control error
2 ERROR_NO_GUI No GUI Available
3 WRONG_PARAMETER Incorrect parameter
4 DISK_FULL Disk full
5 ACCESS_DENIED Access Denied to Source or Destination File
6 FILE_NOT_FOUND Source File not Found
7 DESTINATION_EXISTS Destination Already Exists
8 UNKNOWN_ERROR Unknown Error
9 PATH_NOT_FOUND Path to Which You Want to Copy File(s) Does not Exist
10 DISK_WRITE_PROTECT Disk Is Write-Protected
11 DRIVE_NOT_READY Disk drive not ready
12 NOT_SUPPORTED_BY_GUI GUI does not support this
Regards,
Adil -
Exceptions in cl_gui_frontend_services= file_open_dialog
hi when upgrading from 4.5 to 6.o Im getting the following exception
When the pop up box is cancelled during the download option, a success message is displayed in 6.0 whereas an error message is displayed in 4.5.
here is the code
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
DEFAULT_EXTENSION = '*.xls,'
DEFAULT_FILENAME = '*.xls,'
FILE_FILTER = '.'
CHANGING
file_table = W_FILENAME
rc = w_rc
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5.
IF W_RC IS NOT INITIAL.
READ TABLE W_FILENAME INTO W_AREA INDEX 1.
IF SY-SUBRC = 0.
L_FILE = W_AREA-FILENAME.
ENDIF.
ENDIF.
IF SY-SUBRC EQ 3.
MESSAGE I999 WITH 'Action Cancelled by user'(044).
EXIT.
ENDIF.
plz tell me where is the erorchk the data declearsation data type.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Import from a local file'
default_extension = 'DAT'
DEFAULT_FILENAME =
file_filter = l_file_filter
initial_directory = 'C:\'
MULTISELECTION =
WITH_ENCODING =
CHANGING
file_table = l_file_table
rc = l_rc
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
FILENAME = V_FILE
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
CHANGING
DATA_TAB = IT_MAIN[]
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
OTHERS = 23.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
Hello Everyone,
My program not working when sceduled to run in background, but works fine when run in foreground. Think i need to change some funcution modules as the ones i used are, think, referencing for foreground processing. Can anyone point to some function modules which does the job for me.
I am picking up the files from file server.
REPORT zco11n
NO STANDARD PAGE HEADING
LINE-SIZE 255.
INCLUDE zdeclerations. " Data Declarations part
*---------------Get actual filepath from logical filepath---------------------*
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
* CLIENT = SY-MANDT
logical_filename = 'ZBARCODE_APPLICATION' "logical path
IMPORTING
file_name = pa_file "actual path
EXCEPTIONS
file_not_found = 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.
*---------------Get all the required files from the directory-------------------*
CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
EXPORTING
directory = pa_file "Directory path
filter = '*.CSV'
TABLES
file_table = lt_file "Files in the direcory
dir_table = lt_dir
EXCEPTIONS
cntl_error = 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.
*-------Get the directory and file name as single path & move to internal table----*
LOOP AT lt_file INTO lw_file.
CONCATENATE pa_file lw_file-pathname INTO lstring.
MOVE lstring TO lw_filename-pathname.
MOVE lw_file-pathname TO lw_filename-filename.
APPEND lw_filename TO lt_filename.
CLEAR lw_filename.
CLEAR lw_file.
ENDLOOP.
START-OF-SELECTION.
LOOP AT lt_filename INTO lw_filename.
file_name = lw_filename-pathname.
*-------Read the contents of the file to an internal table--------------------------*
CALL FUNCTION 'DX_FILE_READ'
EXPORTING
filename = file_name
pc = 'X'
TABLES
data_tab = lt_temp "File contents
EXCEPTIONS
no_file_on_server = 1
no_data_on_server = 2
gui_upload_failed = 3
no_authority = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
*-------------Split and move the contents as required for BDC---------------*
LOOP AT lt_temp INTO lw_temp.
SPLIT lw_temp AT ',' INTO lw_afrud-aufnr lw_afrud-lmnga lw_afrud-budat.
APPEND lw_afrud TO lt_afrud.
ENDLOOP.
************----------Start Of BDC-----------------------***************
LOOP AT lt_afrud INTO lw_afrud.
PERFORM bdc_dynpro USING 'SAPLCORU_S' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'AFRUD-AUFNR'
lw_afrud-aufnr.
PERFORM bdc_field USING 'AFRUD-LMNGA'
'1'.
PERFORM bdc_field USING 'AFRUD-ISDZ'
'00:00:00'.
PERFORM bdc_field USING 'AFRUD-IEDZ'
'00:00:00'.
PERFORM bdc_field USING 'AFRUD-PEDZ'
'00:00:00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'AFRUD-BUDAT'.
PERFORM bdc_field USING 'AFRUD-BUDAT'
lw_afrud-budat.
PERFORM bdc_dynpro USING 'SAPLCORU_S' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
CALL TRANSACTION 'CO11N' USING lt_bdcdata MODE 'N'
UPDATE 'S' MESSAGES INTO lt_bdcmsgcoll. "#EC CI_CALLTA
ENDLOOP.
*******-----------End of BDC-------------------------------------*******
CLEAR lw_afrud.
REFRESH lt_afrud.
************************File Manipulations*********************
lv_file_name = lw_filename-filename. "Assign the filename to a local variable
CONCATENATE '\CAUVERYSAPBARCODESUCCESS'
lv_file_name INTO lstring_success. "Place holder for BDC Success Files
CONCATENATE '\CAUVERYSAPBARCODEERROR'
lv_file_name INTO lstring_error. "Place holder for BDC Error Files
file_name_source = file_name. "Source file path
file_name_success_dest = lstring_success. "Success file path
file_name_error_dest = lstring_error. "Error file path
*For the files with no data in them, move them to desired(error) folder.
if lt_bdcmsgcoll[] is initial.
CALL METHOD cl_gui_frontend_services=>file_copy
EXPORTING
SOURCE = file_name_source
destination = file_name_error_dest.
endif.
LOOP AT lt_bdcmsgcoll INTO lw_bdcmsgcoll.
IF lw_bdcmsgcoll-msgtyp EQ 'S' AND
lw_bdcmsgcoll-msgnr EQ '110'.
*----------Move the succes files to designated folder---------------*.
CALL METHOD cl_gui_frontend_services=>file_copy
EXPORTING
SOURCE = file_name_source
DESTINATION = file_name_success_dest
overwrite = 'X'
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
disk_full = 4
access_denied = 5
file_not_found = 6
destination_exists = 7
unknown_error = 8
path_not_found = 9
disk_write_protect = 10
drive_not_ready = 11
not_supported_by_gui = 12
OTHERS = 13.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE.
*--------Move the error files to designated folder-----------------*.
IF lw_bdcmsgcoll-msgtyp EQ 'E' OR
lt_bdcmsgcoll[] IS INITIAL.
CALL METHOD cl_gui_frontend_services=>file_copy
EXPORTING
SOURCE = file_name_source
DESTINATION = file_name_error_dest
overwrite = 'X'
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
disk_full = 4
access_denied = 5
file_not_found = 6
destination_exists = 7
unknown_error = 8
path_not_found = 9
disk_write_protect = 10
drive_not_ready = 11
not_supported_by_gui = 12
OTHERS = 13.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
*----------------Delete file from the directory---------------------------*
CALL METHOD cl_gui_frontend_services=>file_delete
EXPORTING
filename = file_name_source
CHANGING
rc = lv_rc
EXCEPTIONS
file_delete_failed = 1
cntl_error = 2
error_no_gui = 3
file_not_found = 4
access_denied = 5
unknown_error = 6
not_supported_by_gui = 7
wrong_parameter = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
REFRESH lt_bdcmsgcoll.
REFRESH lt_bdcdata.
ENDLOOP.
*& Form bdc_dynpro
* text
* -->PROGRAM text
* -->DYNPRO text
FORM bdc_dynpro USING program dynpro. "#EC *
CLEAR lw_bdcdata.
lw_bdcdata-program = program.
lw_bdcdata-dynpro = dynpro.
lw_bdcdata-dynbegin = 'X'.
APPEND lw_bdcdata TO lt_bdcdata.
ENDFORM. "BDC_DYNPRO
*& Form bdc_field
* text
* -->FNAM text
* -->FVAL text
FORM bdc_field USING fnam fval. "#EC *
IF fval <> space.
CLEAR lw_bdcdata.
lw_bdcdata-fnam = fnam.
lw_bdcdata-fval = fval.
APPEND lw_bdcdata TO lt_bdcdata.
ENDIF.
ENDFORM. "bdc_field
*& Include ZDECLERATIONS
*-----------------------------Types decleration--------------------------*
TYPES: BEGIN OF tw_afrud,
aufnr TYPE aufnr,
lmnga(13) TYPE c,
budat TYPE buchdatum,
END OF tw_afrud,
tt_afrud TYPE STANDARD TABLE OF tw_afrud.
TYPES: BEGIN OF tw_temp,
rec(7000) TYPE c,
END OF tw_temp,
tt_temp TYPE STANDARD TABLE OF tw_temp.
TYPES: BEGIN OF tw_errorlog,
aufnr TYPE aufnr,
message TYPE string,
END OF tw_errorlog,
tt_errorlog TYPE STANDARD TABLE OF tw_errorlog.
TYPES: BEGIN OF tw_file,
pathname TYPE sdok_filnm,
END OF tw_file,
tt_file TYPE STANDARD TABLE OF tw_file.
TYPES: BEGIN OF tw_dir,
pathname1 TYPE sdok_filnm,
END OF tw_dir,
tt_dir TYPE STANDARD TABLE OF tw_dir.
TYPES: BEGIN OF tw_filename,
filename TYPE rlgrap-filename,
pathname TYPE localfile,
END OF tw_filename,
tt_filename TYPE STANDARD TABLE OF tw_filename.
*-------------Variable decleration---------------------------------------*
DATA: pa_file TYPE rlgrap-filename.
DATA: lstring TYPE string,
lstring_success TYPE string,
lstring_error TYPE string,
file_name TYPE dxfile-filename,
lv_rc TYPE i,
file_name_source TYPE string,
file_name_error_dest TYPE string,
file_name_success_dest TYPE string,
lv_file_name TYPE rlgrap-filename.
*---------------Internal tables & Work area's ------------------------------*
DATA : lw_afrud TYPE tw_afrud,
lt_afrud TYPE tt_afrud,
lw_temp TYPE tw_temp,
lt_temp TYPE tt_temp,
lw_file TYPE tw_file,
lt_file TYPE tt_file,
lw_dir TYPE tw_dir, "#EC *
lt_dir TYPE tt_dir,
lw_filename TYPE tw_filename,
lt_filename TYPE tt_filename,
lw_bdcdata TYPE bdcdata,
lt_bdcdata TYPE STANDARD TABLE OF bdcdata,
lw_bdcmsgcoll TYPE bdcmsgcoll,
lt_bdcmsgcoll TYPE STANDARD TABLE OF bdcmsgcoll.
RegardsThe methods of the class
cl_gui_frontend_services
cannot be used in background since they refer to the presentation server. You have to upload the files to the application server to run the program in the background. You can use transaction CG3Z or the function module
ARCHIVFILE_CLIENT_TO_SERVER
to upload the files.
Manoj -
Hi all,
Can I copy a file from one folder to other folder and delete this file from the first folder using abap?
For example there is a folder at
C:\Etc\Test and I want to copy this file to folder xyz as:
C:\XYZ\Test
How can I do that and delete the C:\Etc\Test?
Thanks.
deniz.Hi,
Check this code...
DATA: w_file_name TYPE string,
w_file_path TYPE string,
full_path TYPE string,
action TYPE i,
name TYPE string VALUE 'SAVE',
filetable TYPE filetable,
file TYPE string,
rc TYPE i.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
* EXPORTING
* window_title =
* default_extension =
* default_filename =
* file_filter =
* with_encoding =
* initial_directory =
* multiselection =
CHANGING
file_table = filetable
rc = rc
READ TABLE filetable INTO file index 1.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
* window_title = name
* initial_directory = 'c:\Documents and Settings\2q\Desktop'
* prompt_on_overwrite = 'X'
default_file_name = name
CHANGING
filename = w_file_name
path = w_file_path
fullpath = full_path
user_action = action
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
CALL METHOD cl_gui_frontend_services=>file_copy
EXPORTING
SOURCE = file
DESTINATION = full_path
CALL METHOD cl_gui_frontend_services=>file_delete
EXPORTING
filename = file
CHANGING
rc = rc.
Edited by: Sukriti Saha on Nov 5, 2008 1:09 PM -
Copy File from Presentation Server to Application Server in Background
Hi,
I need to copy Image file from Presentation Server to Application Server.
The below given code is workking fine in Foreground but whenevr I am trying to execute in Background, the job is cancelled and I am getting a dump.
data : wa_source type string,
wa_destination type string.
wa_source = 'C:\PARBIND.BMP'.
wa_destination = 'D:\PARBIND.BMP'.
start-of-selection.
call method cl_gui_frontend_services=>file_copy
exporting
source = wa_source
destination = wa_destination
* overwrite = SPACE
* EXCEPTIONS
* cntl_error = 1
* error_no_gui = 2
* wrong_parameter = 3
* disk_full = 4
* access_denied = 5
* file_not_found = 6
* destination_exists = 7
* unknown_error = 8
* path_not_found = 9
* disk_write_protect = 10
* drive_not_ready = 11
* not_supported_by_gui = 12
* others = 13
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
In backgound Error is....
Exception condition "CNTL_ERROR" raised.*
Any solution is appreciated.
Thanks
ArbindHi Arbind,
Just realize... when you run it in foreground, you have a foreground to capture the file location. so it runs fine..
but when you are running it in background, there is no foreground to check that is no gui present... how can it check where the C:\.... location is??
no need of reading any oss note... just see.. the name is cl_GUI_FRONTEND_service.. its only for front end..
u need open dataset, read dataset, close dataset kind of things while running in background. or RFCs to read the file... (search SDN). -
Finding the folder on the SAP server
My requirement is about finding the physical folders and files on SAP server. If any body could give me any input for that, i would appreciate it!!
I need to copy the files from my C: drive to SAP Office Shared Folder. Actually I have three folders on SAP Office Shared Folder (Customer, Vendor and Personnel). the documents are being scanned and sent to my PC. from here I have a program that runs nightly and copies those pdf scanned files to application server. I need to ascertain the path of those Customer, Vendor and Personnel folder on SAP Application server.
any input is appreciated. Thanks, AbhishekHere's my report:
REPORT YTESTRM2 .
DATA: gd_COUNT type I.
DATA: D_PATH(50) value '
R3sever\ADR100\'.
DATA: gd_Source TYPE string ,
gd_dest type String ,
gd_rc type I.
DATA: gd_directory type String value '
Bismark\Projects\ADMIN\'.
DATA: gd_file_table type standard table of file_info.
data: wa_file_table type file_info.
CALL METHOD cl_gui_frontend_services=>DIRECTORY_LIST_FILES
EXPORTING
DIRECTORY = gd_directory
CHANGING
FILE_TABLE = gd_file_table
COUNT = gd_count.
LOOP AT gd_file_table into wa_file_table.
CONCATENATE D_PATH wa_file_table-filename INTO gd_dest.
concatenate gd_directory wa_file_table-filename INTO gd_Source.
CALL METHOD cl_gui_frontend_services=>File_Copy
EXPORTING
Source = gd_Source
Destination = gd_dest
EXCEPTIONS
OTHERS = 1.
ENDLOOP.
R3Server is our production server name. the ADR100 folder is a shared folder.
All i want to know is that whether the folders that i created in SHARED FOLDERS in SAP BUSINESS WORKPLACE........are they created physically in this R3Server or in some KPro or CMS.. if i could give the name of that instead of my
R3sever\ADR100\........then my work is done. -
Replaced version of Function Module PFL_COPY_OS_FILE in ECC 6.0
Hi everybody,
Can anybody tell me what is the replaced name of function module PFL_COPY_OS_FILE in ECC 6.0. This function module was used in 4.6C version and become obsolete in ECC 6.0. It is basically used for copying OS files.check CL_GUI_FRONTEND_SERVICES=>FILE_COPY
new_file = P_FILE.
app_full_name = R_FILE.
CALL METHOD cl_gui_frontend_services=>file_copy
EXPORTING
SOURCE = new_file
DESTINATION = app_full_name
overwrite = 'X'
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
disk_full = 4
file_not_found = 5
destination_exists = 6
unknown_error = 7
path_not_found = 8
disk_write_protect = 9.
IF sy-subrc NE 0.
EXIT.
ENDIF. -
Issue with Uploading OTF converted PDF file on application server...
Hello Gurus,
I want to download otf converted pdf data on application server. I am using following but it does not work ?
data: i_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,
wa_pdf_tab like tline,
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
max_linewidth = 132
IMPORTING
BIN_FILESIZE = w_bin_filesize
TABLES
OTF = I_OTFDATA
LINES = i_pdf_tab
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
concatenate './' 'ARCH_' SY-DATUM '_' SY-UZEIT INTO FILENAME.
OPEN DATASET FILENAME FOR output in text mode encoding default.
loop at i_pdf_tab INTO wa_pdf_tab.
TRANSFER wa_pdf_tab TO FILENAME .
ENDLOOP.
CLOSE DATASET FILENAME.
After this I am using CG3Y to downlaod the file created on application server to front end with "Transfer format data" as BIN.
But it dos not work.
Please hlep.
Regards,
Rajesh.Instead of CG3Y use this code.
DATA : p_sour TYPE string VALUE '\\usr\sap\trans\tmp\test.pdf',
p_dest TYPE string VALUE 'c:\test.pdf'.
CALL METHOD cl_gui_frontend_services=>file_copy
EXPORTING
SOURCE = p_sour
destination = p_dest
overwrite = SPACE -
Move a image file from one drive to another drive in Presentaion Server
Hi,
My business requirement is to move a image file which is in C:\ drive to another Drive ( Common Drive ).
So I need to that through programming.
Kindly help me in this regard.
Thanks
ArbindHi Arbind,
<li>The logic is here.
<li>Change the folder names and execute the program accordingly.
REPORT ztest_program.
DATA: wa_pfile TYPE file_table.
DATA: it_pfiles TYPE STANDARD TABLE OF file_table.
DATA: count TYPE i,
dir TYPE string VALUE 'C:\Venkat1\',
source TYPE string,
dest TYPE string.
START-OF-SELECTION.
CALL METHOD cl_gui_frontend_services=>directory_list_files
EXPORTING
directory = dir
files_only = 'X'
CHANGING
file_table = it_pfiles
count = count
EXCEPTIONS
cntl_error = 1
directory_list_files_failed = 2
wrong_parameter = 3
error_no_gui = 4
not_supported_by_gui = 5
OTHERS = 6.
LOOP AT it_pfiles INTO wa_pfile.
IF wa_pfile-filename CP '*.JPEG' OR
wa_pfile-filename CP '*.BMP' OR
wa_pfile-filename CP '*.JPG'.
CONCATENATE 'C:\Venkat1\' wa_pfile-filename INTO source.
CONCATENATE 'C:\Venkat2\' wa_pfile-filename INTO dest.
CALL METHOD cl_gui_frontend_services=>file_copy
EXPORTING
SOURCE = SOURCE
destination = dest
overwrite = 'X'.
ENDIF.
ENDLOOP.
Thanks
Venkat.O -
SM69-Can't exec external program ( External program terminated with ecode1)
Hi All,
Client requirement is to Move File from Presentation Server to Application Server.
I am executing UNIX script on AIX OS via SM69.
But I am getting the following error:
Can't exec external program (No such file or directory)
External program terminated with exit code 1
Also getting same error with FM-SXPG_COMMAND_EXECUTE .
Below is the code..
data: l_exitcode type btcxpgexit,
l_parms type btcxpgpar,
l_status type btcxpgstat.
data: lt_protocol type standard table of btcxpm,
l_protocol type btcxpm.
concatenate 'C:\Venkat1\PARBIND.BMP'
'D:\Venkat2\PARBIND.BMP'
into l_parms
separated by space.
* External command:
* - Unix - mv
call function 'SXPG_COMMAND_EXECUTE'
exporting
commandname = 'Z_MV'
additional_parameters = l_parms
importing
status = l_status
exitcode = l_exitcode
tables
exec_protocol = lt_protocol
exceptions
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14
others = 15.
if sy-subrc ne 0
endif.
Can any one guide what is the cause of error....
Any help will be appreciated.
Regards
ArbindHi Paul,
Thanks.
But still Basis Consultants are telling it is correct from there side.
Is there any other way to move files from Presentaion Server to Application Server in Background Processing.
I have used CL_GUI_FRONTEND_SERVICES=>FILE_COPY
It is working fine in Foreground but in Background Proceesing, it is not working.
Can u provide any solution ?
Thanks
Arbind -
Post PDF to the SAP server and ftp it
I got requirements regarding: (Based on SAP Script)
1) Convert OTF to PDF file
2) Post this PDF file into the SAP Server
3) FTP it to another server
Is there anyone provide me an example source code of the step 2 and 3?Hi,
Try this Funciton Module <b>/SAPDMC/LSM_F4_FRONTEND_FILE</b>,
also Please try this Function Module, <b>C13Z_UPLOAD</b>. Might be helpful. Feel free to revert back.
Here is a sample program.
report zrich_0002 .
parameters: source type localfile,
destin type localfile.
at selection-screen on value-request for source.
call function 'KD_GET_FILENAME_ON_F4'
exporting
static = 'X'
changing
file_name = source.
at selection-screen on value-request for destin.
call function 'KD_GET_FILENAME_ON_F4'
exporting
static = 'X'
changing
file_name = destin.
start-of-selection.
data: xsource type string.
data: xdestin type string.
xsource = source.
xdestin = destin.
call method cl_gui_frontend_services=>file_copy
exporting
source = xsource
destination = xdestin
OVERWRITE = SPACE
exceptions
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
disk_full = 4
access_denied = 5
file_not_found = 6
destination_exists = 7
unknown_error = 8
path_not_found = 9
disk_write_protect = 10
drive_not_ready = 11
others = 12.
Feel free to revert back.
--Ragu -
Hi All,
I am downloading a data from SAP to excel(*.xlsx) format. I am able to conver/download the file in *.xlsx format, but if try to open the downloaded excel file, it gives teh error message 'Excel cannot open the file 'filename.xlsx' because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file'. with a OK button. When I press the OK button, no data is displayed.
So kindly let me know how to download the file from SAP to *.xlsx format without any errors.
Note: I am able to download the data in *.xls format without any erros.
Thanks in advance,
Regards,
VijayHi,
You are probably not being able to open the file of .XLSX format because you do not have Microsoft Office 2007 installed on your system. You might be having a lower version of Microsoft Office. e.g. 2003.
What you can do is, before opening the .XLSX file directly on a system which does not have Microsoft Office 2007, you can convert it into .XLS format and then open the same.
See the below code.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_COPY
EXPORTING
SOURCE = 'C:\Users\Danish\Desktop\test1.xlsx'
DESTINATION = 'C:\Users\Danish\Desktop\test2.xls'
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
WRONG_PARAMETER = 3
DISK_FULL = 4
ACCESS_DENIED = 5
FILE_NOT_FOUND = 6
DESTINATION_EXISTS = 7
UNKNOWN_ERROR = 8
PATH_NOT_FOUND = 9
DISK_WRITE_PROTECT = 10
DRIVE_NOT_READY = 11
NOT_SUPPORTED_BY_GUI = 12
OTHERS = 13.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Danish
Maybe you are looking for
-
How to connect Apple TV to Sony str-dg800?
Need to understand how to connect AppleTV 3GL to Sony STR-DG800 A/V receiver.
-
I receive an error message when trying to update the Installer
I've uninstalled and reinstalled with no luck: Installer was unable to access a critical file/directory. Please try installing again.(Error code: 43) Contact Customer SupportInstaller was unable to access a critical file/directory. Please try install
-
HUB server consider ouside email as internal
Hi everybody, My Exchange system has MBX server, CAS-HUB server and Symantec Messaging Gateway, no Edge server. In my HUB role, I created a receive connector that is set permission to accept email from Anonymous and only from the IP of Symantec Messa
-
I get pop up requests to upgrade Growl. In applications, folder called: com.growl.growlhelperapp. In folder: cache.dbd What is going on?
-
Upgrade PE6/Win to PE8/Mac - load old catalog into Bridge?
I've been successfully using Photoshop Elements 6 on XP for some time. But, I'm shifting my main machine from PC to Mac, and as part of that move I just bought Photoshop Elements 8 for the Mac. Right now, I'm accessing the existing photos via a share