Selection screen to export file

Selection screen to export file

Check code below


PARAMETERS : 
    p_serv  RADIOBUTTON GROUP g1 USER-COMMAND uc1 DEFAULT 'X',       " Server
    p_lpath TYPE pathintern DEFAULT 'Z_DEFAULT_LOGICAL_PATH',        " Logical path
    p_local RADIOBUTTON GROUP g1,                                    " Local
    p_path  TYPE string.                                             " Physical path
AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF screen-name = 'P_LPATH'.
      IF p_serv = 'X'.
        screen-input = '1'.
      ELSE.
        screen-input = '0'.
      ENDIF.
      MODIFY SCREEN.
    ELSEIF screen-name = 'P_PATH'.
      IF p_local = 'X'.
        screen-input = '1'.
      ELSE.
        screen-input = '0'.
      ENDIF.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
  IF p_local = 'X'.
    CALL METHOD cl_gui_frontend_services=>directory_browse
      EXPORTING
        window_title    = gv_string
      CHANGING
        selected_folder = p_path
      EXCEPTIONS
        OTHERS          = 0.
  ENDIF.

If requested to also add a search-help on logical path, you can use :


  DATA: lt_return_tab      TYPE TABLE OF ddshretval.
    CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
      EXPORTING
        tabname           = 'FILENAME'
        fieldname         = 'PATHINTERN'
      TABLES
        return_tab        = lt_return_tab
      EXCEPTIONS
        field_not_found   = 1
        no_help_for_field = 2
        inconsistent_help = 3
        no_values_found   = 4
        OTHERS            = 5.
    IF sy-subrc = 0.
      READ TABLE lt_return_tab INTO DATA(ls_return) INDEX 1.
      IF sy-subrc = 0.
        p_lpath = ls_return-fieldval.
      ENDIF.
    ENDIF.

About the author

fjourneau administrator

Hi, I'm Florian Journeau, SAP ABAP R3 Freelance, based in Toulouse, France. You want to know more about me, have a look on my CV : cv.fjourneau.net.

Leave a Reply