Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with FM ARCHIVFILE_SERVER_TO_SERVER

Former Member
0 Kudos

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

3 REPLIES 3

Former Member
0 Kudos

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

Former Member
0 Kudos

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

arindam_m
Active Contributor
0 Kudos

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