cancel
Showing results for 
Search instead for 
Did you mean: 

FM : FILE_GET_NAME_USING_PATH

Former Member
0 Kudos

Hi,

I am using the FM : FILE_GET_NAME_USING_PATH

can anyone help in identifying the scnario where it can give a dump.

When going through a few sample codes.I have observed that many developers avoid using the standard Mssg ID and Msg description which the SAP provides..when a sy-subrc check fails so I was a bit confused as why the standard message has been commented and instead a new message has been given.

By default we get :

if sy-subrc ne 0.

MESSAGE MSGID sy-msgno ...

endif.

but most of the time it is commented and replaced with

message text type 'E'.

can anyone throw soem light on this.

Thanks and reagrds,

Avinash.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hai Avinash

F.M 'WS_FILENAME_GET' was abosolete in Higher versions

replace 'WS_FILENAME_GET' with Class CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG(Method)

Check with the following Code

PARAMETERS: P_FILE LIKE RLGRAP-FILENAME. "local file with contracts

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

*----


Begin of delete by Neelimab on 03/11/2005.

  • CALL FUNCTION 'WS_FILENAME_GET'

  • EXPORTING

  • DEF_FILENAME = ''

  • DEF_PATH = 'C:\'

  • MASK = ',..'

  • TITLE = 'Find File'

  • IMPORTING

  • FILENAME = P_FILE

  • EXCEPTIONS

  • INV_WINSYS = 1

  • NO_BATCH = 2

  • SELECTION_CANCEL = 3

  • SELECTION_ERROR = 4

  • OTHERS = 5.

*----


End of delete by Neelimab on 03/11/2005.

*----


Begin of Add by Neelimab on 03/11/2005.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG

EXPORTING

WINDOW_TITLE = 'Find File'

DEFAULT_EXTENSION = 'C:\'

DEFAULT_FILENAME = ''

FILE_FILTER = ',..'

  • INITIAL_DIRECTORY =

  • MULTISELECTION =

  • WITH_ENCODING =

CHANGING

FILE_TABLE = I_FILETABLE

RC = V_RC

  • USER_ACTION =

  • FILE_ENCODING =

EXCEPTIONS

FILE_OPEN_DIALOG_FAILED = 1

CNTL_ERROR = 2

ERROR_NO_GUI = 3

NOT_SUPPORTED_BY_GUI = 4

others = 5

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

READ TABLE I_FILETABLE INTO P_FILE INDEX 1.

*----


End of Add by Neelimab on 03/11/2005.

Thanks & Regards

Sreenivasulu P

Message was edited by: Sreenivasulu Ponnadi

Former Member
0 Kudos

There are different ways of the using the MESSAGE statements. I guess its just ease of usage which makes the developer use a different syntax than the standard code.

The functionality doesn't change anyway.

Regards,

Ravi

Note : Please mark the helpful answers

Former Member
0 Kudos

Hi ravi,

Thanks for your input But is there any condition under which this can give a short dump when the prog is executed.

Regards,

Avi

Former Member
0 Kudos

As the message type is being set dynamically and if the systems sets the message type to A or X, then yes, it will give a short dump.

Regards,

Ravi

Note : Please mark the helpful answers

Former Member
0 Kudos

Hi Ravi,

So i think we can have a better control if we use message text type E.

And can remove the poddiblity of dump.

Thanks and reagrds,

Avi

Former Member
0 Kudos

Yes, however, if internall the standard code raise the error it will still dump.

You will have to be careful while passing the parameters, and unless there is a difference in datatypes, the dump usually does not happen.

Regards,

Ravi

Note : Please close the thread if the question is answered and mark all the helpful answers

Former Member
0 Kudos

Hi Ravi,

It was nice getting so quick feedback.However i did not understand when u said "if internally the standard code raise the error it will still dump.

"

Can u pl. elaborate on this.This might be helpful for my knwoledge base.

Regards,

Avi.

Former Member
0 Kudos

Avinash,

With in the code of the function, the code might have the MESSAGE statement which might have a A or X and might cause a short dump and this usually depends on what values you are passing. So, if that happens, the dump happens without even coming back to your code.

Note : SDN's way of saying thanks is be marking all the helpful answers of a thread and closing the thread "SOLVED PROBLEM", once the question is answered.

Welcome to SDN Forums.

Regards,

Ravi

athavanraja
Active Contributor
0 Kudos

also when the exceptions are commented and not handled via sy-subrc ne 0

you will get a dump when exception happens

CALL FUNCTION 'FILE_GET_NAME_USING_PATH'

EXPORTING

  • CLIENT = SY-MANDT

logical_path = logical_path

  • OPERATING_SYSTEM = SY-OPSYS

  • PARAMETER_1 = ' '

  • PARAMETER_2 = ' '

  • PARAMETER_3 = ' '

  • USE_BUFFER = ' '

file_name = file_name

  • USE_PRESENTATION_SERVER = ' '

  • ELEMINATE_BLANKS = 'X'

  • IMPORTING

  • FILE_NAME_WITH_PATH = FILE_NAME_WITH_PATH

  • EXCEPTIONS

  • PATH_NOT_FOUND = 1

  • MISSING_PARAMETER = 2

  • OPERATING_SYSTEM_NOT_FOUND = 3

  • FILE_SYSTEM_NOT_FOUND = 4

  • OTHERS = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Regards

Raja

vinod_gunaware2
Active Contributor
0 Kudos

Use

<b>WS_FILENAME_GET</b> Call file Selector Browse and get file name of the chosen type

use above function module.

regards

vinod

Former Member
0 Kudos

Hi Vinod,

Thanks for the input,

But it be helpful if i can know whether using the Fm FILE_GET_NAME_USING_PATH will result in a short dump When the standard functionality is used inseted of handling it using the Message ;text tyep E way

by standard i mean :

if sy-subrc ne 0.

MESSAGE MSGID sy-msgno msgno

endif.

Former Member
0 Kudos

Avinash,

There is no specific way of doing that. When the dump happens usually you can find why it has occured and make sure your parameters are not causing the issue.

Once the X or A, there is nothing much we can do about it. And more over, when that happends that means some thing has happened that should not have happened.

Regards,

Ravi

Note Please mark the helpful answers