2006 Jun 16 7:45 AM
Hi,
I have a requirement wherein, I know the correct path along with the file name of any particular file stored on my desktop. I need to change the name of that file according to the client's naming convention.
Does anybody knows the name of SAP Standard Function Module by which you can change the name of a file on Presentation Server.
Thanks in Advance.
With Best Regards,
Nitin
2006 Jun 16 8:01 AM
Hi nitin,
1. Exactly for this purpose
i have developed an INDEPENDENT SUBROUTINE (FORM)
in which we pass
a) old file name
b) new file name
and it will rename the file
(This will work in WINDOWS Operating system)
(we can modify it very little for other OS also_
2. just copy paste in new program.
3.
Report abc.
*----
PERFORM MYRENAME USING 'D:\CCC.TXT' 'DDD.TXT'.
*----
FORM
*----
form myrename USING oldfile newfile.
data : pm(200) type c.
concatenate '/C REN ' oldfile newfile
INTO PM separated by space.
CALL FUNCTION 'GUI_RUN'
EXPORTING
COMMAND = 'CMD'
PARAMETER = pm
CD =
IMPORTING
RETURNCODE =
.
endform. "myrename
regards,a
amit m.
2006 Jun 16 7:49 AM
2006 Jun 16 8:01 AM
Hi nitin,
1. Exactly for this purpose
i have developed an INDEPENDENT SUBROUTINE (FORM)
in which we pass
a) old file name
b) new file name
and it will rename the file
(This will work in WINDOWS Operating system)
(we can modify it very little for other OS also_
2. just copy paste in new program.
3.
Report abc.
*----
PERFORM MYRENAME USING 'D:\CCC.TXT' 'DDD.TXT'.
*----
FORM
*----
form myrename USING oldfile newfile.
data : pm(200) type c.
concatenate '/C REN ' oldfile newfile
INTO PM separated by space.
CALL FUNCTION 'GUI_RUN'
EXPORTING
COMMAND = 'CMD'
PARAMETER = pm
CD =
IMPORTING
RETURNCODE =
.
endform. "myrename
regards,a
amit m.
2006 Jun 16 8:47 AM
Hi Nitin,
Use FM GUI_EXEC with
CMD /C REN <oldname> <newname>
Rgds,
Sumana
2006 Jun 16 9:01 AM
Hi,
you can rename the File in this way also...
REPORT ZTEST_RENAME .
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_COPY
EXPORTING
SOURCE = 'C:Test.txt'
DESTINATION = 'C:Test_CP.txt'
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.
data: rc type i.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_DELETE
EXPORTING
FILENAME = 'C:Test.txt'
CHANGING
RC = 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.
Regards
vijay