08-17-2012 11:41 PM
Hi everyone !!!
I have a trouble with the FM ARCHIVFILE_SERVER_TO_SERVER. I'm want to copy one file into another directory trough this FM, but it will always finish with a dump. The sample code is this:
DATA: fecha TYPE sy-datum.
DATA: ruta(60) TYPE c.
DATA: ruta2(60) TYPE c.
DATA: cont TYPE i.
DATA: contc(60) TYPE c.
fecha = sy-datum.
cont = 1.
contc = cont.
condense contc no-gaps.
CLEAR ruta.
CLEAR ruta2.
ruta = 'E:\usr\sap\BWD\DVEBMGS00\work\0COMP_CODE_ATTR.CSV'.
CONCATENATE 'E:\usr\sap\put\' fecha '_0COMP_CODE_ATTR' contc '.CSV' INTO ruta2.
translate ruta to upper case.
translate ruta2 to upper case.
condense ruta no-gaps.
condense ruta2 no-gaps.
condense contc no-gaps.
CALL FUNCTION 'ARCHIVFILE_SERVER_TO_SERVER'
EXPORTING
sourcepath = ruta
targetpath = ruta2.
DUMP:
CALL_FUNCTION_CONFLICT_TYPE
CX_SY_DYN_CALL_ILLEGAL_TYPE
The description of the dump is this:
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was
not caught and
therefore caused a runtime error.
The reason for the exception is:
The call to the function module "ARCHIVFILE_SERVER_TO_SERVER" is incorrect:
The function module interface allows you to specify only
fields of a particular type under "SOURCEPATH".
The field "RUTA" specified here is a different
field type
I changed code, variables (string, c), added sentences (condense, translate) but still I could not give with the solution. I dont know if i am using the FM well. Any help about the variable or the FM usage will be fully appreciated.
Best Regards!!!
Ignacio
07-25-2013 3:59 PM
I'm not sure whether you got the solution for this problem or not. But as far as I know, the type of the file names, ruta and ruta2 should be sapb-sappfad which is the format for the parameters used in FM. Please check.
Regards,
Ravi
07-25-2013 4:16 PM
I'm going to take a WHAG and say that you shouldn't be using an E: path. You should either fully specify the path or use the sap root designator.
Neal
07-25-2013 11:01 PM
Hi,
Its just the mismatch between the type of the parameters in the FM call of ARCHIVFILE_SERVER_TO_SERVER. Both should be type SAEPFAD. Also i think ruta should be a file in the application server.
Cheers,
Arindam