05-24-2006 12:24 AM
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
05-24-2006 12:32 AM
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
05-24-2006 12:31 AM
05-24-2006 6:14 AM
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
05-24-2006 12:32 AM
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
05-24-2006 12:32 AM
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
05-24-2006 12:36 AM
05-24-2006 12:37 AM
05-24-2006 12:38 AM
05-24-2006 6:06 AM
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
05-24-2006 6:46 AM
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