Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

F4_Filename ?

Former Member
0 Likes
912

I use F4_filename FM to help the user browse for files .

The requirement is :

There is a variant that has the Dir path :
corp-abc\sap-abap\.

The user wants that when he uses this variant and does an F4 , just the files listed in this directory should pop up for his selection ...?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
796

YOu can alternative use the Class method:

CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG which has export parameters like:

INITIAL_DIRECTORY etc

Regards,

ravi

I use F4_filename FM to help the user browse for files .

The requirement is :

There is a variant that has the Dir path :
corp-abc\sap-abap\.

The user wants that when he uses this variant and does an F4 , just the files listed in this directory should pop up for his selection ...?

4 REPLIES 4
Read only

Former Member
0 Likes
797

YOu can alternative use the Class method:

CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG which has export parameters like:

INITIAL_DIRECTORY etc

Regards,

ravi

Read only

Former Member
0 Likes
796

hi,

Check out this


CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
    EXPORTING
       DEFAULT_FILENAME        = '\corp-abcsap-abap'
    CHANGING
       FILE_TABLE              = ITAB_FILE1_TABLE
       RC                      = RC_FILE
     EXCEPTIONS
       FILE_OPEN_DIALOG_FAILED = 1
       CNTL_ERROR              = 2
       ERROR_NO_GUI            = 3
       NOT_SUPPORTED_BY_GUI    = 4
       others                  = 5.
  IF SY-SUBRC <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Regards,

Santosh

Read only

0 Likes
796

Thanks for the replies ,

It works now

Message was edited by: SAP BEE

Read only

0 Likes
796

hi, try this code


parameters : filename   like rlgrap-filename obligatory.
at selection-screen on value-request for filename.
    perform get_file.
*&---------------------------------------------------------------------*
*&      Form  get_file
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form get_file.
   call function 'KD_GET_FILENAME_ON_F4'
          exporting
               mask          = '*.*'
          changing
               file_name     = filename
          exceptions
               mask_too_long = 1
               others        = 2.

  call function 'WS_UPLOAD'
       exporting
            filename            = filename
            filetype            = 'DAT'
       tables
            data_tab            = itab
       exceptions
            conversion_error    = 1
            file_open_error     = 2
            file_read_error     = 3
            invalid_table_width = 4
            invalid_type        = 5
            no_batch            = 6
            unknown_error       = 7
            others              = 8.

endform.                    " get_file

ibrahim