Skip to Content

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

Upload file from PC

Hi

I have to upload a file from PC and in my selection screen i have declared like this

PARAMETERS       : P_FN TYPE RLGRAP-FILENAME.

But i am not getting the F4 help for this field until or unless with out the F4 help i can not choose the file which is in the system.

Can any one help me out how to get the F4 help.

Thanks

JAJ

replied
PARAMETERS:gv_f_pc  TYPE rlgrap-filename.
DATA:FILENAME TYPE STRING.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR gv_f_pc .
*--- search help to select file from pc
  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
      STATIC        = 'X'
    CHANGING
      file_name     = gv_f_pc
    EXCEPTIONS
      mask_too_long = 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.

START-OF-SELECTION.

  FILENAME = gv_f_pc.

CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                = filename
          FILETYPE                = 'ASC'
        TABLES
          DATA_TAB                = GT_DATA
        EXCEPTIONS
          FILE_OPEN_ERROR         = 1
          FILE_READ_ERROR         = 2
          NO_BATCH                = 3
          GUI_REFUSE_FILETRANSFER = 4
          INVALID_TYPE            = 5
          NO_AUTHORITY            = 6
          UNKNOWN_ERROR           = 7
          BAD_DATA_FORMAT         = 8
          HEADER_NOT_ALLOWED      = 9
          SEPARATOR_NOT_ALLOWED   = 10
          HEADER_TOO_LONG         = 11
          UNKNOWN_DP_ERROR        = 12
          ACCESS_DENIED           = 13
          DP_OUT_OF_MEMORY        = 14
          DISK_FULL               = 15
          DP_TIMEOUT              = 16
          OTHERS                  = 17.

      IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDIF.
0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question