AT SELECTION-SCREEN ON VALUE-REQUEST FOR feldname

Aus SAP-Wiki
Zur Navigation springenZur Suche springen


Die F4-Hilfe zu einem Feld im Selektionsbildschirm "p_file" wird hier programmiert.

Parameters: P_FILE TYPE RLGRAP-FILENAME.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
 PERFORM get_filename USING p_file.
*&---------------------------------------------------------------------*
*&      Form  GET_FILENAME
*&---------------------------------------------------------------------*
*       Gibt Dateinamen zurück mit Dialogbildschirm
*----------------------------------------------------------------------*
FORM get_filename 
 CHANGING pcv_file TYPE RLGRAP-FILENAME.

  DATA: lt_filetable TYPE filetable,
        ls_filetable LIKE LINE OF lt_filetable,
        lv_rc TYPE i.

  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
      multiselection          = ' '
    CHANGING
      file_table              = lt_filetable
      rc                      = lv_rc
    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.
  ENDIF.

  IF lv_rc > 0.
    LOOP AT lt_filetable INTO ls_filetable.
      pcv_file = ls_filetable-filename.
    ENDLOOP.
  ENDIF.

ENDFORM.                    " get_filename