Application Development and Automation 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: 
Read only

Character string operation

Anindya
Explorer
0 Likes
691

Hi,

I need to read only the file name from a variable which contains the entire path and also the name of the file at the end of it.

Eg:

lh_path is a character variable.

lh_path = E:\xxxxx\yyyyyy\zzzz\........\Objects.csv

In this example, i need to read only the file name(i.e Objects.csv) from lh_path.What will be the best logic to implement this?

Thanks in advance,

Anindya

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
659

Hi Anindya,

Refer to this link as per your requirement:

hope solves your problem.

Thanks!!

5 REPLIES 5
Read only

Former Member
0 Likes
660

Hi Anindya,

Refer to this link as per your requirement:

hope solves your problem.

Thanks!!

Read only

Former Member
0 Likes
659

Hi,

Use the SPLIT statment. Use an internal table as the target and read the last record of the target internal table. This will always be the file name.

regards,

Advait

Read only

Former Member
0 Likes
659

Hi,

Try with this FM

PC_SPLIT_COMPLETE_FILENAME.

Regards,

Suresh.

Read only

Anindya
Explorer
0 Likes
659

Thanks Aparna!!!!!

Read only

Former Member
0 Likes
659

Hi,

Try this code


data:text1 type string,itab type table of string.
parameters : text type string. "file name
split text at '\' into table itab.
loop at itab into text1 .
*  text1 = itab.
  endloop.
  write : text1.

Regards

Vasavi Kotha

Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 3:20 PM