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.

Similar Messages

  • Error While downloading the file A server Error has occurred, please try again later Downloading Yahoo mail Application Attachments  Trying to download My Photos and movie 3 items so i can delete them all

    I have icloud and a new iPhone5 ! They work good , took pictures and a few short movies, plugged in my phone to my iMac transfered Items to iPhoto then inported items to iMovie. when getting to know what i was doing i decided to delete pictures and movies i no longer wanted. when i looked for a few missing items i opend Finder and there some where buyt i had already trashed them and deleted the doubles. Still could not find missing pictures and movies 3 items and today after calling yahoo about a different complant with sending feed back for Yahoo mail Applications login . i opened up Attachments Not the Large Attachments just Attachments and there were the 3 items i had been hunting for to Trash and delete. the mail Attachments file does not have the Option to delet Files and photos and movies. When i tried to Download the 3 items a window shows up that says Error While Downloading the Files, A Server Error has occured, please Try Again later. nothing works how do i remove the Trapped photo and movie Blank Files and trash them?  Onece they get into my downloads i can do something with them as i understand.    That part of it kind of keeps me in Question also because why should i have to down load my own files of Attachments / Pictures and movies if they are comming from my iMac?    How much better is iLife11 then iPhoto08 and iMovie08 .  Thanks Greg

    Hello,
    Thank you for your post.
    This is a quick note to let you know that we are performing research on this issue.
    If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Simon Wu
    TechNet Community Support

  • "\n" problem while downloading the file in unix environment

    Hi folks,
    I have some problem in uploading and downloading the file in unix environment..
    This is my sample code i am using.
    File userDataFile = new File("xyz".csv");
    out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(userDataFile),"UNICODE"));
    out.write("Name"+"\t");
    out.write("Age"+"\t");
    out.write("Dob"+"\t");
    out.write("Contact"+"\n");
    for(int i=0;i<retList.size;i++){
    out.write("xyz"+"\t");
    out.write("22"+"\t");
    out.write("300399"+"\t");
    out.write("xyzzz"+"\n");
    as per this i wrote code for generating the reports. Its contains some 7k records.
    Its works in Windows environment.
    Some times in Windows environment if the contents size is 7000 records means
    i got only the headers..
    I am not getting any real records.
    I am not sure.. my client is using may be an unix environment..
    Please give the solutions for this..
    Very thanks in advance.

    Hi Jothi,
    This is not an answer to your question. It is a question for you instead. I have tried to reach you on several forums regarding the HAP_DOCUMENT documentation you have.
    Again, I am really sorry to contact you through a differente forum, but I really need the HAP_DOCUMENT documentation for my project.
    Please send me a message to [email protected]
    Thanks again.
    JULIAN CASTRO

  • Error while downloading the file

    Hi, I have created a rssfeed file when i connect to iTunes and use my local webserver to look up the feed file it downloads all the episodes without any issues.
    From the main webserver the feed file does not work,although the paths and everything is correct.get the message "There was a problem downloading ... . The URL could not be found on the server". the file exists on the server and everything is fine according to feedValidator ... any help this is making me crazy

    Hi, I have created a rssfeed file when i connect to iTunes and use my local webserver to look up the feed file it downloads all the episodes without any issues.
    From the main webserver the feed file does not work,although the paths and everything is correct.get the message "There was a problem downloading ... . The URL could not be found on the server". the file exists on the server and everything is fine according to feedValidator ... any help this is making me crazy

  • Problem while dowloading the file from Application Server

    Dear Experts,
                 I am facing the Problem while downloading the file from Application server.
    We done the automatic function while saving the invoice, this will create an idoc, and this idoc is written in the Application Server.
    I am running the Transaction AL11 and select the record, and from menu --> List, i am downloading into TXT format.
    But for some segments, the length is long, and so the last 3 to 4 fields values are not appearing in the File. Even though i am unable to view the values in the file before downloading. But i can view in IDOC.
    Please help me to solve this issue.
    Thanks & Regards,
    Srini

    but our user will use the Txn. AL11 and they will download from there
    Educate the user On a serious note, tell him this is not how data from app server should be downloaded. You can ask him to talk to the basis team to provide him access to the app server folder where the file is being stored.
    I can set the Variant and put this in background, But always the file name will be change, Like we use Time stamp in the File name.
    You can't automate this process by scheduling in BG mode. This is because the in BG mode you can't dwld the file to presentation server.
    Hope i'm clear.
    BR,
    Suhas

  • Error while downloading the xml file

    i am having a internal table which contains data in xml format but i am unable to download the data into local system by using 'GUI_DOWNLOAD' fn. module
    its error its showing is as :
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    A name contained an invalid character. Error processing resource 'file:///D:/XX.XML'. Line 4, Position 4
    MOD/><RPTSX/><MANDT/><SYPSY/><SYSID/><SAPRL/></T682><T682><KVEWE>A</KV...

    hello Durairaj,
    i am fwd the code go thru it and check why the xml file is not downloading,
    and after downloading the file i want that file to be in displayed in  .pdf.
    REPORT  ZCCSV_TO_XML.
    DATA : BEGIN OF TABLE OCCURS 0,
            TABNAME(15) TYPE C,
           END OF TABLE.
    DATA : BEGIN OF HEADER_NAMTAB OCCURS 0,
            NAMTAB TYPE STRING,
           END OF HEADER_NAMTAB.
    DATA : BEGIN OF CONVERT_ITAB_TO_XML OCCURS 0,
            FIELDNAME(255) TYPE C,
           END OF CONVERT_ITAB_TO_XML .
    DATA : BEGIN OF CONVERT_XML_TO_ITAB OCCURS 0,
            FIELDNAME(255) TYPE C,
           END OF CONVERT_XML_TO_ITAB.
    DATA DREF TYPE REF TO DATA.
    DATA TNAME LIKE DD02L-TABNAME.
    DATA BEGIN OF ZDFIES OCCURS 0.
            INCLUDE STRUCTURE DFIES.
    DATA END OF ZDFIES.
    DATA: xml_out TYPE string .
    DATA: xml_TO_ITAB TYPE string .
    data : wa_indx type indx.
    DATA : DETAIL(30).
    DATA : DATA1 TYPE STRING.
    DATA : COMMA . "VALUE ','.
    DATA : DBTAB1(15) TYPE C.
    FIELD-SYMBOLS: <ITAB> TYPE ANY TABLE,
                   <WA>    TYPE ANY,
                    <WA1> TYPE ANY .
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME,
                       SKIP 1.
    PARAMETERS : SPOOL    RADIOBUTTON GROUP rad1 DEFAULT 'X',
                 CSV      RADIOBUTTON GROUP rad1 ,
                 XMLTOPDF RADIOBUTTON GROUP rad1.
    SELECTION-SCREEN : SKIP 1,
                       END OF BLOCK b1.
        TABLE-TABNAME = 'T681'.
        APPEND TABLE.
        TABLE-TABNAME = 'T682'.
        APPEND TABLE.
      IF SPOOL = 'X'.
       PERFORM SPOOL.
      ELSEIF CSV = 'X'.
        PERFORM CSV.
      ELSEIF XMLTOPDF = 'X'.
        PERFORM XMLTOPDF.
      ENDIF.
    *&      Form  CSV
    form CSV .
    LOOP AT TABLE.
      dbtab1 = TABLE-TABNAME.
      TNAME = dbtab1.
      PERFORM GETFIELDS.
      LOOP AT HEADER_NAMTAB.
       WRITE: HEADER_NAMTAB-NAMTAB, COMMA.
      ENDLOOP.
      PERFORM GET_DETAIL_LIST.
    ENDLOOP.
    endform.                    " CSV
    form XMLTOPDF .
    LOOP AT TABLE.
      PERFORM GET_DETAIL_LIST.
    ENDLOOP.
    endform.                    " XMLTOPDF
    GETTING THE HEADER OF THE TABLE                                     *
    FORM GETFIELDS.
      REFRESH HEADER_NAMTAB.
      CALL FUNCTION 'GET_FIELDTAB'
       EXPORTING
           LANGU              = SY-LANGU
           ONLY               = SPACE
           TABNAME            = TNAME
           WITHTEXT           = 'X'
       TABLES
           FIELDTAB           = ZDFIES
       EXCEPTIONS
           INTERNAL_ERROR      = 01
           NO_TEXTS_FOUND      = 02
           TABLE_HAS_NO_FIELDS = 03
           TABLE_NOT_ACTIV     = 04.
      CASE SY-SUBRC.
        WHEN 0.
          LOOP AT ZDFIES.
            HEADER_NAMTAB-NAMTAB = ZDFIES-SCRTEXT_M.
            APPEND HEADER_NAMTAB.
          ENDLOOP.
        WHEN OTHERS.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH  SY-SUBRC.
      ENDCASE.
    ENDFORM.                  " GETFIELEDS
    *&      Form  GET_DETAIL_LIST
    form GET_DETAIL_LIST .
      CREATE DATA DREF TYPE STANDARD TABLE OF (TABLE)
                                WITH NON-UNIQUE DEFAULT KEY.
      ASSIGN DREF->* TO <ITAB> .
      SELECT * FROM (TABLE) INTO TABLE <ITAB>.
      CALL TRANSFORMATION ('ID')
      SOURCE tab = <ITAB>[]
      RESULT XML xml_out.
    Convert to TABLE
    CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'
    EXPORTING
    i_string = xml_out
    i_tabline_length = 100
    TABLES
    et_table = CONVERT_ITAB_TO_XML.
    Download
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filetype = 'ASC'
    filename = 'D:\XX.XML'
    TABLES
    data_tab = CONVERT_ITAB_TO_XML
    endform.

  • Changes in date format while creating/downloading the file

    Hi All,
    Can any one let me know how does the system determines which date format should it apply while creating/downloading the file.
    Issue :
    When I create/download the file generated by report RTXWCF02 using unix level acess the Date format of a field in file is DD.MM.YYYY where as in user profile i can see its in MM/DD/YYYY.
    I dont understand how system determines the date format and How we can change it. Please suggest.
    Regards,
    Ravi Kasnale

    I would suggest you to use ALV_XXL_CALL if your want to keep your data formats intact.
    like this -   CALL FUNCTION 'ALV_XXL_CALL'
           EXPORTING
                i_tabname           = 'T_GRID'   " Name of your internal table
                it_fieldcat         = t_fcatk[]      "Your LAV grids catalog.
           TABLES
                it_outtab           = t_grid         "Internal table itself
           EXCEPTIONS
                fatal_error         = 1
                no_display_possible = 2
                OTHERS              = 3.
      IF sy-subrc <> 0.
        MESSAGE e806(bk).
      ENDIF.
    hope it helps.

  • "Error occurred while converting the file 'song name'. The required disk cannot be found"

    Hi, I saw this issue in an archived discussion, and I just had the same problem, but figured out how to resolve it.
    I think this error is a result of:
    A) downloading a new version of iTunes, and;
    B) storing my iTunes library on an external hard drive.
    Because when the new version of iTunes was downloaded, I found that the destination folder for my iTunes music was no longer selected. Therefore, I was getting the error message: "Error occurred while converting the file 'song name'. The required disk cannot be found" when I tried to import CDs.
    To fix: go to:
    iTunes>Preferences>Advanced
    and specify your destination folder for your music.
    Just wanted to share!

    Thank you so much! I was in the same situation (iTunes library stored on external hard disk). Strangely, iTunes knew where my music was stored (i.e. if I clicked a song it would link to the library location and play with no problems). But in the "Advanced" settings, the location of my iTunes Library was blank. So I just pointed to the correct location and now everything is working OK! Thanks again.

  • One field is missing in downloading the file from report

    Hi Friends,
    I have a problem with downloading the file from SAP.
    Actually the report has to download 6 fields from the list of the report to a .txt file on the presentation server. But it is downloading only 5 fields. The missing field is DEA#. Actually now i have to fix that problem.
    I found that in the download process they have not inlcuded the DEA# field.
    Here in this 1 field is not getting dowloading from the list of the report to the text file.
    I'm giving a portion of the code.
    Like this they r calling the FM:
    FORM DOWNLOAD_FILE.
      CALL FUNCTION 'DOWNLOAD'
           EXPORTING
                FILENAME = P_OUTFIL
           TABLES
                DATA_TAB = I_OUTPUT.
      IF SY-SUBRC <> 0.
        WRITE:/ 'Error downloading file'.
      ENDIF.
    in code we have,
    data: v_output type t_output,
    data: i_output type t_output occurs 0.
    and,
    BEGIN OF T_OUTPUT,
           RECORD(200),
           END OF T_OUTPUT.
    when i debug the program,
    the record field is showing only the 5 fields not the missing 6th filed)DEA#).
    and we have another FORM :
    *&      Form  FORMAT_FILE_WITH_TABS
          Insert tabs between fields so when uploaded in Excel, the
          record will be separated into columns where a tab is found.
    FORM FORMAT_FILE_WITH_TABS.
      LOOP AT I_KNA1 INTO V_KNA1.
        CONCATENATE: V_KNA1-KUNNR
                     V_KNA1-NAME1
                     V_KNA1-NAME2
                     V_KNA1-STRAS
                     V_KNA1-ORT01
                     V_KNA1-REGIO
                     V_KNA1-PSTLZ
           INTO V_OUTPUT SEPARATED BY C_TAB.
        APPEND V_OUTPUT TO I_OUTPUT.
        CLEAR V_OUTPUT.
      ENDLOOP.
    ENDFORM.                               " FORMAT_FILE_WITH_TABS
    If you look into this FM, there is no mention of DEA# field,
    i hve tried to correct it by adding the "v_likp_dea" in the FM. when i did like this it is showing the DEA# field in the downloaded .txt file but only 1 value for all the records.
    My question is for each record i have to show its unique DEA#.
    I guess i could do this by putting it in loop, could anybody tell me how i can i do that, Please
    Thank you very much.
    Raj.

    In the subroutine format_file_with_tabs ,
    You should read  it_likp with the key that uniquely identifies for dea# . This should be done in the loop at i_kna1.
    Suppose kunnr identifies a unique dea# in it_likp internal table , then you should write
    FORM FORMAT_FILE_WITH_TABS.
    LOOP AT I_KNA1 INTO V_KNA1.
    clear v_likp.
    read table it_likp into v_likp
       with key kunnr = v_kna1-kunnr binary search.   (should sort the itab to use binary search with read. )
    CONCATENATE: V_KNA1-KUNNR
    V_KNA1-NAME1
    V_KNA1-NAME2
    V_KNA1-STRAS
    V_KNA1-ORT01
    V_KNA1-REGIO
    V_KNA1-PSTLZ
    v_likp-dea
    INTO V_OUTPUT SEPARATED BY C_TAB.
    APPEND V_OUTPUT TO I_OUTPUT.
    CLEAR V_OUTPUT.
    ENDLOOP.
    ENDFORM. " FORMAT_FILE_WITH_TABS
    Message was edited by: Kalidas Cheroolil

  • Facing a Problem while downloading the data from ALV Grid to Excel Sheet

    Hi Friends,
    Iam facing a problem while downloading the data from ALV Grid to excel sheet. This is working fine in Development server , when comes to Quality and Production servers I have this trouble.
       I have nearly 11 fields in ALV Grid and out of which one is PO number of length 10 , all the ten numbers are visible in the excel sheet if we download it from development server but when we download it from Quality or Production it is showing only 9 numbers.
    Can any one help me out in this case.

    hi...
    if this problems happens dont display the same internal as u finally got.
    just create new internal table without calling any standard data elements and domains... but the new internal table s similar like ur final internal table and move all the values to new int table.
    for eg.
    ur final internal int table for disp,
         data : begin of itab occur 0,
                        matnr like mara-matnr,
                   end of itab.
    create new like this,
               data : begin of itab occur 0,
                        matnr(12) type N,
                   end of itab.

  • Lastest Itunes version loaded - Receive the following error message when trying to download a music CD: "Error occurred while converting the file (title of CD) A file was specified instead of a folder."

    OS X Mavericks with latest itunes version loaded. 
    Receive the following error message when attempting to download a music CD: " Error occurred while converting the file (name of music CD). A file was speceifed instead of a folder."

    The best discussion of resolving the issues is found in the user tip: https://discussions.apple.com/docs/DOC-6562

  • Upload and download the file same name but different extension from the document library.

    HI,
         I am using the Client Object Model (Copy. Asmx ) To upload and download the file from the document library.
    I am having the mandatory File ID for the each Document.
    I tried to upload the the document (KIF53.txt) with File ID (KIF53) uploaded successfully.
    Again I tried to Upload the document(KIF53.docx) With File ID(KIF53) its uploaded the file but it not upload the File ID in the Column
    Please find the below screen shoot for the reference.

    thanks ashish
    tried 
    My requirement is to create the  folder and sub folder in SharePoint document library. If already exist leave it or create the new folder and the subfolder in the Document library using client side object model
    I able to check for the parent folder.
    But cant able to check the subfolder in the document library.
    How to check for  the sub folder in the document library?
    Here is the code for the folder IsFolder alredy Exist.
    private string IsFolderExist(string InputFolderName)
            string retStatus
    = false.ToString();
            try
                ClientContext context
    = newClientContext(Convert.ToString(ConfigurationManager.AppSettings["DocumentLibraryLink"]));
    context.Credentials = CredentialCache.DefaultCredentials;
                List list
    = context.Web.Lists.GetByTitle(Convert.ToString(ConfigurationManager.AppSettings["DocumentLibraryName"]));
                FieldCollection fields
    = list.Fields;
                CamlQuery camlQueryForItem
    = new CamlQuery();
    camlQueryForItem.ViewXml = string.Format(@"<View 
    Scope='RecursiveAll'>
    <Query>
                          <Where>
    <Eq>
    <FieldRef Name='FileDirRef'/>
    <Value Type='Text'>{0}</Value>
                            </Eq>
    </Where>
    </Query>
    </View>", @"/sites/test/hcl/"
    + InputFolderName);
    Microsoft.SharePoint.Client.ListItemCollection listItems
    = list.GetItems(camlQueryForItem);
    context.Load(listItems);
    context.ExecuteQuery();
                if (listItems.Count
    > 0)
    retStatus = true.ToString();
                else
    retStatus = false.ToString();
            catch (Exception ex)
    retStatus = "X02";
            return retStatus;
    thanks
    Sundhar 

  • Error Occurred While Converting the file"name of song" The file name.......

    I get this message when I try to import some CD's to my library.
    A window pops up and says
    Error occurred while converting the file "name of song"
    The file name was invalid or to long.
    Anyone else ever get this message, and how can you import CD's???????

    I have had this exact same problem. I'm not sure how to fix it...

  • "Error occurred while converting the file "song name."

    While trying to import 3 different CD's into iTunes, the message "Error occurred while converting the file "song name. The required folder cannot be found." The song name is the first song of each of the CD's I tried to import. Have imported over 3,000 songs and never had this happen before. Help?

    I think I found out why this happens. I am using an external hard drive, not sure if this is relevant, but I believe so. I went into iTunes and deleted the songs, and asked that they be deleted from the library as well. Got same message when I tried to re-import. Went on to the external hard drive, where library is located, and none of the songs had been deleted. Deleted the songs, as well as the albums folder, re-imported, no problems. Hope that helps.

  • Error occurred while converting the file "song name" the required folder cannot be found

    In ITunes 12, while trying to import from CDs I keep getting this message "error occurred while converting the file "song name". The required folder cannot be found". It will import 2 or 3 or 5 songs and then this message. I have tried multiple CDs, a few seem to work fine, but most don't import completely.

    I think I found out why this happens. I am using an external hard drive, not sure if this is relevant, but I believe so. I went into iTunes and deleted the songs, and asked that they be deleted from the library as well. Got same message when I tried to re-import. Went on to the external hard drive, where library is located, and none of the songs had been deleted. Deleted the songs, as well as the albums folder, re-imported, no problems. Hope that helps.

Maybe you are looking for