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: 

how to define f4 help for parameters in selection screen.

Former Member
0 Kudos

Hi Folks,

I have declared parametrs of type RLGRAP-FILENAME and i want to select the path for the application server file by pressing f4 during run time , not like typing the path in the field input. Pls help me how to do that.

Thanks in advance.

Regards

Rajesh

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Rajesh,

You can use this FM

 AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_apath.

* Open the Browse Dialog Box on the Application Server
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
IMPORTING
serverfile = p_apath
EXCEPTIONS
canceled_by_user = 1
OTHERS = 2.

IF sy-subrc <> 0.
* No need to check for sy-subrc
ENDIF.

Of use this

Check the FM 'F4_DXFILENAME_TOPRECURSION'

call function 'F4_DXFILENAME_TOPRECURSION'

exporting

i_location_flag = 'A'

i_server = '?'

fileoperation = 'R'

importing

o_path = p_file

exceptions

rfc_error = 1

error_with_gui = 2

others = 3.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with

Cheers

VJ

9 REPLIES 9

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Couple of ways to do this. One is to use the method FILE_OPEN_DIALOG in the class CL_GUI_FRONTEND_SERVICES.

Regards,

Rich Heilman

0 Kudos

Hi,

Use the funtion module.

F4IF_INT_TABLE_VALUE_REQUEST.

If it is useful , Please award suitable points and close the thread.

Regards,

Irfan Hussain

Former Member
0 Kudos

Rajesh,

You'll need to change parameter names etc., but here's the idea...

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-REPID

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = 'p_file'

IMPORTING

FILE_NAME = P_FILE

EXCEPTIONS

OTHERS = 1.

Regards,

Den

Former Member
0 Kudos

Hi Rajesh,

You can use this FM

 AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_apath.

* Open the Browse Dialog Box on the Application Server
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
IMPORTING
serverfile = p_apath
EXCEPTIONS
canceled_by_user = 1
OTHERS = 2.

IF sy-subrc <> 0.
* No need to check for sy-subrc
ENDIF.

Of use this

Check the FM 'F4_DXFILENAME_TOPRECURSION'

call function 'F4_DXFILENAME_TOPRECURSION'

exporting

i_location_flag = 'A'

i_server = '?'

fileoperation = 'R'

importing

o_path = p_file

exceptions

rfc_error = 1

error_with_gui = 2

others = 3.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with

Cheers

VJ

Former Member
0 Kudos

Rajesh,

I guess you are looking for F4 help on the app server, so the CL_GUI_FRONTEND_SERVICES will not work. Take a look at these links ..

Quite a few functions listed that you can use.

Regards,

Ravi

Note : Please mark all the helpful answers

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Another way is like this.




report zrich_0001.

parameters: p_file type localfile.

at selection-screen on value-request for p_file.
  call function 'KD_GET_FILENAME_ON_F4'
       exporting
            static    = 'X'
       changing
            file_name = p_file.


REgards,

Rich Heilman

0 Kudos

Oh yes, I missed the "app server" part, the solutions I have posted will not work for that. Sorry.

Regards,

Rich Heilman

Former Member
0 Kudos

Hai Rajesh

DATA: I_FILETABLE TYPE FILETABLE,

V_RC TYPE I.

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

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

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.

Thanks & regards

Sreenivasulu P

former_member480923
Active Contributor
0 Kudos

Hi try this code

AT SELECTION-SCREEN ON VALUE-REQUEST FOR PC_FILE.
  L_FILENAME = PC_FILE.

  CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
    EXPORTING
      WINDOW_TITLE            = ' File for Upload'
      DEFAULT_EXTENSION       = '*.xls'
      DEFAULT_FILENAME        = L_FILENAME
*    FILE_FILTER             =
*    INITIAL_DIRECTORY       =
*    MULTISELECTION          =
    CHANGING
      FILE_TABLE              = T_FILETAB
      RC                      = L_RC
*    USER_ACTION             =
    EXCEPTIONS
      FILE_OPEN_DIALOG_FAILED = 1
      CNTL_ERROR              = 2
      ERROR_NO_GUI            = 3
      OTHERS                  = 4.
  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 T_FILETAB INTO X_FILETAB INDEX 1.

hope this helps

Anirban