Application Development 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: 

regarding gui_download

Former Member
0 Kudos

hi all,

i have declared a parameter as following

PARAMETERS : p_file LIKE rlgrap-filename DEFAULT 'c:\kk.xls' MODIF ID bl2.

and in gui_download im passing as follow

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = p_file

FILETYPE = 'ASC'

WRITE_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = it_final_tab.

but the problem is when im commin to particular part i.e to gui_download fm system is giving an error where as if i specify the path insted of passing the p_file im not gettin an error but my requirement is like the user specifies the path at selection time can any one got a clue abt this. I thinks while passing the p_file its not taking the ' ' (quotes) into considaration how to pass the quotes in the selection screen.

thanks

Anupama

2 REPLIES 2

Former Member
0 Kudos

hi,

For User File Path ... Use the below code


*&---------------------------------------------------------------------

*& Form f1000_browse_presentation_file
*&---------------------------------------------------------------------

    * Pick up the file path in the presentation server

*&---------------------------------------------------------------------

FORM f1000_browse_presentation_file .

CONSTANTS: lcl_path TYPE char20 VALUE 'C:\'.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_path = lcl_path
mask = c_mask "',.,..'
mode = c_mode
title = text-006
IMPORTING
filename = p_f1
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 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.

flg_pre = c_x.
ENDIF.

endform. 

Former Member
0 Kudos

Hi

U can try a code like this:

PARAMETERS: P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

  PERFORM F4_FOR_FILE USING P_FILE.

START-OF-SELECTION.

 DATA FILENAME TYPE STRING.

 MOVE P_FILE TO FILENAME.

  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      FILENAME                      = FILENAME
      .........................



FORM F4_FOR_FILE USING    X_FILE.
  DATA: T_FILE_IN TYPE FILETABLE,
        W_FILE_IN TYPE FILE_TABLE,
        RC        TYPE I.

  CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
    CHANGING
      FILE_TABLE              = T_FILE_IN
      RC                      = RC
    EXCEPTIONS
      FILE_OPEN_DIALOG_FAILED = 1
      CNTL_ERROR              = 2
      ERROR_NO_GUI            = 3
      OTHERS                  = 4.

  IF SY-SUBRC = 0.
    CHECK RC = 1.
    READ TABLE T_FILE_IN INTO W_FILE_IN INDEX 1.
    MOVE W_FILE_IN TO X_FILE.
  ENDIF.
ENDFORM.                    " F4_FOR_FILE.

Max

Edited by: max bianchi on Apr 14, 2008 10:36 AM