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

Function module to get file extension

Former Member
0 Likes
22,810

Hi , want to know how to extract extension of a file eg: c:\mytestdata.xls

The function module/class should give the result as 'xls'

please give me function module/class

1 ACCEPTED SOLUTION
Read only

sreeramkumar_madisetty
Active Contributor
8,832

Deepthi

Use the FM: TRINT_FILE_GET_EXTENSION

Regards,

Sreeram

8 REPLIES 8
Read only

Former Member
0 Likes
8,832

Hi,

You can use use SPLIT statement.

You can split the filename at '.' and store whatever is there after . in a variable which will give you the extension.

Press F1 on SPLIT to get syntax details.

Read only

0 Likes
8,832

thanks 4 ur reply.

we are asked not to use any string fns..

Give me any Function module or class name.

Read only

sreeramkumar_madisetty
Active Contributor
8,833

Deepthi

Use the FM: TRINT_FILE_GET_EXTENSION

Regards,

Sreeram

Read only

0 Likes
8,832

Hi Sreeram,

Thank you very much..My problem got solved..

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
8,832

Hello,

You can use this FM: SPLIT_FILENAME.

BR,

Suhas

Read only

0 Likes
8,832

Hi Suhas,

I don't think that function module will work for file extensions with more than 3 characters.

Just a heads up.

Cheers,

Bruno

Read only

Former Member
0 Likes
8,832

Check the Function module

PC_SPLIT_COMPLETE_FILENAME

Note:

Always Search before Posting any Question.

Read only

Former Member
8,832

HI Deepthi,

Try this

SO_SPLIT_FILE_AND_PATH

Thanks,

Babu Kilari