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

rename a parameter

Former Member
0 Likes
579

Hi

I have 2 parameters on a selection screen, p_dir and p_dir2.

from p_dir, we are retrieving the directory of a file.

p_dir2 will take the value of p_dir but with an extension.

like if p_dir = Y:\05. SAP \con\09 implementation\10 DEVELOPMENTS\Files\file.txt

p_dir2 is then Y:\05. SAP \con\09 implementation\10 DEVELOPMENTS\Files\file_new.txt

The problem is that I dont know how the name of the directory will be so that I can rename p_dir2, sometimes the directory doesnt even have the extension '.txt'

I dont know how to handle these cases

Is there any FM which can do this?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
443

Hi Sia,

You can use SEARH to know whether it contains the extension, txt.

Like this:

search pdir for 'txt'.

if sy-subrc eq 0.

write : sy-FDPOS.

" fdpos : offset in character string

endif.

Hope helps.

deniz.

1 REPLY 1
Read only

Former Member
0 Likes
444

Hi Sia,

You can use SEARH to know whether it contains the extension, txt.

Like this:

search pdir for 'txt'.

if sy-subrc eq 0.

write : sy-FDPOS.

" fdpos : offset in character string

endif.

Hope helps.

deniz.