Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

F4 Help for presentation server filepath/name

Hi,

Can anyone tell me how can I get a F4 help for selecting a file or directory from the PC...i.e I should get a pop-up “Open File” dialog to select the File on PC.

Thanks!

Sunitha.

Tags:
Former Member
Former Member replied

Hi Sunitha.,

You can write the following code in the At selection screeb value request event.

Using ABAP Objects:

PARAMETER : p_file LIKE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR path.
  DATA: directory TYPE string,                             
        filetable TYPE filetable,                          
        line      TYPE LINE OF filetable,                  
        rc        TYPE i.                                  
  CALL METHOD cl_gui_frontend_services=>get_temp_directory 
    CHANGING                                               
      temp_dir = directory.                                
  CALL METHOD cl_gui_frontend_services=>file_open_dialog   
    EXPORTING                                              
      window_title      = 'SELECT THE FILE'          
      initial_directory = directory                        
      file_filter       = '*.XLS'                          
      multiselection    = ' '                              
    CHANGING                                               
      file_table        = filetable                                                          
       rc                = rc.                          
   IF rc = 1.                                           
     READ TABLE filetable INDEX 1 INTO line.            
     P_FILE = line-filename.                          
   ENDIF.                                               

Using Normal ABAP:

DATA:   P_FILE LIKE RLGRAP-FILENAME,
        DPATH LIKE RLGRAP-FILENAME,
        UPATH LIKE RLGRAP-FILENAME,
        MODE TYPE C,
        FLG_UD TYPE C.

  CALL FUNCTION 'WS_ULDL_PATH'
       IMPORTING
            DOWNLOAD_PATH = DPATH
            UPLOAD_PATH   = UPATH.

  IF FLG_UD <> 'D'.
    DPATH = UPATH.
    MODE = 'O'.
  ELSE.
    MODE = 'S'.
  ENDIF.

  CALL FUNCTION 'WS_FILENAME_GET'
       EXPORTING
            DEF_FILENAME     = '*.XLS'
            DEF_PATH         = DPATH
            MASK             = ',*.XLS,*.*,*.*.'
            MODE             = MODE
       IMPORTING
            FILENAME         = P_FILE
       EXCEPTIONS
            SELECTION_CANCEL = 3.
  IF SY-SUBRC <> 0.
    EXIT.
  ENDIF.

Just copy paste the code this should work fine.

Cheers

VJ

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question