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: 

Changing the file name...

Former Member
0 Kudos

Hello all.....

I am having a requirment as i need to change the file name dynamically................

I will be having a file in the application or presentation server. While processing the datat in the file, I need to add extension to the file name as transfer. when the transfer of data is finished the i need to add ok to the file name at last......

Is there any function module or class for changing the file name dynamically or renamig the file name..

Thank You very much in Advance.....

1 ACCEPTED SOLUTION

Former Member
8 REPLIES 8

Former Member

Former Member
0 Kudos

Hi,

I think there is no FM to rename the file. So that try the below steps.

1. if you are processing, manulay you have to append the text 'transfer' when processing the file.

2. once the file has been processed, then again manullay change the file name with addition 'OK' and call the FM

'SCMS_FILE_COPY', here you have to specify the source and target file name with path. once the file copied then delete the source file.

SCMS_FILE_DELETE - Delete

and check the class cl_gui_frontend_services

Regards,

Boobalan S

0 Kudos

Is there any function module to rename the file or copy the file or delete the file in application layer ????????

Function module or class to rename the file in the application layer ..............

former_member787646
Contributor
0 Kudos

Hi,

Check the Function Module "PFL_COPY_OS_FILE".

Hope it helps.

Murthy

0 Kudos

In the FM PFL_COPY_OS_FILE all the code is commented....

0 Kudos

Is there any FM to copy the file in Application layer and delete the file in application layer

Former Member
0 Kudos

HI

Try using

CONCATENATE 'mv' old_filename ' '

new_filename INTO wf_parameter SEPARATED BY space.

CALL FUNCTION 'RFC_REMOTE_PIPE'

DESTINATION 'SERVER_EXEC'

EXPORTING

command = wf_parameter

read = 'X'.

former_member188685
Active Contributor
0 Kudos

If your application server is Unix then we can use unix command to Rename your file.

mv -> move command

mv source target

file1 souce file name with path

file2 target filename with path.

REPORT ZUNIX line-size 400
                no standard page heading.
 
 data: unixcom like   rlgrap-filename.   
 
unixcom = 'mv file1 file2'.
 
data: begin of tabl occurs 500,
        line(400),
      end of tabl.
 
data: lines type i.
  
*----------------------------------------------------------------------
 
start-of-selection.
  refresh tabl.
 
  call 'SYSTEM' id 'COMMAND' field unixcom
                id 'TAB'     field tabl[].
 
 

For Renaming the Presentation sever

First copy the file to another file and then Delete the old file.

Calss :  CL_GUI_FRONTEND_SERVICES
Methods: FILE_COPY
              FILE_DELETE