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: 

best approach to split a field

Former Member
0 Kudos

I am using the FM WS_FILENAME_GET to have the user supply the path and filename. I am using RSFTP002 to get the file from the app server and put it in the user specified path. I need to able to split out the filename from the path so that I can build the command to change to the directory supplied by the user.

I am looking at the split command and figured that I would have to split based on the \ character. I would then have to loop thru each field to find the empty field and the file name would be in the previous field. I would then concatenate fields up to the field that contains the file name to get the path.

Is there and easier way to handle this?

is the way that I described the only way to do this?

thanks in advance for your help

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello Timothy

Try function module PC_SPLIT_COMPLETE_FILENAME

There are other FMs that may work as well.

Try using se37 and looking for FMs name filename*

Greg Kern

7 REPLIES 7

Former Member
0 Kudos

Hello Timothy

Try function module PC_SPLIT_COMPLETE_FILENAME

There are other FMs that may work as well.

Try using se37 and looking for FMs name filename*

Greg Kern

Former Member
0 Kudos

Hi,

Use function 'STRING_SPLIT' to split it based on '/'

Former Member
0 Kudos

<Deleted>

Former Member
0 Kudos

Hi,

You can FM CH_SPLIT_FILENAME..

Thanks,

Naren

Former Member
0 Kudos

try this FM <b>

SPLIT_FILENAME

</b>

0 Kudos

Hi

Another fm is /SAPDMC/LSM_PATH_FILE_SPLIT

Max

Former Member
0 Kudos

hi,

Use <b>SPLIT </b>statement with <b>INTO TABLE</b> addition.

Here is a sample code

data: v_path type string value 'opt/bin/file.dat',
      itab type table of string with header line,
      v_rec type i.

split v_path at '/' into table itab.
describe table itab lines v_rec.
read table itab index v_rec.
write 😕 'File name:', itab. 

Regards,

Sailaja.