Adding header to download local file

Hi All!
I am downloading .xls file onto the presentation server with column headings and the values following.Now I want to add a header to the downloaded file above the column headings in BOLD.Is it possible to append header/Title to the downloaded file.Please advise me with example code..
Regards
Praneeth

Hi,
Try using FM CREATE_XLS_HEADER_FROM_DDIC.
or try using FM : 'EXCEL_OLE_STANDARD_DAT'
ex code :
DATA: BEGIN OF i_tab OCCURS 0,
      anlage(20) TYPE c,
      num(2) TYPE c,
      END OF i_tab.
DATA: BEGIN OF i_head OCCURS 0,
      field(30) TYPE c,
      END OF i_head.
i_tab-anlage = '0070002545'.
i_tab-num   = '1'.
APPEND i_tab.
CLEAR i_tab.
i_tab-anlage = '0070002546'.
i_tab-num   = '2'.
APPEND i_tab.
CLEAR i_tab.
i_tab-anlage = '0070002547'.
i_tab-num   = '3'.
APPEND i_tab.
CLEAR i_tab.
i_tab-anlage = '0070002548'.
i_tab-num   = '4'.
APPEND i_tab.
CLEAR i_tab.
i_head-field = 'Installation'.
APPEND i_head.
i_head-field =  'NO'.
APPEND i_head.
CLEAR i_head.
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
  EXPORTING
  file_name  = 'C:\Documents and Settings\vepakom\Desktop\test1.xls'
   create_pivot                    = 0
   data_sheet_name                 = 'MY DATA'
  PIVOT_SHEET_NAME                = ' '
  PASSWORD                        = ' '
  PASSWORD_OPTION                 = 0
TABLES
   pivot_field_tab                  = dlpivot
   data_tab                         = i_tab
   fieldnames                       = i_head
EXCEPTIONS
   file_not_exist                  = 1
   filename_expected               = 2
   communication_error             = 3
   ole_object_method_error         = 4
   ole_object_property_error       = 5
   invalid_pivot_fields            = 6
   download_problem                = 7
   OTHERS                          = 8
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Sharat
ps : pls reward if helpful

Similar Messages

  • How to get Header in Downloaded .xls file using  GUI_Download function

    How to get Header in Downloaded .xls file using  GUI_Download function ???
    How to use the the Header parameter available in GUI_Download function .

    HI,
    see this sample code..
    data : Begin of t_header occurs 0,
           name(30) type c,
           end of t_header.
    data : Begin of itab occurs 0,
           fld1 type char10,
           fld2 type char10,
           fld3 type char10,
           end   of itab.
    DATA: v_pass_path TYPE string.
    append itab.
    itab-fld1 = 'Hi'.
    itab-fld2 = 'hello'.
    itab-fld3 = 'welcome'.
    append itab.
    append itab.
    append itab.
    append itab.
    append itab.
    t_header-name = 'Field1'.
    append t_header.
    t_header-name = 'Field2'.
    append t_header.
    t_header-name = 'Field3'.
    append t_header.
      CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
        EXPORTING
          default_extension     = 'XLS'
        IMPORTING
          fullpath              = v_pass_path.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                        = v_pass_path
          filetype                        = 'DBF'
        TABLES
          data_tab                        = itab
          FIELDNAMES                      = t_header
    Cheers,
    jose.

  • Help for download local file

    Hi!!!
    This is my first post. Thanks to all the people here before all.
    I have a big problem trying to download a local file to an internal table. I have lines with more than 8000 positions, and i've tried to use WS_UPLOAD, GUI_UPLOAD and SO_OBJECT_UPLOAD, but all of them show me this messages:
       - Unable to satisfy send request: 8001 bytes.
    ¿Do you know any function module (i think it could be OO) that allows me to load this file?
    Thanks for all. Bye!

    Hi
    REPORT ZDOWN_UP_LOAD
            NO STANDARD PAGE HEADING
            LINE-SIZE  255.
    Declare Database Objects
    tables:
       DOKIL,
       TRDIR.
    Constants
    CONSTANTS:
       MC_TRDIR_IDENTIFIER(72)  TYPE C VALUE '%&%& RDIR',
       MC_REPORT_IDENTIFIER(72) TYPE C VALUE '%&%& REPO',
       MC_TEXT_IDENTIFIER(72)   TYPE C VALUE '%&%& TEXP',
       MC_THEAD_IDENTIFIER(72)  TYPE C VALUE '%&%& HEAD',
       MC_DOC_IDENTIFIER(72)    TYPE C VALUE '%&%& DOKL',
       MC_TRDIR_SHORT(4)        TYPE C VALUE 'RDIR',
       MC_REPORT_SHORT(4)       TYPE C VALUE 'REPO',
       MC_TEXT_SHORT(4)         TYPE C VALUE 'TEXP',
       MC_THEAD_SHORT(4)        TYPE C VALUE 'HEAD',
       MC_DOC_SHORT(4)          TYPE C VALUE 'DOKP'.
    Declare Module level data structures
    DATA: BEGIN OF MTAB_PROGRAM_SOURCE OCCURS 0,
             LINE(72) TYPE C,
           END OF MTAB_PROGRAM_SOURCE.
    DATA: MTAB_PROGRAM_TRDIR LIKE TRDIR OCCURS 0 WITH HEADER LINE.
    DATA: MTAB_PROGRAM_TEXTS LIKE TEXTPOOL OCCURS 0 WITH HEADER LINE.
    DATA: MSTR_THEAD LIKE THEAD.
    DATA: BEGIN OF MTAB_PROGRAM_FILE OCCURS 0,
             LINE(275) TYPE C,
           END OF MTAB_PROGRAM_FILE.
    DATA: BEGIN OF MTAB_DIRECTORY OCCURS 0,
             NAME LIKE TRDIR-NAME,
             DESC(72) TYPE C,
             SAVENAME LIKE RLGRAP-FILENAME,
           END OF MTAB_DIRECTORY.
    DATA: BEGIN OF MTAB_PROGRAM_DOCUMENTATION OCCURS 0,
             LINE(255) TYPE C,
           END OF MTAB_PROGRAM_DOCUMENTATION.
    Selection Screen
    *-- Options for upload/download of programs
    SELECTION-SCREEN BEGIN OF BLOCK FRM_OPTIONS WITH FRAME TITLE TEXT-UDL.
    PARAMETERS:
       RB_DOWN RADIOBUTTON GROUP UDL DEFAULT 'X'.       " Download reports
    SELECTION-SCREEN BEGIN OF BLOCK FRM_TRDIR WITH FRAME TITLE TEXT-DIR.
    SELECT-OPTIONS:
       S_NAME  FOR TRDIR-NAME,              " Program Name
       S_SUBC  FOR TRDIR-SUBC               " Program Type
               DEFAULT 'F' OPTION EQ SIGN E," Exclude Functions by default
       S_CNAM  FOR TRDIR-CNAM               " Created by
               DEFAULT SY-UNAME,
       S_UNAM  FOR TRDIR-UNAM,              " Last Changed by
       S_CDAT  FOR TRDIR-CDAT,              " Creation date
       S_UDAT  FOR TRDIR-UDAT.              " Last update date
    SELECTION-SCREEN END OF BLOCK FRM_TRDIR.
    *-- Options for uploading programs
    PARAMETERS:
       RB_UP   RADIOBUTTON GROUP UDL.       " Upload reports
    SELECTION-SCREEN BEGIN OF BLOCK FRM_UPLOAD WITH FRAME TITLE TEXT-UPL.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(29) TEXT-SNG.
    PARAMETERS:
       RB_FILE RADIOBUTTON GROUP HOW DEFAULT 'X'.
    SELECTION-SCREEN COMMENT 33(42) TEXT-FNA.
    SELECTION-SCREEN END OF LINE.
    PARAMETERS:
       RB_LIST RADIOBUTTON GROUP HOW.
    SELECTION-SCREEN END OF BLOCK FRM_UPLOAD.
    SELECTION-SCREEN END OF BLOCK FRM_OPTIONS.
    *-- Options for up/downloading programs
    SELECTION-SCREEN BEGIN OF BLOCK FRM_FILEN WITH FRAME TITLE TEXT-FIL.
    PARAMETERS:
       RB_DOS  RADIOBUTTON GROUP FIL DEFAULT 'X', " Save to local
       RB_UNIX RADIOBUTTON GROUP FIL,       " Save to UNIX
       P_PATH  LIKE RLGRAP-FILENAME         " Path to save files to
             DEFAULT 'c:\abap\'.
    SELECTION-SCREEN END OF BLOCK FRM_FILEN.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_NAME-LOW.
       CALL FUNCTION 'F4_PROGRAM'
            EXPORTING
                 OBJECT             = S_NAME-LOW
                 SUPPRESS_SELECTION = 'X'
            IMPORTING
                 RESULT             = S_NAME-LOW
            EXCEPTIONS
                 OTHERS             = 1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_NAME-HIGH.
       CALL FUNCTION 'F4_PROGRAM'
            EXPORTING
                 OBJECT             = S_NAME-HIGH
                 SUPPRESS_SELECTION = 'X'
            IMPORTING
                 RESULT             = S_NAME-HIGH
            EXCEPTIONS
                 OTHERS             = 1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_UNAM-LOW.
       PERFORM GET_NAME USING 'S_UNAM-LOW'
                     CHANGING S_UNAM-LOW.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_UNAM-HIGH.
       PERFORM GET_NAME USING 'S_UNAM-HIGH'
                     CHANGING S_UNAM-HIGH.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CNAM-LOW.
       PERFORM GET_NAME USING 'S_CNAM-LOW'
                     CHANGING S_CNAM-LOW.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CNAM-HIGH.
       PERFORM GET_NAME USING 'S_CNAM-HIGH'
                     CHANGING S_CNAM-HIGH.
    TOP-OF-PAGE.
       IF RB_LIST = 'X'.
         FORMAT COLOR COL_HEADING.
         NEW-LINE.
         WRITE: AT 3 TEXT-H01,
                AT 15 TEXT-H03.
         FORMAT COLOR OFF.
       ENDIF.
    AT LINE-SELECTION.
       CHECK RB_LIST = 'X'.                 " only do in list mode
       READ LINE SY-CUROW FIELD VALUE MTAB_DIRECTORY-SAVENAME.
    *-- Read file into an internal table
       PERFORM READ_REPORT_FROM_DISK TABLES MTAB_PROGRAM_FILE
                                     USING  MTAB_DIRECTORY-SAVENAME.
    *-- Split table into TADIR entry, report lines, and report text
       PERFORM SPLIT_INCOMING_FILE TABLES MTAB_PROGRAM_FILE
                                          MTAB_PROGRAM_SOURCE
                                          MTAB_PROGRAM_TEXTS
                                          MTAB_PROGRAM_DOCUMENTATION
                                 CHANGING TRDIR
                                          MSTR_THEAD.
    *-- Save all of the data
       PERFORM INSERT_NEW_REPORT TABLES MTAB_PROGRAM_SOURCE
                                        MTAB_PROGRAM_TEXTS
                                        MTAB_PROGRAM_DOCUMENTATION
                                 USING  TRDIR
                                        MSTR_THEAD.
    Start of processing
    START-OF-SELECTION.
       FORMAT COLOR COL_NORMAL.
       IF RB_DOWN = 'X'.
         PERFORM DOWNLOAD_REPORTS.
       ELSEIF RB_UP = 'X'.
         PERFORM UPLOAD_REPORTS.
       ENDIF.
    END-OF-SELECTION.
       IF RB_DOWN = 'X'.
         CONCATENATE P_PATH
                     'directory.txt'
           INTO P_PATH.
         PERFORM SAVE_TABLE_TO_FILE TABLES MTAB_DIRECTORY
                                    USING  P_PATH.
       ENDIF.
          FORM UPLOAD_REPORTS                                           *
    FORM UPLOAD_REPORTS.
    *-- Can upload a reports entered in selection criteria or
    *-- select from a list.  List can be from index.txt in same directory
    *-- (created by the download) or by reading the first line of each file
    *-- in the directory.
       IF RB_FILE = 'X'. " Upload single program from a file
    *-- Read file into an internal table
         PERFORM READ_REPORT_FROM_DISK TABLES MTAB_PROGRAM_FILE
                                       USING  P_PATH.
    *-- Split table into TADIR entry, report lines, and report text
         PERFORM SPLIT_INCOMING_FILE TABLES MTAB_PROGRAM_FILE
                                            MTAB_PROGRAM_SOURCE
                                            MTAB_PROGRAM_TEXTS
                                            MTAB_PROGRAM_DOCUMENTATION
                                   CHANGING TRDIR
                                            MSTR_THEAD.
    *-- Save all of the data
         PERFORM INSERT_NEW_REPORT TABLES MTAB_PROGRAM_SOURCE
                                          MTAB_PROGRAM_TEXTS
                                          MTAB_PROGRAM_DOCUMENTATION
                                   USING  TRDIR
                                          MSTR_THEAD.
       ELSEIF RB_LIST = 'X'. " Show list for user to choose from
    *-- get list of report names/descriptions from directory text
         CONCATENATE P_PATH
                     'directory.txt'
         INTO P_PATH.
         PERFORM READ_REPORT_FROM_DISK TABLES MTAB_DIRECTORY
                                       USING  P_PATH.
         SORT MTAB_DIRECTORY.
    *-- Write out list of report names/descriptions
         LOOP AT MTAB_DIRECTORY.
           WRITE:
             / MTAB_DIRECTORY-NAME UNDER TEXT-H01,
               MTAB_DIRECTORY-DESC UNDER TEXT-H03,
               MTAB_DIRECTORY-SAVENAME.
         ENDLOOP.
    *-- Process user selections for reports to upload.
       ENDIF.
    ENDFORM.                               " upload_reports
          FORM DOWNLOAD_REPORTS                                         *
          From the user selections, get all programs that meet the      *
          criteria, and save them in ftab_program_directory.            *
          Also save the report to disk.                                 *
    FORM DOWNLOAD_REPORTS.
       DATA:
         LC_FULL_FILENAME LIKE RLGRAP-FILENAME.
    *-- The table is put into an internal table because the program will
    *-- abend if multiple transfers to a dataset occur within a SELECT/
    *-- ENDSELCT (tested on 3.1H)
       SELECT * FROM  TRDIR
              INTO TABLE MTAB_PROGRAM_TRDIR
              WHERE  NAME  IN S_NAME
              AND    SUBC  IN S_SUBC
              AND    CNAM  IN S_CNAM
              AND    UNAM  IN S_UNAM
              AND    CDAT  IN S_CDAT
              AND    UDAT  IN S_UDAT.
       LOOP AT MTAB_PROGRAM_TRDIR.
    *-- Clear out text and source code tables
         CLEAR:
           MTAB_PROGRAM_FILE,
           MTAB_PROGRAM_SOURCE,
           MTAB_PROGRAM_TEXTS,
           MTAB_PROGRAM_DOCUMENTATION.
         REFRESH:
           MTAB_PROGRAM_FILE,
           MTAB_PROGRAM_SOURCE,
           MTAB_PROGRAM_TEXTS,
           MTAB_PROGRAM_DOCUMENTATION.
    *-- Get the report
         READ REPORT MTAB_PROGRAM_TRDIR-NAME INTO MTAB_PROGRAM_SOURCE.
    *-- Get the text for the report
         READ TEXTPOOL MTAB_PROGRAM_TRDIR-NAME INTO MTAB_PROGRAM_TEXTS.
    *-- Get the documentation for the report
         CLEAR DOKIL.
         SELECT * UP TO 1 ROWS FROM DOKIL
                WHERE  ID          = 'RE'
                AND    OBJECT      = MTAB_PROGRAM_TRDIR-NAME
                AND    LANGU       = SY-LANGU
                AND    TYP         = 'E'
                ORDER BY VERSION DESCENDING.
         ENDSELECT.
    *-- Documentation exists for this object
         IF SY-SUBRC = 0.
           CALL FUNCTION 'DOCU_READ'
                EXPORTING
                     ID      = DOKIL-ID
                     LANGU   = DOKIL-LANGU
                     OBJECT  = DOKIL-OBJECT
                     TYP     = DOKIL-TYP
                     VERSION = DOKIL-VERSION
                IMPORTING
                     HEAD    = MSTR_THEAD
                TABLES
                     LINE    = MTAB_PROGRAM_DOCUMENTATION
                EXCEPTIONS
                     OTHERS  = 1.
         ENDIF.
    *-- Put the report code and texts into a single file
    *-- Put the identifier line in so that the start of the TRDIR line
    *-- is marked
         CONCATENATE MC_TRDIR_IDENTIFIER
         MTAB_PROGRAM_TRDIR-NAME
         INTO MTAB_PROGRAM_FILE-LINE.
         APPEND MTAB_PROGRAM_FILE.
    *-- Add the TRDIR line
         MTAB_PROGRAM_FILE-LINE = MTAB_PROGRAM_TRDIR.
         APPEND MTAB_PROGRAM_FILE.
    *-- Put the identifier line in so that the start of the report code
    *-- is marked
         CONCATENATE MC_REPORT_IDENTIFIER
                     MTAB_PROGRAM_TRDIR-NAME
           INTO MTAB_PROGRAM_FILE-LINE.
         APPEND MTAB_PROGRAM_FILE.
    *-- Add the report code
         LOOP AT MTAB_PROGRAM_SOURCE.
           MTAB_PROGRAM_FILE = MTAB_PROGRAM_SOURCE.
           APPEND MTAB_PROGRAM_FILE.
         ENDLOOP.
    *-- Put the identifier line in so that the start of the report text
    *-- is marked
         CONCATENATE MC_TEXT_IDENTIFIER
                     MTAB_PROGRAM_TRDIR-NAME
           INTO MTAB_PROGRAM_FILE-LINE.
         APPEND MTAB_PROGRAM_FILE.
    *-- Add the report texts
         LOOP AT MTAB_PROGRAM_TEXTS.
           MTAB_PROGRAM_FILE = MTAB_PROGRAM_TEXTS.
           APPEND MTAB_PROGRAM_FILE.
         ENDLOOP.
    *-- Put the identifier line in so that the start of the THEAD record
    *-- is marked
         CONCATENATE MC_THEAD_IDENTIFIER
                     MTAB_PROGRAM_TRDIR-NAME
           INTO MTAB_PROGRAM_FILE-LINE.
         APPEND MTAB_PROGRAM_FILE.
         MTAB_PROGRAM_FILE = MSTR_THEAD.
         APPEND MTAB_PROGRAM_FILE.
    *-- Put the identifier line in so that the start of the report
    *-- documentation is marked
         CONCATENATE MC_DOC_IDENTIFIER
                     MTAB_PROGRAM_TRDIR-NAME
           INTO MTAB_PROGRAM_FILE-LINE.
         APPEND MTAB_PROGRAM_FILE.
    *-- Add the report documentation
         LOOP AT MTAB_PROGRAM_DOCUMENTATION.
           MTAB_PROGRAM_FILE = MTAB_PROGRAM_DOCUMENTATION.
           APPEND MTAB_PROGRAM_FILE.
         ENDLOOP.
    *-- Make the fully pathed filename that report will be saved to
         CONCATENATE P_PATH
                     MTAB_PROGRAM_TRDIR-NAME
                     '.txt'
           INTO LC_FULL_FILENAME.
         PERFORM SAVE_TABLE_TO_FILE TABLES MTAB_PROGRAM_FILE
                                    USING  LC_FULL_FILENAME.
    *-- Write out message with Program Name/Description
         READ TABLE MTAB_PROGRAM_TEXTS WITH KEY ID = 'R'.
         IF SY-SUBRC = 0.
           MTAB_DIRECTORY-NAME = MTAB_PROGRAM_TRDIR-NAME.
           MTAB_DIRECTORY-DESC = MTAB_PROGRAM_TEXTS-ENTRY.
           MTAB_DIRECTORY-SAVENAME = LC_FULL_FILENAME.
           APPEND MTAB_DIRECTORY.
           WRITE: / MTAB_PROGRAM_TRDIR-NAME,
                    MTAB_PROGRAM_TEXTS-ENTRY(65) COLOR COL_HEADING.
         ELSE.
           MTAB_DIRECTORY-NAME = MTAB_PROGRAM_TRDIR-NAME.
           MTAB_DIRECTORY-DESC = 'No description available'.
           MTAB_DIRECTORY-SAVENAME = LC_FULL_FILENAME.
           APPEND MTAB_DIRECTORY.
           WRITE: / MTAB_PROGRAM_TRDIR-NAME.
         ENDIF.
       ENDLOOP.
    ENDFORM.                               " BUILD_PROGRAM_DIRECTORY
          FORM SAVE_TABLE_TO_FILE                                       *
    -->  FTAB_TABLE                                                    *
    -->  F_FILENAME                                                    *
    FORM SAVE_TABLE_TO_FILE TABLES FTAB_TABLE
                             USING  F_FILENAME.
       IF RB_DOS = 'X'.                  " Save file to presentation server
         CALL FUNCTION 'WS_DOWNLOAD'
              EXPORTING
                   FILENAME = F_FILENAME
                   FILETYPE = 'ASC'
              TABLES
                   DATA_TAB = FTAB_TABLE
              EXCEPTIONS
                   OTHERS   = 4.
         IF SY-SUBRC NE 0.
           WRITE: / 'Error opening dataset' COLOR COL_NEGATIVE,
                    F_FILENAME COLOR COL_NEGATIVE.
         ENDIF.
       ELSE.                                " Save file to application serve
         OPEN DATASET F_FILENAME FOR OUTPUT IN TEXT MODE.
         IF SY-SUBRC = 0.
           LOOP AT FTAB_TABLE.
             TRANSFER FTAB_TABLE TO F_FILENAME.
             IF SY-SUBRC NE 0.
               WRITE: / 'Error writing record to file;' COLOR COL_NEGATIVE,
                        F_FILENAME COLOR COL_NEGATIVE.
             ENDIF.
           ENDLOOP.
         ELSE.
           WRITE: / 'Error opening dataset' COLOR COL_NEGATIVE,
                    F_FILENAME COLOR COL_NEGATIVE.
         ENDIF.
       ENDIF.                               " End RB_DOS
    ENDFORM.                               " SAVE_PROGRAM
          FORM READ_REPORT_FROM_DISK                                    *
          Read report into internal table.  Can read from local or      *
          remote computer                                               *
    FORM READ_REPORT_FROM_DISK TABLES FTAB_TABLE
                                USING  F_FILENAME.
       DATA:
          LC_MESSAGE(128) TYPE C.
       CLEAR   FTAB_TABLE.
       REFRESH FTAB_TABLE.
       IF RB_DOS = 'X'.
         TRANSLATE F_FILENAME USING '/\'.   " correct slash for Dos PC file
         CALL FUNCTION 'WS_UPLOAD'
              EXPORTING
                   FILENAME            = F_FILENAME
                   FILETYPE            = 'ASC'
              TABLES
                   DATA_TAB            = FTAB_TABLE
              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.
         IF SY-SUBRC >< 0.
           WRITE: / 'Error reading file from local PC' COLOR COL_NEGATIVE.
         ENDIF.
       ELSEIF RB_UNIX = 'X'.
         TRANSLATE F_FILENAME USING '\/'.   " correct slash for unix
         OPEN DATASET F_FILENAME FOR INPUT MESSAGE LC_MESSAGE IN TEXT MODE.
         IF SY-SUBRC = 0.
           DO.
             READ DATASET F_FILENAME INTO FTAB_TABLE.
             IF SY-SUBRC = 0.
               APPEND FTAB_TABLE.
             ELSE.
               EXIT.
             ENDIF.
           ENDDO.
           CLOSE DATASET F_FILENAME.
         ELSE.
           WRITE: / 'Error reading file from remote computer'
                           COLOR COL_NEGATIVE,
                  / LC_MESSAGE,
                  / F_FILENAME.
           SY-SUBRC = 4.
         ENDIF.
       ENDIF.
    ENDFORM.                               " READ_REPORT_FROM_DISK
          FORM SPLIT_INCOMING_FILE                                      *
    -->  FTAB_PROGRAM_FILE                                             *
    -->  FTAB_PROGRAM_SOURCE                                           *
    -->  `                                                             *
    -->  FTAB_PROGRAM_TEXTS                                            *
    FORM SPLIT_INCOMING_FILE TABLES FTAB_PROGRAM_FILE
                                          STRUCTURE MTAB_PROGRAM_FILE
                                     FTAB_PROGRAM_SOURCE
                                          STRUCTURE MTAB_PROGRAM_SOURCE
                                     FTAB_PROGRAM_TEXTS
                                          STRUCTURE MTAB_PROGRAM_TEXTS
                                     FTAB_PROGRAM_DOCUMENTATION
                                       STRUCTURE MTAB_PROGRAM_DOCUMENTATION
                            CHANGING FSTR_TRDIR
                                     FSTR_THEAD.
       DATA:
         LC_DATATYPE(4) TYPE C,             " Type of data, REPO, TEXP, RDIR
         LC_PROGRAM_FILE LIKE MTAB_PROGRAM_FILE.
       LOOP AT FTAB_PROGRAM_FILE.
         LC_PROGRAM_FILE = FTAB_PROGRAM_FILE.
         CASE LC_PROGRAM_FILE(9).
           WHEN MC_TRDIR_IDENTIFIER.
             LC_DATATYPE = MC_TRDIR_SHORT.
           WHEN MC_REPORT_IDENTIFIER.
             LC_DATATYPE = MC_REPORT_SHORT.
           WHEN MC_TEXT_IDENTIFIER.
             LC_DATATYPE = MC_TEXT_SHORT.
           WHEN MC_DOC_IDENTIFIER.
             LC_DATATYPE = MC_DOC_SHORT.
           WHEN MC_THEAD_IDENTIFIER.
             LC_DATATYPE = MC_THEAD_SHORT.
           WHEN OTHERS. " Actual contents of report, trdir, or text
             CASE LC_DATATYPE.
               WHEN MC_TRDIR_SHORT.
                 FSTR_TRDIR = FTAB_PROGRAM_FILE.
               WHEN MC_REPORT_SHORT.
                 FTAB_PROGRAM_SOURCE = FTAB_PROGRAM_FILE.
                 APPEND FTAB_PROGRAM_SOURCE.
               WHEN MC_TEXT_SHORT.
                 FTAB_PROGRAM_TEXTS = FTAB_PROGRAM_FILE.
                 APPEND FTAB_PROGRAM_TEXTS.
               WHEN MC_THEAD_SHORT.
                 FSTR_THEAD = FTAB_PROGRAM_FILE.
               WHEN MC_DOC_SHORT.
                 FTAB_PROGRAM_DOCUMENTATION = FTAB_PROGRAM_FILE.
                 APPEND FTAB_PROGRAM_DOCUMENTATION.
             ENDCASE.
         ENDCASE.
       ENDLOOP.
    ENDFORM.                               " SPLIT_INCOMING_FILE
          FORM INSERT_NEW_REPORT                                        *
    -->  FTAB_PROGRAM_SOURCE                                           *
    -->  FTAB_PROGRAM_TEXTS                                            *
    -->  F_TRDIR                                                       *
    FORM INSERT_NEW_REPORT TABLES FTAB_PROGRAM_SOURCE
                                       STRUCTURE MTAB_PROGRAM_SOURCE
                                   FTAB_PROGRAM_TEXTS
                                        STRUCTURE MTAB_PROGRAM_TEXTS
                                   FTAB_PROGRAM_DOCUMENTATION
                                        STRUCTURE MTAB_PROGRAM_DOCUMENTATION
                            USING  FSTR_TRDIR LIKE TRDIR
                                   FSTR_THEAD LIKE MSTR_THEAD.
       DATA:
         LC_OBJ_NAME LIKE E071-OBJ_NAME,
         LC_LINE2(40)     TYPE C,
         LC_ANSWER(1)     TYPE C.
    *-- read trdir to see if the report already exists, if it does, prompt
    *-- user to overwrite or abort.
       SELECT SINGLE * FROM TRDIR WHERE NAME = FSTR_TRDIR-NAME.
       IF SY-SUBRC = 0.                     " Already exists
         CONCATENATE 'want to overwrite report'
                     FSTR_TRDIR-NAME
           INTO LC_LINE2 SEPARATED BY SPACE.
         CONCATENATE LC_LINE2
           INTO LC_LINE2.
         CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
              EXPORTING
                  DEFAULTOPTION  = 'N'
                  TEXTLINE1   = 'The selected report already exists, do you'
                  TEXTLINE2      = LC_LINE2
                  TITEL          = 'Report already exists'
                  CANCEL_DISPLAY = SPACE
              IMPORTING
                   ANSWER         = LC_ANSWER
              EXCEPTIONS
                   OTHERS         = 1.
       ELSE.
         LC_ANSWER = 'J'.
       ENDIF.
       IF LC_ANSWER = 'J'.
    *-- Create the TADIR entry.  (TRDIR entry created by INSERT REPORT)
         LC_OBJ_NAME = TRDIR-NAME.
         CALL FUNCTION 'TR_TADIR_POPUP_ENTRY_E071'
              EXPORTING
                   WI_E071_PGMID     = 'R3TR'
                   WI_E071_OBJECT    = 'PROG'
                   WI_E071_OBJ_NAME  = LC_OBJ_NAME
                   WI_TADIR_DEVCLASS = '$TMP'
              EXCEPTIONS
                   EXIT              = 3
                   OTHERS            = 4.
         IF SY-SUBRC = 0.
    *-- Create Report
           INSERT REPORT FSTR_TRDIR-NAME FROM FTAB_PROGRAM_SOURCE.
    *-- Create Texts
           INSERT TEXTPOOL FSTR_TRDIR-NAME FROM FTAB_PROGRAM_TEXTS
                  LANGUAGE SY-LANGU.
    *-- Save Documentation
           CALL FUNCTION 'DOCU_UPDATE'
                EXPORTING
                     HEAD    = FSTR_THEAD
                     STATE   = 'A'
                     TYP     = 'E'
                     VERSION = '1'
                TABLES
                     LINE    = FTAB_PROGRAM_DOCUMENTATION
                EXCEPTIONS
                     OTHERS  = 1.
         ELSE.
           WRITE: / 'Error updating the TADIR entry' COLOR COL_NEGATIVE,
                    'Program' COLOR COL_NEGATIVE INTENSIFIED OFF,
                    FSTR_TRDIR-NAME, 'was not loaded into SAP.'
                       COLOR COL_NEGATIVE INTENSIFIED OFF.
         ENDIF.
       ELSE.
         WRITE: / FSTR_TRDIR-NAME COLOR COL_NEGATIVE,
                  'was not uploaded into SAP.  Action cancelled by user'
                      COLOR COL_NEGATIVE INTENSIFIED OFF.
       ENDIF.
    ENDFORM.                               " INSERT_NEW_REPORT
          FORM GET_NAME                                                 *
    -->  VALUE(F_FIELD)                                                *
    -->  F_NAME                                                        *
    FORM GET_NAME USING VALUE(F_FIELD)
                CHANGING F_NAME.
       DATA: LTAB_FIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE,
             LC_PROG LIKE D020S-PROG,
             LC_DNUM LIKE D020S-DNUM.
       TRANSLATE F_FIELD TO UPPER CASE.
       refresh ltab_fields.
       LTAB_FIELDS-FIELDNAME = F_FIELD.
       append ltab_fields.
       LC_PROG =  SY-REPID .
       LC_DNUM =  SY-DYNNR .
       CALL FUNCTION 'DYNP_VALUES_READ'
            EXPORTING
                 DYNAME     = LC_PROG
                 DYNUMB     = LC_DNUM
            TABLES
                 dynpfields = ltab_fields
            EXCEPTIONS
                 OTHERS     = 01.
       read table ltab_fields index 1.
       IF SY-SUBRC EQ 0.
         F_NAME = LTAB_FIELDS-FIELDVALUE.
         refresh ltab_fields.
       ENDIF.
       CALL FUNCTION 'F4_USER'
            EXPORTING
                 OBJECT = F_NAME
            IMPORTING
                 RESULT = F_NAME.
    ENDFORM.                               " GET_NAME
    This is the entire program.hope it helops you.
    Reward if useful
    Regards
    divya

  • Download local file using Servlet and JSP

    Hello,
    I will like to use a browser to download file on local system using serlvet and Jsp technology. Does anyone have any idea how to do it?
    Any comment will be appreciate.
    Thanks

    Well you can just put the file in a folder that is accessible to the web server. Then have a link point to that file. That will cause the web browser to download the file.
    hattan

  • Inserting Field Names as Header while downloading the file

    Hi,
    I am downloading one file using CALL METHOD cl_gui_frontend_services=>gui_download and wanted to add field names as header while downloading.I have the filed names in one internal table and have written the code as follows:
       LOOP AT gt_import INTO gw_import.
          gw_fldname-field_name = gw_import-field_name.
          APPEND gw_fldname TO gt_fldname.
        ENDLOOP.
    Here gt_fldname has the field names.
          l_descr_ref ?= cl_abap_typedescr=>describe_by_data( gt_fldname ).
          CLEAR : l_counter.
          LOOP AT l_descr_ref->components[] ASSIGNING <lfs_comp_wa>.
            l_counter = l_counter + 1.
            ASSIGN COMPONENT sy-index OF STRUCTURE gt_fldname TO <lfs_comp>.
            IF sy-subrc = 0.
              <lfs_comp> = <lfs_comp_wa>-name.
            ENDIF.
          ENDLOOP.
       CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
            filename                = pdir1
            filetype                = text-038
            append                  = ''
            write_field_separator   = 'X'
          CHANGING
            data_tab                = <lfs_comp>
          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
            not_supported_by_gui    = 22
            error_no_gui            = 23
            OTHERS                  = 24.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
        CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
            filename                = pdir1
            filetype                = text-038
            append                  = 'X'
            write_field_separator   = 'X'
          CHANGING
            data_tab                = <gfs_table1>
          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
            not_supported_by_gui    = 22
            error_no_gui            = 23
            OTHERS                  = 24.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
    But it goes to dump at       l_descr_ref ?= cl_abap_typedescr=>describe_by_data( gt_fldname ) where I am trying to make the filed names horizontal.
    Can anyone help on this?

    The issue has been resolved after writting:
          l_ref_table ?= cl_abap_tabledescr=>describe_by_data( gt_fldname ).
          l_descr_ref ?= l_ref_table->get_table_line_type( ).
    Thanks.

  • Adding Header to a TEXT File

    Hi All,
    I am downloading some data into a text file using GUI_DOWNLOAD FM.
    Is there any way that i can add a header line on top of the file? In excel file, it is possible, but how do i do it for a *.txt file?
    Regards
    Abhijith H

    Hi Abhijith,
    The below code is to download a CSV txt file. If u want u can get the excel file also by just changing the extension from .txt to .exl Try in the way given below. U will be able to insert the required header too and get the excel file also.
    *&      Form  gui_download
          Called to download the data selected
    FORM gui_download.
    *--Local data declaration
      DATA : l_count TYPE i,
             l_filename TYPE string.
      FIELD-SYMBOLS: <fs_download>.
    *--Count the number of fields
      DO.
        ASSIGN COMPONENT sy-index OF STRUCTURE wa_inputtab TO <fs_download>.
        IF sy-subrc <> 0.
          EXIT.
        ELSE.
          l_count = l_count + 1.
        ENDIF.
      ENDDO.
      CLEAR wa_inputtab.
    *--Inserting the fields to the internal table in the required format
      LOOP AT inputtab INTO wa_inputtab.
        DO l_count TIMES.         " Adding the delimiter in required places
          ASSIGN COMPONENT sy-index OF STRUCTURE wa_inputtab TO
                                                            <fs_download>.
          CONCATENATE wa_csv_output ',' <fs_download> INTO wa_csv_output.
        ENDDO.
        SHIFT  wa_csv_output.
        APPEND wa_csv_output TO itab_csv_output.
        CLEAR  wa_csv_output.
      ENDLOOP.
    *--Inserting the header to the internal table.
      CONCATENATE 'DTAFF#' 'DTPRAC' 'DTPPP'  'DTREP'  'DTCURR' 'DTNATL'
                  'DTLAMT' 'DTFMD'  'DT$AMT' 'DTUNIT' 'DTRATE'
                  INTO wa_csv_output SEPARATED BY ','.
      INSERT wa_csv_output INTO itab_csv_output INDEX 1.
      IF NOT itab_csv_output[] IS INITIAL.
    *--Download Data
        l_filename = p_output.
        CALL FUNCTION 'GUI_DOWNLOAD'
             EXPORTING
                  filename                = l_filename
                  filetype                = 'ASC'
                  has_field_separator     = 'X'
             TABLES
                  data_tab                = itab_csv_output
             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.
    Reward if useful,
    Cheers,
    Sharadendu

  • Waiting to download Local files onto smartphone....

    Hi. So all I'm trying to do is add music from my pc onto my spotify and be able to listen to on my Galaxy S5. I've done everything right, followed all the how-to's. The only problem now is that when I attempt to download the music to make it available offline on my phone. It just sits there, saying waiting to download... I've tried restarting everything, deleting and adding, all of it. Anybody know whats going on???

    Downloading them is done through a web browser. Opening them is done in OpenOffice, LibreOffice, Numbers, Microsoft Excel, or similar products.
    (87035)

  • Can't sync local files.

    Spotify refuses to sync local files. It will sync every other song but wont even attempt to download local files onto my iphone. They stay grayed out. 
    IMy iphone and mac are conneced to the same wifi. I have the most recent mac and iphone version of spotify. I just did a clean reinstall of both. I also checked to make sure that I have the most recent IOS and OSX version, and I do. I am using a macbook pro retina 13 inch which I just bought and an iphone 5. 

    Hi, I have had this problem for such a long time and it has been driving me mad. I couldn't sync my local files that were in my playlist to my iPhone or iPad, for example Fifth Harmony's song 'Worth It'. It was in my local files but wouldn't download and sync even if the playlist was avaliable offline. Yet theiir singles 'Sledgehammer' and 'BO$$' were syncing because they're on Spotify.
    Also both my Apple products weren't showing under the devices section even if they were under the same WiFi.
    However I have fixed my problem; it is due to the firewall in my HP laptop. I went into my laptop's search bar and typed in 'firewall'. I got a promt for allow a programme through firewall. I clicked on the controll panel for this and I had to change my settings for Spotify as it was only ticked in one box and not both like iTunes is. As soon as I clicked on this and saved the settings, I went back into Spotify and straight away my iPhone 5s appeared under my devices and my playlists that were containing my local files started downloading and syncing.
    Hope this helps anyone else with this problem!! 
    :)

  • Heading  during downloading into local file using GUI_DOWNLOAD fun.module

    Hi Guru's
    we have a requirement that we want the plant description as a heading (first line of the file) in the local file. iam using "GUI_DOWNLOAD" function module for downloading data for which iam passing the charecter type internal table. before downloading iam passing all the filed headings to that table and then appending the internal table data into it. now iam getting data properly with field headings . but before that heading i want one more description for a plant field which iam using in my selection screen
    in the fun.module "GUI_DOWNLAOD"
    we have HEADER file but it is of XSTRING type so it is taking only 2 char.
    so how to use this . Plz help me.
    thanks well in advance.
    UR's
    GSANA

    Hi,
    Please check the below link,
    header in 'gui_download'
    Also check Manoj kumar's reply in the link,
    header information to gui_download
    Hope this helps.
    Best Regards.

  • How to download the attachment text to local file.

    Hi Xperts,
    My requirement is at the time of workitem execution, Approver can write the attachment with the reason for Rejection.
    Now, I need to down load that attachment content to local file and then that content needs to be updated in the PO Header changes.
    I can able to get the attachment files' title, size and everything from the DB Table SOOD. But there is no Attachment's content is getting updated in that table.
    Will you pls let me know how to download the content of the attachment to a local file from the sap.
    ThanX in ADvance.
    Krish.

    HI Arghadip Kar,
    By using the Function Module SAP_WAPI_GET_ATTACHMENTS, we can get the Object id of the attachment, but not the content of the Attachment.
    But, my requirement is to get the content of the attachment.
    Best Regards,
    Krishna.

  • Downloading Report output to a Local File

    Hi,
    I want to download the my ALV Report output to a local file.
    I am following the menu options from ALV output:
      LIST --> Export --> Local File --> Unconverted Format  --> I entered a text file name on the desktop.
    The data is being downloaded to Local text file, but some columns are missing.
    I don't know what is the reason?  Can anybody tell what may be the reason?
    Has anybody come across this issue earlier?
    Please let me know the solution.
    Thanks in advance,
    Sreenivas Reddy.

    Hi vik,
    I have followed the same steps
       LIST --> Export --> Local File --> Here I enter test.xls file on the desktop.
    I am missing the same columns, The heading are displayed for all fields, but data for some initial columns are missing.
    Can you please through some light on this error.
    Thanks,
    Sreeni.

  • No Local Files being added or shown in new version (1.0.1.1060.gc75ebdfd)

    Hey there, longtime premium user. Searched boards for this issue and havnt found any yet in this new update.
    The 'local files' playlist/folder/tab section is completely empty. Under preferences all of my usual music folders are selected, and I have readded them, and even created new folders in different hardrives and added a test song or two and then added, but the local files remains unpopulated. 
    I know some are being found as they are shown in other older playlists from before this update, and even the 'show containing folder' under right click works fine when playing from these playlists. But the local files is completely empty. 
    Have logged out of account and also performed a fresh install of the program (although unfortunately synched folders are tied to accounts so I wasnt able to perform a "fresh" install by selecting folders again).
    Have even resynched Windows Media Player library incase spotify would be able to find the new songs through this, but no luck on this front either.
    Anyone having this same issue? Any work around?
    (Screenshot attached if its any help)

    Can you try a clean reinstalation of Spotify, such as clearing out all the cache files that Spotify stores on your computer? This may solve the problem.
    1:Uninstall Spotify: Start > Control Panel > Programs / Uninstall a Program > Spotify
    2: Find your AppData folder and delete all Spotify data.
    Start, run, type: %appdata% and hit enter
    You probably see 4 folders; enter each and see if they contain a folder called Spotify. Delete the entire Spotify folder.
    3:Restart your computer at this point.
    4:Reinstall Spotify (download)

  • Local files not downloading to app

    I am having a problem with my local files playing on the Android Spotify app. I have tried uninstalling and reinstalling the app but it doesn't seem to work, all the other music downloads but not my local files that have been added to that playlist.  It used to work, but sometimes spotify does this "oops, you don't have any songs downloaded and we need to download them all again" screw ups and now they don't download. When i scroll down to them in the playlist they are grey (with no grey downloading icon, just purely greyed out) and when I press on them it says "this song is not available".  My phone and my desktop are on the same home internet and I don't know what the problem is but it's really frustrating. The songs I have in local files are ones not available on spotify. 

    Please read the support topic here for assistance setting up local file sync: Listen to local files
    Make sure that you are on the same WiFi network and Windows & third party firewalls are configured to allow the Spotify connection through.
    Another point to note is that sometimes if a track is stored locally & is also available to stream then when you sync to your device it will automatically use the Spotify streaming version but the data from your playlist. If for some reason the metadata such as track length differs this can cause conflict and break the track. In this instance you are best off removing the local file from your playlist on the desktop and adding the track from the Spotify server then re-sync. This should fix this issue.

  • Unable to download data in ALV output with local file option

    Hi,
    I am displaying ouput in ALV grid display.Its showing output fine.When i am trying to down load the data into Excel file from ALV ouput .when i am downloaded the data by using Local file option,its down loading the data but its not downloading all the fields.
    Could you plz provide me solution.Thanks!

    Just Check that one of your parameters is defined in lower case letters.
    Earlier it used to give dump on execution but now if you download then it will give ABAP dump.
    I have seen this problem many times.
    Regards,
    Gaurav Sood

  • Download a PDF from an URL to a local file

    Hi all,
    we are trying to get a pdf file from the internet with FM HTTP_GET, and after that download to a local file with WS_DOWNLOAD.
    Our problem is that we do not know wich type of table to use in order to retrieve the RESPONSE_ENTITY_BODY from HTTP_GET.
    Sometimes the PDF have 4000 of length sometimes 1200.
    Could you please help us?
    Regards,
    Rubé

    hi
    you can have a look at RSHTTP* programs.thta is ,for cl_http_client demo program try RSHTTP01 and for http_get demo program try RSHTTP20.
    hope this helps
    regards
    Aakash Banga

Maybe you are looking for

  • How do I find the actual size of an app? Example: a wallpaper app claims the size of 4.4 MB, but the size on my iPhone is 4.9 GB!

    Some of the apps on my iPhone are much larger size-wise than claimed on their app page. Example: Wallpapers HD claims 4.4 MB, but the actual size on my phone is 4.9 GB! Pinterest & Facebook also end up being huge real estate hogs. How do I really kno

  • Superdrive Should Read Dual Layer, but doesnt?

    I recently purchased a Powerbook 17" and under the specifications, it is supposed to support Burning Dual Layer DVDs. However, upon looking under my System profiler it does not show this. Why? MATSHITA DVD-R UJ-835E: Firmware Revision: GAND Interconn

  • Mac Book Air 13" the right device for occasionally editing photos?

    Hello! I am owner of an iMac 24" and know I want to replace my three years old thinkpad. Mainly, I am using my iMac for editing photos. With the MacBook Air I also want to be flexible to edit my photos also during a holiday or in the train etc. Do yo

  • Java.sql.SQLException: ORA-25191

    I'm getting this error msg when I execute my query on the tables of my database,,,,,I'm getting this problem with not all the tables.The problem is,,, java.sql.SQLException: ORA-25191: cannot reference overflow table of an index-organized table plz h

  • Need to upgration of SAP

    Hi, How can i update my SAP Business One. I want to upgrade My SAP. if any update version are available. I have download SAP download manager. i put my SID but the message is appears 'The request fail 403' Please help me. Regards, Mizan