Call function 'gui_download'

Hallo Friends,
I am using the above fuction in my program. I want the header of my internal table to be writen als header in the text file. So, I created another Itab (Itab-col_1) and appended all the headers in this, which I later use as below.
Problem:
1.
I am not satisfied with the downloaded output in file.txt  I want the header to be excactly over the column content. Please see my output:
MANDT     LIFNR     LAND1     NAME1     NAME2     NAME3
010§§§§§§0000010000§§§§§§§§§§§§§§§§§§DE§§§§§§Test
010§§§§§§0000100000§§§§§§§§§§§§§§§§§§US§§§§§§TEST
§ § means Space
It is Obvious LAND1 should be over DE / US, NAME1 should be over Test / TEST etc etc     
2.
I would like filed seperator to be ( ; ) not space. The flag 'X' gives space.
CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename                  = str
      filetype                    = 'ASC'
      write_field_separator = 'X'
      dat_mode                = 'X'
    TABLES
      data_tab                   = itab_kreditor
      fieldnames                = itab_datei_col_header
    EXCEPTIONS
      file_write_error           = 1
      file_not_found            = 19
      OTHERS                   = 22.
So, how can I solve these two problems.
Blacky.

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
  BIN_FILESIZE                    = BIN_FILESIZE
    filename                        = filename
  FILETYPE                        = 'ASC'
  APPEND                          = ' '
<b> WRITE_FIELD_SEPARATOR           = ';'</b>
  HEADER                          = '00'
  TRUNC_TRAILING_BLANKS           = ' '
  WRITE_LF                        = 'X'
  COL_SELECT                      = ' '
  COL_SELECT_MASK                 = ' '
  DAT_MODE                        = ' '
  CONFIRM_OVERWRITE               = ' '
  NO_AUTH_CHECK                   = ' '
  CODEPAGE                        = ' '
  IGNORE_CERR                     = ABAP_TRUE
  REPLACEMENT                     = '#'
  WRITE_BOM                       = ' '
  TRUNC_TRAILING_BLANKS_EOL       = 'X'
  WK1_N_FORMAT                    = ' '
  WK1_N_SIZE                      = ' '
  WK1_T_FORMAT                    = ' '
  WK1_T_SIZE                      = ' '
IMPORTING
  FILELENGTH                      = FILELENGTH
  TABLES
    data_tab                        = data_tab
  FIELDNAMES                      = FIELDNAMES
EXCEPTIONS
  FILE_WRITE_ERROR                = 1
  NO_BATCH                        = 2
  GUI_REFUSE_FILETRANSFER         = 3
  INVALID_TYPE                    = 4
  NO_AUTHORITY                    = 5
  UNKNOWN_ERROR                   = 6
  HEADER_NOT_ALLOWED              = 7
  SEPARATOR_NOT_ALLOWED           = 8
  FILESIZE_NOT_ALLOWED            = 9
  HEADER_TOO_LONG                 = 10
  DP_ERROR_CREATE                 = 11
  DP_ERROR_SEND                   = 12
  DP_ERROR_WRITE                  = 13
  UNKNOWN_DP_ERROR                = 14
  ACCESS_DENIED                   = 15
  DP_OUT_OF_MEMORY                = 16
  DISK_FULL                       = 17
  DP_TIMEOUT                      = 18
  FILE_NOT_FOUND                  = 19
  DATAPROVIDER_EXCEPTION          = 20
  CONTROL_FLUSH_ERROR             = 21
  OTHERS                          = 22
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
Vasu

Similar Messages

  • Fm CALL FUNCTION 'GUI_DOWNLOAD'

    hi experts:
                    How to add a field name line in fm 'GUI_DOWNLOAD'?
    allen

    hI,
    DATA: V_PATH TYPE STRING.
    V_PATH = P_FILE.
    **-- Function GUI_DOWNLOAD is used to save the data back in the
    **-- flat file from the internal table
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME                = V_PATH
          FILETYPE                = 'ASC'
          APPEND                  = ' '
          WRITE_FIELD_SEPARATOR   = 'X'
        TABLES
          DATA_TAB                = I_PIPE
        EXCEPTIONS
          FILE_WRITE_ERROR        = 1
          NO_BATCH                = 2
          GUI_REFUSE_FILETRANSFER = 3
          INVALID_TYPE            = 4
          NO_AUTHORITY            = 5
          UNKNOWN_ERROR           = 6
          HEADER_NOT_ALLOWED      = 7
          SEPARATOR_NOT_ALLOWED   = 8
          FILESIZE_NOT_ALLOWED    = 9
          HEADER_TOO_LONG         = 10
          DP_ERROR_CREATE         = 11
          DP_ERROR_SEND           = 12
          DP_ERROR_WRITE          = 13
          UNKNOWN_DP_ERROR        = 14
          ACCESS_DENIED           = 15
          DP_OUT_OF_MEMORY        = 16
          DISK_FULL               = 17
          DP_TIMEOUT              = 18
          FILE_NOT_FOUND          = 19
          DATAPROVIDER_EXCEPTION  = 20
          CONTROL_FLUSH_ERROR     = 21
          OTHERS                  = 22.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ****DO REWARD IF USEFULL
    VIJAY

  • Function Gui_Download - Error calling Data Provider

    Hello masters, i develop a program that catches a pdf file and then we can download. in windows everything is working but the client uses Linux and SAP Gui For Linux and when is making download of file, systems throws message FES011 - Error calling Data Provider.
    when i'm using windows the path is build correct way but i'm using Linux the path isn't build correct, for example like this,  /home/rui/desktop\dir_1000.pdf . in debug i changed \ to / but systems throws the same error message.
    Someone have some clue to solve this problem.
      CONCATENATE gv_dir '\DIR_' <fs_final_alv>-pernr
                      '.pdf' INTO lv_fich.
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              filename                = lv_fich
              filetype                = 'BIN'
            TABLES
              data_tab                = lt_pdf_output
            EXCEPTIONS
              file_write_error        = 1
              no_batch                = 2
              gui_refuse_filetransfer = 3
              invalid_type            = 4
              no_authority            = 5
              unknown_error           = 6
              header_not_allowed      = 7
              separator_not_allowed   = 8
              filesize_not_allowed    = 9
              header_too_long         = 10
              dp_error_create         = 11
              dp_error_send           = 12
              dp_error_write          = 13
              unknown_dp_error        = 14
              access_denied           = 15
              dp_out_of_memory        = 16
              disk_full               = 17
              dp_timeout              = 18
              file_not_found          = 19
              dataprovider_exception  = 20
              control_flush_error     = 21
              OTHERS                  = 22.
          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 and thanks in advance.
    Mario

    hello masters, thanks to all.
    Soumyaprakash was right... just because Linux is case-sensative, the system was putting all letters of path in upper case
    I just change in screen painter the field to accept upper/lower letters and now system mantain the letters has they come.
    regards and thanks one more time
    Mario

  • Error  FUNCTION ' GUI_DOWNLOAD' on OS win 7

    Hi experts 
    recently install  OS windows 7, and the applications that they use
    PARAMETERS P_FILE TYPE RLGRAP-FILENAME DEFAULT ' C :\ ' OBLIGATORY.
    compile but in time of execution not found as XP.    Now it doesn't show de dialog box explorer.
    Also gives me error when I execute applications with the function CALL FUNCTION ' GUI_DOWNLOAD' the error that recovers is UNKNOWN_DP_ERROR = 14
    Somebody knows if I have to install some SP for found on OS win 7?
    My Sap GUI  is 710
    GREETINGS

    Yes is ASC.
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
            FILENAME                        = 'c:\mg.xls'
            filetype = 'ASC'
           append = ' '
            TABLES
              DATA_TAB                        = FileOut
           EXCEPTIONS
             FILE_WRITE_ERROR                = 1
             NO_BATCH                        = 2
             GUI_REFUSE_FILETRANSFER         = 3
             INVALID_TYPE                    = 4
             NO_AUTHORITY                    = 5
             UNKNOWN_ERROR                   = 6
             HEADER_NOT_ALLOWED              = 7
             SEPARATOR_NOT_ALLOWED           = 8
             FILESIZE_NOT_ALLOWED            = 9
             HEADER_TOO_LONG                 = 10
             DP_ERROR_CREATE                 = 11
             DP_ERROR_SEND                   = 12
             DP_ERROR_WRITE                  = 13
             UNKNOWN_DP_ERROR                = 14
             ACCESS_DENIED                   = 15
             DP_OUT_OF_MEMORY                = 16
             DISK_FULL                       = 17
             DP_TIMEOUT                      = 18
             FILE_NOT_FOUND                  = 19
             DATAPROVIDER_EXCEPTION          = 20
             CONTROL_FLUSH_ERROR             = 21
             OTHERS                          = 22.

  • How to download ANSI coding text file using function GUI_DOWNLOAD?

    Hi All,
      Is the coding page of the file created by funtion GUI_DOWNLOAD or WS_DOWNLOAD is ANSI or UTF-8? How to download a text file which's coding page is ANSI please?
    Is this correct?
    CALL function 'GUI_DOWNLOAD'
      exporting
      codepage = '4110'
    importing

    This Function Lodule will give the CODE PAGE VALUE
    SCP_CODEPAGE_BY_EXTERNAL_NAME ... You have to give type of tht ENcoding like ANSI ..etc
        call function 'GUI_DOWNLOAD'
          exporting
           filename                        = 'd:\customer_details.txt'
           filetype                        = 'ASC'
       CODEPAGE                        = code
          tables
            data_tab                        = t_customer_details
      FIELDNAMES                      =
         exceptions
           file_write_error                = 1
           no_batch                        = 2
           gui_refuse_filetransfer         = 3
           invalid_type                    = 4
           no_authority                    = 5
           unknown_error                   = 6
           header_not_allowed              = 7
           separator_not_allowed           = 8
           filesize_not_allowed            = 9
           header_too_long                 = 10
           dp_error_create                 = 11
           dp_error_send                   = 12
           dp_error_write                  = 13
           unknown_dp_error                = 14
           access_denied                   = 15
           dp_out_of_memory                = 16
           disk_full                       = 17
           dp_timeout                      = 18
           file_not_found                  = 19
           dataprovider_exception          = 20
           control_flush_error             = 21
           others                          = 22
        if sy-subrc <> 0.
          write : / 'Upload Failed' , sy-subrc.
        else.
          write : / 'Upload Completed'.
        endif.
      endif.
    Reward if helpful...

  • Call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    With this function I have no problem sending the message but the attachment is not sent.
    The attachment is in the table mail_bin.  Is that correct?
    call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
         exporting
             document_data         = mail_title
         importing
             sent_to_all           = sent_to_all
         tables
             packing_list          = mail_pack
             object_header         = mail_head
             contents_bin          = mail_bin
             contents_txt          = mail_txt
             receivers             = mail_rec
         exceptions
             too_many_receivers         = 1
             document_not_sent          = 2
             operation_no_authorization = 4.
    I'd appreciate any help debugging this problem.  How do I know when to get basis involved?  This is the first time this company is sending messages to the inbox. Does basis have to set things up.
    Thanks.

    Hi Janet,
    That function is a little tricky.
    You could check this program that I use as template when i have to add email capability in my programs.
    Regards,
    Eric
    PD. You also must confirm that the SCOT transaction is working properly in order to ensure that the emails are delivered.
    *Declarations                       *
    REPORT  Z_ENVIO_EMAIL_TOP NO STANDARD PAGE HEADING LINE-SIZE 255.
    *&  Declaración de Tablas                                              *
    TABLES: pcfile.
    *&  Declaración de FIELD-SYMBOLS                                       *
    FIELD-SYMBOLS:  TYPE STANDARD TABLE.
    *&  Declaración de Tablas Internas                                     *
    DATA:
        Declaracion e-mail
          it_objhead        LIKE solisti1       OCCURS  1  WITH HEADER LINE,
          it_objbin         LIKE solisti1       OCCURS 10  WITH HEADER LINE,
          it_objpack        LIKE sopcklsti1     OCCURS  2  WITH HEADER LINE,
          it_objtxt         LIKE solisti1       OCCURS 10  WITH HEADER LINE,
          it_reclist        LIKE somlreci1      OCCURS  5  WITH HEADER LINE,
          it_doc_chng       LIKE sodocchgi1,
          BEGIN OF it_asc_file OCCURS 100,
            string TYPE string,
          END OF it_asc_file.
    *&  Declaración de Variables                                           *
    DATA:
          tab_lines            LIKE sy-tabix,
          w_drive              LIKE pcfile-drive,
          w_exte(6)            TYPE c,
          w_name               LIKE sopcklsti1-obj_name,
          w_nmex(15)           TYPE c,
          w_path               LIKE pcfile-path,
          w_fullpath           TYPE string,
          w_file               LIKE fc03tab-pl00_file,
          w_size               LIKE  scms_acinf-comp_size,
          w_rc                 TYPE i,
          w_e_user_stat_intern     LIKE jest-stat,
          w_e_user_stat_extern     LIKE tj02t-txt04,
          w_fecha              TYPE sy-datum.
    *Rutines                            *
    start-of-selection.
    Buscar Destinatarios
      PERFORM buscar_destinatarios.
      IF NOT it_reclist[] IS INITIAL.
      Llenar Correo
        PERFORM cuerpo_correo.
       Datos Adjuntos
        PERFORM datos_adjuntos.
      Enviar Correo
        PERFORM enviar_correo.
      ENDIF.
    end-of-selection.
    *&      Form  buscar_destinatarios
    FORM buscar_destinatarios .
    REALIZAR BUSQUEDA DE LOS DESTINATARIOS *
      IF sy-subrc EQ 0.
         Enviar los distientos email del proveedor
        'F' FAX, 'U' mail,'R' RML, 'B' correo SAP
    *          Nombre
    *     P     Lista de distribución personal
    *     C     Lista de distribución general
    *     O     Usuario SAPoffice
    *     B     Usuario SAP
    *     U     Direc.internet
    *     X     Direc.X.400
    *     R     Usuario SAP en otro sistema SAP
         A     Dirección externa
         F     Número de fax
         D     Dirección X.500
         L     Número de télex
         H     Unidad organizativa/Posición
         J     Objeto SAP
         G     Objeto de organización/ID
         1     9     Otros tipos de destinatario
        LOOP AT it_zqm_dest_qpr.
        Usuario Sap
          it_reclist-receiver =              "nombre del usuario SAP.
          it_reclist-rec_type = 'B'.
          it_reclist-express = 'X'.
          it_reclist-rec_date = sy-datum.
          it_reclist-notif_del = ''.         " Se espera acuse de recibo
          it_reclist-notif_ndel = ''.        " Se espera acuse de recibo
          APPEND it_reclist.
          CLEAR: it_reclist.
        Correo Externo
          it_reclist-receiver =              "Direccion de Email.
          it_reclist-rec_type = 'U'.
          it_reclist-express = 'X'.
          it_reclist-com_type = 'INT'.
          APPEND it_reclist.
          CLEAR: it_reclist.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " buscar_destinatarios
    *&      Form  cuerpo_correo
    FORM cuerpo_correo .
    Título del E-Mail
      it_doc_chng-obj_name   = 'EMAIL'.
        it_doc_chng-obj_descr = 'TITULO EMAIL'.
      it_doc_chng-obj_langu  = 'S'.
      it_doc_chng-sensitivty = 'P'.
      it_doc_chng-obj_prio   = '1'.
      it_doc_chng-no_change  = 'X'.
      it_doc_chng-priority   = '1'.
      it_doc_chng-obj_expdat = sy-datum + 7. "Expiracion del correo
    Contenido del E-Mail
      REFRESH: it_objtxt.
      CLEAR    it_objtxt.
        CONCATENATE 'Contenido' 'del correo'
                    'electronico'
               INTO it_objtxt SEPARATED BY space.
        APPEND it_objtxt. CLEAR it_objtxt.
        APPEND it_objtxt. CLEAR it_objtxt.
      DESCRIBE TABLE it_objtxt LINES tab_lines.
      READ TABLE it_objtxt INDEX tab_lines.
      it_doc_chng-doc_size  = ( tab_lines - 1 ) * 255 + STRLEN( it_objtxt ).
      it_objpack-transf_bin = space.
      it_objpack-head_start = 1.
      it_objpack-head_num   = 0.
      it_objpack-body_start = 1.
      it_objpack-body_num   = tab_lines.
      it_objpack-doc_type   = 'RAW'.
      APPEND it_objpack.
    Se llena la tabla que contendra el archivo adjunto
      MOVE it_doc_chng-obj_descr TO it_asc_file-string.
      APPEND it_asc_file. CLEAR it_asc_file.
      APPEND it_asc_file. CLEAR it_asc_file.
      LOOP AT it_objtxt.
        MOVE it_objtxt TO it_asc_file-string.
        APPEND it_asc_file. CLEAR it_asc_file.
      ENDLOOP.
    ENDFORM.                    " cuerpo_correo
    *&      Form  datos_adjuntos
    FORM datos_adjuntos .
    Se debe generar el archivo a adjuntar
      PERFORM generar_archivo.
    *ALI   Doc.ABAPList
    *ARC   Objeto de archivo (Image)
    *BCS   Archivo documento externo
    *BIN   Documento binario
    *DLI   Lista de distribución
    *EXT   Doc.PC
    *FAX   Telefax
    *FOL   Carpeta
    *GRA   Gráfico SAP
    *OBJ   Business object
    *OFO   Carpeta de objeto
    *OTF   Documento OTF
    *R3I   IDOC
    *RAW   Doc.editor SAP
    *SCR   Doc.SAPscript
    *URL   Link a Inter/Intranet
    *WIM   Work item
    *XXL   Doc.para Listviewer
      DESCRIBE TABLE it_objbin LINES tab_lines.
      it_objhead = w_name. APPEND it_objhead.
    Creation of the entry for the compressed attachment
      it_objpack-transf_bin  =  'X'.
      it_objpack-head_start  =  1.
      it_objpack-head_num    =  1.
      it_objpack-body_start  =  1.
      it_objpack-body_num    =  tab_lines.
      it_objpack-doc_type    =  w_exte.
      it_objpack-obj_name    =  w_name.
      it_objpack-obj_descr   =  w_nmex.
      it_objpack-doc_size    =  tab_lines * 255.
      APPEND it_objpack.
    ENDFORM.                    " datos_adjuntos
    *&      Form  generar_archivo
    FORM generar_archivo .
    Generar el archivo que se va a adjuntar
      CLEAR: it_asc_file.
      w_fullpath = 'C:Status QPR.xls'.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename              = w_fullpath
          filetype              = 'ASC'
          write_field_separator = space
        TABLES
          data_tab              = it_asc_file
        EXCEPTIONS
          file_write_error      = 01
          no_batch              = 04
          unknown_error         = 05
          OTHERS                = 99.
      CASE sy-subrc.
        WHEN 0.
        WHEN OTHERS.
        MESSAGE i050 RAISING some_error.
      ENDCASE.
      REFRESH it_asc_file.
    Subir el archivo que se va a adjuntar
      MOVE w_fullpath TO w_file.
      ASSIGN it_objbin[] TO .
      CALL FUNCTION 'SCMS_UPLOAD'
        EXPORTING
         filename       = w_file
         binary         = 'X'
         frontend       = 'X'
       MIMETYPE       =
       IMPORTING
         filesize       = w_size
       TABLES
         data           =  0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      pcfile-path = w_file.
      CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
        EXPORTING
          complete_filename = pcfile-path
        IMPORTING
          drive             = w_drive
          extension         = w_exte
          name              = w_name
          name_with_ext     = w_nmex
          path              = w_path
        EXCEPTIONS
          invalid_drive     = 1
          invalid_extension = 2
          invalid_name      = 3
          invalid_path      = 4
          OTHERS            = 5.
      IF sy-subrc NE 0.
        EXIT.
      ENDIF.
      TRANSLATE w_exte TO UPPER CASE.
      TRANSLATE w_name TO UPPER CASE.
    Borrar el archivo del disco duro
      CALL METHOD cl_gui_frontend_services=>file_delete
        EXPORTING
          filename             = w_fullpath
        CHANGING
          rc                   = w_rc
        EXCEPTIONS
          file_delete_failed   = 1
          cntl_error           = 2
          error_no_gui         = 3
          file_not_found       = 4
          access_denied        = 5
          unknown_error        = 6
          not_supported_by_gui = 7
          wrong_parameter      = 8
          OTHERS               = 9.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " generar_archivo
    *&      Form  enviar_correo
    FORM enviar_correo .
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data                    = it_doc_chng
          put_in_outbox                    = 'X'
          commit_work                      = 'X'
            IMPORTING
              SENT_TO_ALL                      =
              NEW_OBJECT_ID                    =
        TABLES
          packing_list                     = it_objpack
          object_header                    = it_objhead
          contents_bin                     = it_objbin
          contents_txt                     = it_objtxt
              CONTENTS_HEX                     =
              OBJECT_PARA                      =
              OBJECT_PARB                      =
          receivers                        = it_reclist
         EXCEPTIONS
           too_many_receivers               = 1
           document_not_sent                = 2
           document_type_not_exist          = 3
           operation_no_authorization       = 4
           parameter_error                  = 5
           x_error                          = 6
           enqueue_error                    = 7
           OTHERS                           = 8.
      IF sy-subrc EQ 0.
        WAIT UP TO 2 SECONDS.
      Le indicamos al programa de envío de correo de SAPCONNECT
      que envíe los correos
        SUBMIT rsconn01 WITH mode = 'INT'
                        WITH output = ''
                         AND RETURN.
      ENDIF.
    ENDFORM.                    " enviar_correo

  • Urgent: Function GUI_DOWNLOAD can't create any data file!

    We are using this function GUI_DOWNLOAD to download internal table data to a flat file.  But after running the program, we got no any data file created!  The code is in the following:
    data : v_file type string.
    PARAMETERS: p_file(128) TYPE c OBLIGATORY LOWER CASE.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      PERFORM get_local_file_name USING p_file.
      v_file = p_file.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename = v_file
        write_field_separator = '|'
      TABLES
        data_tab = itab.  "Our internal talbe filled with data
    FORM get_local_file_name USING p_p_file.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        CHANGING
          file_name     = p_p_file
        EXCEPTIONS
          mask_too_long = 1
          OTHERS        = 2.
    ENDFORM. " get_local_file_name
    Please help and we will give you reward points!

    Hi Buddy,
    KD_GET_FILENAME_ON_F4 is used to locate file in a directory (on value request). It should be at the time of uploading data from local PC to internal table.
    Insted u can use a simple file locator F4_FILENAME.
    Even the i mentioned also a file locater.
    I think u don't need to locate a file, u need to save the file with new file.
    so u can use the standard function as follows:
    Class - CL_GUI_FRONTENDSERVICES
    Method - FILE_SAVE_DIALOG
    I think ur problem will be resolved.
    If ur problem is not solved go through following code:
    PARAMETERS : pa_fname LIKE rlgrap-filename.
    data : lf_fname TYPE string.
    INITIALIZATION.
    Initializing the File Name
      pa_fname = 'C:\temp\'.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_fname.
    F4 functionality for File Name
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = ' '
        IMPORTING
          file_name     = pa_fname.
      lf_fname = pa_fname.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename              = lf_fname
          filetype              = 'ASC'
          append                = ' '
          write_field_separator = 'X'
        TABLES
          data_tab              = ltab.

  • Problem with function 'GUI_DOWNLOAD'

    Hi to everybody!!
    I've a problem with the function GUI_DOWNLOAD, when I execute the program this make a dump and the problem is in this function.
    I've read the log and this said that :
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_SY_DYN_CALL_PARAM_NOT_FOUND', was
      not caught in
    procedure "CREAR_FICHERO" "(FORM)", nor was it propagated by a RAISING clause.
    Since the caller of the procedure could not have anticipated that the
    exception would occur, the current program is terminated.
    The reason for the exception is:
    Function module "GUI_DOWNLOAD" was called
    with the parameter "ACCESS_DENIED".
    This parameter is not defined.
    Can anybody tell me what's the meaning of this?
    Thanks very much,
    Regards,
    Rebeca

    Hi,
    You must have the write access to the file in OS level to which you are trying to download the table content using the function module 'GUI_DOWNLOAD'.The error occurs because the system is trying to write in a file to which, the write permission is not permitted for the user.If you are catching the exceptions properly.It will give the proper message instead of dump.
    Regards,
    Ajith

  • Call function POPUP_TO_CONFIRM after Excel close

    Good morning
    I have written code like this
    DATA: EXCEL TYPE OLE2_OBJECT.
      DATA: BOOKS TYPE OLE2_OBJECT.
      DATA: BOOK  TYPE OLE2_OBJECT.
      DATA: CELL  TYPE OLE2_OBJECT.
      DATA: FONT  TYPE OLE2_OBJECT.
      DATA: FILE  TYPE OLE2_OBJECT.
      CREATE OBJECT EXCEL 'EXCEL.APPLICATION'.
      CALL METHOD OF EXCEL 'WORKBOOKS' = FILE.
      CALL METHOD OF FILE 'OPEN'
        EXPORTING
          #1 = 'C:temp8D.xls'
          #2 = 1.
    CALL METHOD OF EXCEL 'CELLS' = CELL
        EXPORTING
          #1 = 6
          #2 = 'C'.
      SET PROPERTY OF CELL 'VALUE' = zak_pomoc.
    CALL METHOD OF EXCEL 'QUIT'.
      FREE OBJECT EXCEL.
    If user has modified the 8D file I want display this file on the screen, but first function POPUP_TO_CONFIRM  should ask him if he really wants to show file.
    I make it like this.
      call function 'POPUP_TO_CONFIRM'
        EXPORTING
          TITLEBAR              = 'Display report'
          TEXT_QUESTION         = 'Display report 8D?'
          DEFAULT_BUTTON        = '1'
          DISPLAY_CANCEL_BUTTON = 'X'
          START_COLUMN          = 25
          START_ROW             = 6
        IMPORTING
          answer                = ans.
             if ans eq '1'.
    DATA gs_excel TYPE ole2_object .
      DATA gs_wbooks TYPE ole2_object .
      DATA gs_wbook TYPE ole2_object .
      DATA gs_application TYPE ole2_object .
      CREATE OBJECT gs_excel 'EXCEL.APPLICATION' .
      SET PROPERTY OF gs_excel 'Visible' = 1 .
      GET PROPERTY OF gs_excel 'Workbooks' = gs_wbooks .
      GET PROPERTY OF gs_wbooks 'Application' = gs_application .
    *--Opening the existing document
      CALL METHOD OF gs_wbooks 'Open' = gs_wbook
        EXPORTING
          #1 = 'c:temp8D.xls'.
    endif.
    But there is my problem because two windows: first- asking about saving the file and the second- asking about showing the file, pop up in this same time.
    What condition should I write to call second window after this first one?
    Please, any suggestions?
    Thank you.

    Hello
    I'm just beginner and there is one thing I don't understand. Between lines
    CALL METHOD OF EXCEL 'QUIT'
    and
    FREE OBJECT EXCEL
    the window 'Do you want save changes' appears. And in that moment what is the value that says if the user chooses OK or QUIT?
    If I would know that value, I could call function POPUP_TO_CONFIRM in the right moment.

  • Call Function Destination in a background job

    I am having a problem using:
      CALL FUNCTION 'TABLE_ENTRIES_GET_VIA_RFC'
             DESTINATION p_dest
    in a background job.
    I am working on a program that would compare the same table in 2 different systems and write the differences.  It works when I run it in the foreground.  However, I want to run this in a nightly background job.  However, it is failing and I beleive that it is the result of the program needing a user to interactively logon to the remote system.
    How can I bypass the logon screen or enter information into the logon screen using a background job?
    Thanks.
    Jon

    Hi Jonathan,
    Would you like to reward some points to the poster to thank them as a part of SDN Contributor Recognition Program?
    You can click on the yellow star on the right of each post header to reward points.
    For more information:
    https://www.sdn.sap.com/sdn/index.sdn?page=crp_help.htm
    John.

  • Uncatchable exception: BSP calling Function Module

    Hi all,
    currently i'm facing a very weird problem. My application class calls function module
    HR_INFOTYPE_OPERATION. Normally, in case of an error, the function module gives you back a return parameter. But if i call it from my BSP, the processing doesn't leave the function module. It directly throws an exception ERROR_MESSAGE_STATE instead of writing the message into parameter return.
    If i call the function module with the same parameters from a report, it works fine and the error message is written to return parameter without throwing an exception.
    What am i doing wrong? I don't want that exception and need to go on with filled parameter result.
    Regards
    Mark-André

    Hi MA,
    try using ERROR_MESSAGE in the exceptions list, like this.
    CALL FUNCTION 'func_name'
         EXPORTING
              string            = text
              pos               = position
         IMPORTING
              string1           = text1
              string2           = text2
         EXCEPTIONS
              string1_too_small = 1
              string2_too_small = 2
              ERROR_MESSAGE     = 3
              OTHERS            = 4.
    Cheers
    Graham Robbo

  • What is the use of CALL FUNCTION MODULE - AT BACKGROUND TASK?

    Hi experts,
    I found Call functional module in background task will make the FM run at the next commit work as some people said. So I have some questions:
    1 if we use COMMIT WORK commend, the pending FM will be called? If there are several FMs called at background task, what is the sequence of them? How many conditions will trigger the running of these FMs?
    2 Where can I find the log of this pending FMs? In SAP library, it says there are 2 tables. But I checked these tables and can only find the FM name and user of it. And I can not understand content of these tables. It seems one is for the main information of FM, and the other is for the data of the FM, maybe the parameters.
    3 If I call a FM in this way, Can I canncel it before the next commit work in some way?
    Finally, thanks for reading and help.

    HI,
    When the COMMIT WORK statement is executed, the function modules registered for the current SAP-LUW are started in the order in which they were registered. ROLLBACK WORK deletes all previous registrations for the current SAP-LUW.
    If the specified destination is not available when COMMIT WORK is executed, an executable program called RSARFCSE is started in background processing. By default, this tries to start the function modules registered for a SAP-LUW in their destination every 15 minutes and up to 30 times. These parameters can be changed in the transaction SM59. If the destination does not become available within the defined time, it is recorded in the database table ARFCSDATA as the entry "CPICERR". The entry in the database table ARFCSSTATE is deleted after a standard period of eight days

  • How to fill data when call function of sap standard script form?

    Hi every experts,
    <Priority Normalized>
    In our system, when we log in 'FR', we can print purchase order in language Franch,in t_code:ME22N.  And when logging in 'EN', we can print it in language English, in ME22N. The English form is just only translated from Franch, with all same structure and frame.  The form is done by script form.
    And when logging in 'ZH', we create a new program, calling function smartform, instead of translating from EN language. Because of different structure and frame, I don't know the way to write script, so  I print puchase order by smartform, when logging in 'ZH'.
    But I have a new issue. Our MM module consultant needs me to print Chinese form if one condition, print English form in other condition.
    So I have no idea to solve it. Because in my program, I get data to fill smartform and call function of smartform. And I don't know how to get data to fill script form. I only know the function name, 'OPEN_FORM' 'WRITE_FORM' 'CLOSE_FORM'.....
    If I only call the several functions, I will get only frame without no data. So who can tell me how to do????
    <Urgency downgraded>
    Edited by: Suhas Saha on Jul 26, 2011 3:34 PM
    Edited by: Vinod Kumar on Jul 26, 2011 4:09 PM

    Hi,
    Normally if we look in NACE transaction, you can see that upto five different FORMS can be assigned to a single output type . i.e. for each form there will be a seperate routine through which it gets called. But it all start from the first form only.
    so you need to write your code in the ENTRY of the first form and if it does not satisfy do not go for processing of it but just exit of that form ENTRY. so that it will take you to next form.
    hope this helps.
    Thanks,
    Venkatesh

  • Function Module CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'

    Hello All,
    While using CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH' to download to Unix file in GLD (Version 4.5b) the F.M is working fine, but in KLD(Version ECC 6.0)  CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH' is not working & the error message is displayed saying incomplete filename.
    Could you let me know any alternate Function Module/ Method in this regard.
    Thanks

    Hi,
    In ECC6 also Its Working fine only.
    1. Go to SE37 -> Enter FM Name  -> Test(F8).
    2.  Give any file path and test it.
    Thanks,
    Reward If Helpful.

  • FUNCTION 'GUI_DOWNLOAD'

    Hi !
    When i execute an Online  program that use  the function 'GUI_DOWNLOAD', then the program is running OK.
    However  When i execute  the same program in background i get an unknown
    error from the function 'GUI_DOWNLOAD' (return code 6 ) !
    I wanted to know the reason for the error, and how to correct it ?
    Thanks
    Moshe

    Hi Solman,
       Any sort of communicatipn with the presentation server in background is not supported. GUI_DOWNLOAD is one such Function module which tries to communicate with the presentation server.
    YOu can perhaps only download it to an application server and later move it to presentation server.
    There is one work around for this, but its too tedious a solution, which works only on the system on which it is configured.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2
    Regards,
    ravi

Maybe you are looking for

  • [HUM] Handling unit managment: how can i delelte all batch of a HU?

    Hi experts,      I have a HU which contains some Batchs. I would like to delete all Batchs of this HU in order to save this HU empty (HU don't contain any Batch).      Could you please tell me which transaction or which Function Module is used to del

  • Stuttering Audio from 10.6.8 Update all Outputs

    Hi, I updated to 10.6.8 and now have stuttering audio using either digital output, headphone output and from the internal speakers so I think something there is a bug. I tried rolling back 'AppleHDA.kext' using the 'MacOSXUpdCombo10.6.7.dmg' and Paci

  • My Iphone charges super slowly after upgrading to IOS 7

    My phone charges super slowly after upgrading . Usually it's take about 2hours for a full charge now it's not even 60%

  • Duplicate tab appearing in MIGO

    Hi ,      I am implementing BAdi for the first time. In T code MIGO i want to add a tab in item details. I have used the BAdi MB_MIGO_BADI. I have followed some thread. In SE 19  edit implementation field i have selected classic BAdi field ( give nam

  • InDesign CS3 will not open double-clicked files on server (10.5)

    I've got an odd one here. I have two new 10.6 machines running InDesign CS3, and a simple file server running 10.5.6. When we open an InDesign file on the server using the "File Open" dialog box, the files open fine. If we navigate to a folder on ser