2007 May 09 8:25 AM
hi
My requirement: download from al11 to presentation server.
user wants an input field to specify the destination folder where the file should be downloaded.
for e.g. Func Mod F4_FILENAME gets the name of a file, but i only want to specify a folder for eg.
C:\Documents and Settings\userabap\Desktop\
let me be more clear:
i want to have a F4 help on an input field where i can get the above file path by using the help.
hope u got my point.
help will be rewarded.
2007 May 09 8:50 AM
PARAMETERS:
* path for log/error files
P_DIR_LG TYPE LOCALFILE DEFAULT TEXT-F02 OBLIGATORY.
*Browse Dialog on Value Request on P_DIR_LG--------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_DIR_LG.
PERFORM SUB_DIRECTORY_SELECT USING P_DIR_LG.
*&---------------------------------------------------------------------*
*& Form SUB_DIRECTORY_SELECT
*&---------------------------------------------------------------------*
* Browse through the Directories and get the user selection
*----------------------------------------------------------------------*
* -->P_DIR directory
*----------------------------------------------------------------------*
FORM SUB_DIRECTORY_SELECT USING P_DIR TYPE LOCALFILE.
* Local Data
DATA: L_SEL_DIR TYPE STRING.
* Browse the Directories
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_BROWSE
* EXPORTING
* WINDOW_TITLE =
* INITIAL_FOLDER =
CHANGING
SELECTED_FOLDER = L_SEL_DIR
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_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.
ELSE.
P_DIR = L_SEL_DIR.
ENDIF.
ENDFORM. " SUB_DIRECTORY_SELECT
hi
My requirement: download from al11 to presentation server.
user wants an input field to specify the destination folder where the file should be downloaded.
for e.g. Func Mod F4_FILENAME gets the name of a file, but i only want to specify a folder for eg.
C:\Documents and Settings\userabap\Desktop\
let me be more clear:
i want to have a F4 help on an input field where i can get the above file path by using the help.
hope u got my point.
help will be rewarded.
2007 May 09 8:45 AM
Hi,
May be you can decide the file name and concatenate the file name with the folder path you choose.
Or you can use C13G0_GET_FILENAME_F4
Hope this solves your purpose.
Award points if it helps.
-Gaurang
2007 May 09 8:50 AM
PARAMETERS:
* path for log/error files
P_DIR_LG TYPE LOCALFILE DEFAULT TEXT-F02 OBLIGATORY.
*Browse Dialog on Value Request on P_DIR_LG--------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_DIR_LG.
PERFORM SUB_DIRECTORY_SELECT USING P_DIR_LG.
*&---------------------------------------------------------------------*
*& Form SUB_DIRECTORY_SELECT
*&---------------------------------------------------------------------*
* Browse through the Directories and get the user selection
*----------------------------------------------------------------------*
* -->P_DIR directory
*----------------------------------------------------------------------*
FORM SUB_DIRECTORY_SELECT USING P_DIR TYPE LOCALFILE.
* Local Data
DATA: L_SEL_DIR TYPE STRING.
* Browse the Directories
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_BROWSE
* EXPORTING
* WINDOW_TITLE =
* INITIAL_FOLDER =
CHANGING
SELECTED_FOLDER = L_SEL_DIR
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_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.
ELSE.
P_DIR = L_SEL_DIR.
ENDIF.
ENDFORM. " SUB_DIRECTORY_SELECT
2007 May 09 8:55 AM
Hi, Please try this. Here give the folder path but not file name, Pass the file name to GUI_Download, This works as F4 help.
Place this at the At selection-screen event:
At selection-screen.
*&---------------------------------------------------------------------*
*& Form get_path
*&---------------------------------------------------------------------*
* Get The File Path for Download.
*----------------------------------------------------------------------*
FORM get_path.
* Provide F4 Help for Download Path Selection
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = 'ZFIPDRDGCSV'
dynpro_number = sy-dynnr
field_name = p_wsfile
CHANGING
file_name = p_wsfile
EXCEPTIONS
mask_too_long = 1
OTHERS = 2.
*
IF sy-subrc <> 0.
MESSAGE s001(zf) WITH 'Given Path Unsucessful'(010).
ENDIF.
*
ENDFORM. " get_path
call function gui_download.
where filename = p_wsfileHope it works.
Thanks.
Reward helpful Answers.
2007 May 09 9:28 AM
*----------------------------------------------------------------------*
* Selection Screen *
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b01.
SELECTION-SCREEN BEGIN OF BLOCK b11 WITH FRAME TITLE text-b11.
PARAMETERS : p_local AS CHECKBOX DEFAULT 'X' MODIF ID grp,
p_output LIKE rlgrap-filename OBLIGATORY MODIF ID grp.
* DEFAULT c_file. D-RD1K907385
SELECTION-SCREEN END OF BLOCK b11.
SELECTION-SCREEN BEGIN OF BLOCK b12 WITH FRAME TITLE text-b12.
SELECT-OPTIONS : s_paobjn FOR ykpcat_paobjnr-paobjnr MODIF ID mod,
s_type FOR ykpcat_paobjnr-type MODIF ID mod.
SELECTION-SCREEN END OF BLOCK b12.
SELECTION-SCREEN END OF BLOCK b01.
SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-b02.
PARAMETERS : p_delws RADIOBUTTON GROUP rd1 USER-COMMAND flag,
p_modify RADIOBUTTON GROUP rd1 DEFAULT 'X',
p_delete RADIOBUTTON GROUP rd1 .
SELECTION-SCREEN END OF BLOCK b02.
*----------------------------------------------------------------------*
* AT SELECTION-SCREEN *
*----------------------------------------------------------------------*
*--Providing F4 help for the file.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_output.
PERFORM execute_f4help USING 'P_OUTPUT' 'P_LOCAL'.
*---------------------------------------------------------------------*
* AT SELECTION SCREEN OUTPUT *
*---------------------------------------------------------------------*
AT SELECTION-SCREEN OUTPUT.
*--Take the selection from the user
LOOP AT SCREEN.
IF screen-group1 = 'GRP'.
IF NOT p_delws IS INITIAL.
screen-active = 0.
screen-invisible = 1.
ELSE.
screen-active = 1.
screen-invisible = 0.
ENDIF.
ENDIF.
*--Hide the user selection criteria when Delete With
*--Selection is not selected
IF screen-group1 = 'MOD'.
IF p_delws IS INITIAL.
screen-active = 0.
screen-invisible = 1.
ELSE.
screen-active = 1.
screen-invisible = 0.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
*&--------------------------------------------------------------------*
*& Form execute_f4help
*&--------------------------------------------------------------------*
* Form called for f4 help to the output file field.
*---------------------------------------------------------------------*
FORM execute_f4help USING fp_file
fp_local.
*-- Local data declaration
DATA : l_local TYPE c,
tl_dynpread TYPE STANDARD TABLE OF dynpread WITH HEADER LINE.
CLEAR l_local.
REFRESH tl_dynpread.
*-- Populating tl_dynpread with screen elements ie checkboxes whose
*-- Values are tracked.
tl_dynpread-fieldname = fp_local. " Presentation Server
APPEND tl_dynpread.
*-- Check the Values from Screen
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-cprog " Calling program
dynumb = sy-dynnr " Screen number
TABLES
dynpfields = tl_dynpread
EXCEPTIONS
OTHERS = 11.
IF sy-subrc NE 0.
MESSAGE e103(zz) WITH
'Exception raised while reading the Screen.'(002).
ENDIF. " IF SY-SUBRC NE 0.
*-- Getting server type
READ TABLE tl_dynpread WITH KEY fieldvalue = 'X'
BINARY SEARCH.
IF sy-subrc IS INITIAL.
l_local = 'P'.
ELSE.
l_local = 'A'.
ENDIF.
*-- Selects the directory list based on the dowmload location
*-- button selected.
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
dynpfield_filename = fp_file
dyname = sy-cprog
dynumb = sy-dynnr
filetype = 'P'
location = l_local
server = space.
ENDFORM. " EXECUTE_F4HELPHope this helps........
p_local is a checkbox to determine if its a local file or a server file.
2007 May 09 9:36 AM
Hi guys
I am thankful to you for your support, unfortunately my purpose is not yet met.
actually i need to get only the folder path and not the file path.
thanks
2008 May 24 10:36 AM
Hello Sam Al,
but have you ever tried this suggested solutions? You will get only the Folder Path.
Regards
Gregor
2008 May 24 12:35 PM
hi check this..
execute the tcode CG3Y..then will ask for the folder on the presentation server
regards,
venkat
2008 Sep 23 10:39 AM
Hi Sam,
is your problem solved ??
i want similar requirement, need to create folder or select folder through F4 help.
2008 Sep 23 10:43 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |