2009 May 18 11:30 AM
Hi,
i am creating one screen consisting of 2 fields:
1. Folder Selection
2. File Selection
My Requirement is hw to add F4 help to File Selection Field to select local file and add that into that field? This is module pool programming.
Can any one giv me a reply...
Regards,
Srinath
2009 May 18 12:42 PM
Hi,
First you capture the input which you have given in the Issue no field using the following FM
Use FM 'C14Z_DYNP_READ_FIELD'
For Instance it should be like below
Data : v_field(255) type c.
CALL FUNCTION 'C14Z_DYNP_READ_FIELD'
EXPORTING
i_program = sy-repid
i_dynpro = sy-dynnr
i_fieldname = 'V_PLANT' "here specify your own field which u want to read
i_flg_steploop = ''
CHANGING
e_value = v_field. "Specify the variable inwhich u want to have the value and based on that u select other F4 help entries
and then based on the selected value select the data to shown in the select search help and apply that internal table in second field search help FM call.
Use the FM "F4IF_INT_TABLE_VALUE_REQUEST"
/community [original link is broken]
2009 May 18 1:02 PM
Hi Srinath,
<< Cut and paste without attribution from http://www.saptechies.com/how-to-add-f4-help-to-a-field-on-screen-module-pool/ removed >>
Edited by: Rob Burbank on May 18, 2009 4:08 PM
2009 May 18 1:10 PM
Hi Srinath,
I understood that u need F4 help which redirects to the folders in the local system.
The FM used for this is 'F4_FILENAME'
Ex :
CALL FUNCTION 'F4_FILENAME'
IMPORTING
FILE_NAME = FILENAME. -
> Decleration FILENAME LIKE RLGRAP-FILENAME.
Hope this will be helpful to you.
2009 May 18 1:26 PM
Hi Srinath,
see the sample code ...
how to write the code in dynpro..
PROCESS AFTER INPUT.
* Module Screen Exit and Cancel Operation
MODULE exit_screen_1020 AT EXIT-COMMAND.
*F4 Help
PROCESS ON VALUE-REQUEST.
FIELD p_filename MODULE f4_choose_filename.
Module f4_choose_filename INPUT . "INPUT
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
i_location_flag = 'P'
i_server = ' '
i_path = p_filename
filemask = ' '
fileoperation = 'R'
IMPORTING
o_path = p_filename .
ENDMODULE.
Regards,
Prabhudas
2009 May 18 2:14 PM
Hi,
Use FM 'F4_FILENAME' . Pass your selection parameter to this FM.
2009 May 18 8:49 PM
Hi,
In screen flow logic (jn POV - PROCESS ON VALUE-REQUEST) you can use any of provided above FMs or you can do this using cl_gui_frontend_services class and its static method file_open_dialog .
Check this out: [read a file from directory using cl_gui_frontend_services|http://sapprograms.blogspot.com/2008/12/read-file-from-directory-using.html]
Please note. Althought using FMs is not banned, it is recommended to go for ABAP OO aproach, where new classes are derived from old FMs imporving their perfomance or filling some "gap".
Regards
Marcin
2009 May 19 5:28 AM
Hi,
Use the following function module.
parameters : p_url TYPE localfile.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = syst-repid
dynpro_number = syst-dynnr
static = 'X'
mask = ',Excel Worksheet,*.XLS'
CHANGING
file_name = p_url
EXCEPTIONS
mask_too_long = 1
OTHERS = 2.
Here p_url must be the parameter value also.
you write this function module in
process ON VALUE-REQUEST.
field p_url module browse_file_9000.
where browse_file_9000 is the module which will have the function module call.
Using this FM, you can restrict the file type also. For example, the above example will open only Excel file. If you want to open only text file, then in mask parameter you write as ',Text document,*.txt'.
Thanks and regards