‎2008 Jul 24 2:10 PM
Hi,
I need an urgent help here.
I have a selection screen parameter that has filepath+filename together (e.g.
C:\Documents and Settings\xyz\Desktop\test1.txt). So, I want to split it into 2 parts inside my program 1st for the filepath (i.e. 'C:\Documents and Settings\xyz\Desktop\') and 2nd for the filename (i.e. 'test1.txt').
Please help how to do it dynamically. I think we need to use string operators for it.
Regards,
Sanj.
‎2008 Jul 24 2:12 PM
use the fm SO_SPLIT_FILE_AND_PATH
REPORT Zsplit_filename .
PARAMETERS: FILENAME TYPE RLGRAP-FILENAME .
DATA: STRIPPED TYPE RLGRAP-FILENAME.
DATA: FILE_PATH TYPE RLGRAP-FILENAME.
CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
EXPORTING
FULL_NAME = FILENAME
IMPORTING
STRIPPED_NAME = STRIPPED
FILE_PATH = FILE_PATH
* EXCEPTIONS
* X_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.
‎2008 Jul 24 2:12 PM
use the fm SO_SPLIT_FILE_AND_PATH
REPORT Zsplit_filename .
PARAMETERS: FILENAME TYPE RLGRAP-FILENAME .
DATA: STRIPPED TYPE RLGRAP-FILENAME.
DATA: FILE_PATH TYPE RLGRAP-FILENAME.
CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
EXPORTING
FULL_NAME = FILENAME
IMPORTING
STRIPPED_NAME = STRIPPED
FILE_PATH = FILE_PATH
* EXCEPTIONS
* X_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.
‎2008 Jul 24 2:22 PM
Hi Mohammed,
Thanks very much.. You solved my issue.
Regards,
Sanj.
‎2008 Jul 24 2:14 PM
Hi,
Reverse the whole file path first.
Take sub string upto '\'.
Again reverse the substring.
Regards,
Aparna Gaikwad