Skip to Content
author's profile photo Former Member
Former Member

Upload file

on click of a pushbutton i need a popup to appear which will ask for filepath.. and in tht filepath popup i can then click on F4 and then get the filename and the path

how can be this done ?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Posted on Jul 04, 2008 at 07:15 AM

    KD_GET_FILENAME_ON_F4

    use this FM..

    Reward points if helpful..

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 07:16 AM

    Hi,

    Use function module 'F4_FILENAME'.

    Try the following:

    PARAMETERS : p_fname TYPE rlgrap-filename OBLIGATORY.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.

    CALL FUNCTION 'F4_FILENAME'

    EXPORTING

    program_name = syst-cprog

    dynpro_number = syst-dynnr

    field_name = ' '

    IMPORTING

    file_name = p_fname.

    Regards,

    Jaya Vani

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 07:20 AM

    Hi Shweta,

    You can use the function module F4_FILENAME.

    When the SY-UCOMM value is eqaul to the function code of the pushbutton, then call this function module.

    CALL FUNCTION 'F4_FILENAME'

    IMPORTING

    file_name = p_filename.

    Hope this helps you.

    Any queries, get back to me.

    Regards,

    Chandra Sekhar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 07:23 AM

    Hi,

    In at-selection screen event we can trigger the FM 'F4IF_INT_TABLE_VALUE_REQUEST'.

    Pls check this below code.

    PARAMETERS :

    p_carrid LIKE spfli-carrid,

    p_connid LIKE spfli-connid.

    DATA:

    BEGIN OF itab_connid OCCURS 3,

    carrid TYPE S_CARR_ID,

    connid TYPE SPFLI-CONNID,

    END OF itab_connid

    DATA:

    W_TABIX LIKE SY-TABIX,

    w_carrid LIKE spfli-carrid,

    W_CONNID LIKE SPFLI-CONNID.

    DATA:

    T_RETURN TYPE STANDARD TABLE OF DDSHRETVAL WITH HEADER LINE.

    DATA:

    W_CONN TYPE dfies-fieldnamE,

    W_CARR TYPE dfies-fieldname.

    • AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_CONNID.

    SELECT carrid connid

    FROM spfli

    INTO CORRESPONDING FIELDS OF TABLE itab_connid

    WHERE carrid EQ W_carrid.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    retfield = W_CONN

    value_org = 'S'

    TABLES

    value_tab = itab_connid

    RETURN_TAB = T_RETURN

    EXCEPTIONS

    parameter_error = 1

    no_values_found = 2

    OTHERS = 3.

    IF sy-subrc EQ 0.

    • READ TABLE T_RETURN INDEX SY-TABIX INTO p_connid.

    ENDIF.

    w_connid = T_RETURN-FIELDVAL.

    p_connid = w_connid.

    Reward if helpful.

    Regards

    Chandralekha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 07:36 AM

    Hi

    U can use only the method FILE_OPEN_DIALOG of class CL_GUI_FRONTEND_SERVICES:

    DATA: FILETABLE TYPE FILETABLE,
          FILE      TYPE FILE_TABLE,
          RC        TYPE I.
    
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
    *  EXPORTING
    *    WINDOW_TITLE            =
    *    DEFAULT_EXTENSION       =
    *    DEFAULT_FILENAME        =
    *    FILE_FILTER             =
    *    INITIAL_DIRECTORY       =
    *    MULTISELECTION          =
      CHANGING
        FILE_TABLE              = FILETABLE
        RC                      = 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.
    ELSE.
      READ TABLE FILETABLE INDEX 1 INTO FILE.
    ENDIF.

    If you want to show a popup before choosing the file u can use a code like this:

    DATA: T_FIELDS TYPE TABLE OF SVAL WITH HEADER LINE,
          F4_FORMNAME(30) VALUE 'F4_FOR_FILE',
          F4_PROGRAMNAME LIKE  TRDIR-NAME.
    
    
    
    F4_PROGRAMNAME = SY-REPID.
    *
    
    T_FIELDS-TABNAME    = 'RLGRAP'.
    T_FIELDS-FIELDNAME  = 'FILENAME'.
    APPEND T_FIELDS.
    
    
    CALL FUNCTION 'POPUP_GET_VALUES_USER_HELP'
      EXPORTING
    *   F1_FORMNAME                     = ' '
    *   F1_PROGRAMNAME                  = ' '
        F4_FORMNAME                     = F4_FORMNAME
        F4_PROGRAMNAME                  = F4_PROGRAMNAME
    *   FORMNAME                        = ' '
        POPUP_TITLE                     = 'Get file'
    *   PROGRAMNAME                     = ' '
    *   START_COLUMN                    = '5'
    *   START_ROW                       = '5'
    *   NO_CHECK_FOR_FIXED_VALUES       = ' '
    * IMPORTING
    *   RETURNCODE                      =
      TABLES
        FIELDS                          = T_FIELDS
    * EXCEPTIONS
    *   ERROR_IN_FIELDS                 = 1
    *   OTHERS                          = 2
              .
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    
    
    *---------------------------------------------------------------------*
    *       FORM F4_FOR_FILE                                              *
    *---------------------------------------------------------------------*
    *       ........                                                      *
    *---------------------------------------------------------------------*
    *  -->  TABNAME                                                       *
    *  -->  FIELDNAME                                                     *
    *  -->  DISPLAY                                                       *
    *  -->  RETURNCODE                                                    *
    *  -->  VALUE                                                         *
    *---------------------------------------------------------------------*
    FORM F4_FOR_FILE USING TABNAME
                           FIELDNAME
                           DISPLAY
                     CHANGING RETURNCODE VALUE.
    
      DATA: FILETABLE TYPE FILETABLE,
            FILE      TYPE FILE_TABLE,
            RC        TYPE I,
            USR_ACT   TYPE I.
    
    
      IF TABNAME = 'RLGRAP' AND FIELDNAME = 'FILENAME'.
        CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
          CHANGING
            FILE_TABLE              = FILETABLE
            RC                      = RC
            USER_ACTION             = USR_ACT
          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.
        ELSE.
          IF USR_ACT = 0.
            READ TABLE FILETABLE INDEX 1 INTO FILE.
            MOVE FILE TO VALUE.
          ELSE.
            RETURNCODE = 'A'.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 07:46 AM

    hi r u looking for presentation server or application server..

    this is for both..

    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/f4%2bfor%2bfiles%2bon%2bpresentation%2bor%2bapplication%2bserver

    for presentation server use this..

    FM 'F4_FILENAME'.

    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG

    Class is CL_GUI_FRONTEND_SERVICES and method is DIRECTORY_BROWSE

    for application server..

    FM

    F4_DXFILENAME_TOPRECURSION

    'F4_DXFILENAME_4_DYNP'

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.