How Export to CSV format from WDA

Hi masters!
i need to export an ALV table to CSV fromart
i use the following code
  CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
    EXPORTING
      i_field_seperator    = ';'
    TABLES
      i_tab_sap_data       = lt_t_book
    CHANGING
      i_tab_converted_data = lt_t_book_cvs
    EXCEPTIONS
      conversion_failed    = 1
      OTHERS               = 2.
  IF sy-subrc = 0.
    "Download data using GUI_DOWNLOAD
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename = 'C:\Documents and Settings\lucas.mena\Desktop\csv_test.txt'
        filetype = 'ASC'
        CODEPAGE = LC_1160
      TABLES
        data_tab = lt_t_book_cvs.
  ENDIF.
as a result, i have received the following error message: Error in Control Framework
thanks,
Lucas

Hello Luca,
1) First read the table's data into an internal table.
2) Convert the internal table data to STRING format.
3) Now convert it into tab separated format as how desired.
4) Convert this STRING format to XSTRING format
5) Make use of the attach_file_to_response method.
METHOD onactionon_submit .
  DATA: lv_node TYPE REF TO if_wd_context_node,
        lt_mara TYPE if_main=>elements_mara,
        wa_mara TYPE if_main=>element_mara,
        lead_selection_index TYPE i,
        mara_string  TYPE string,
        mara_xstring TYPE xstring.
  lv_node = wd_context->get_child_node( name = 'MARA' ).
  CALL METHOD lv_node->get_static_attributes_table
    IMPORTING
      table = lt_mara.
  LOOP AT lt_mara INTO wa_mara.
    CONCATENATE mara_string
                wa_mara-matnr
                wa_mara-ersda
                wa_mara-ernam
                wa_mara-matkl
                wa_mara-meins
                cl_abap_char_utilities=>cr_lf INTO mara_string
                                        SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
  ENDLOOP.
** Now you need to add the column headers & the desired extra information through coding to
** mara_string
  CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
    EXPORTING
      text   = mara_string
    IMPORTING
      buffer = mara_xstring.
  CL_WD_RUNTIME_SERVICES=>attach_file_to_response(  i_filename  = 'TEMP.XLS'
                                                    i_content   = mara_xstring
                                                    i_mime_type = 'EXCEL' ).
ENDMETHOD.
Regards,
Uday

Similar Messages

  • How export to csv work in safari browser? In my application export to csv open like a raw data in new tab. But other browsers working great!. Need to open in a csv file or save it as a csv file.

    How export to csv work in safari browser?
    In my application export to csv open like a raw data in new tab.
    But other browsers working great!.
    Need to open in a csv file or save it as a csv file.
    Please suggest me. Thank you in advance!.

    Hi Adrian,
    Why don't you try any another software for opening CSV files then Notepad ? According to my experience, you can use these softwares to open an CSV files and they are:-
    Microsoft Excel
    Open Office Calc
    Google Docs
    Also there is an additional tool available known as CSV viewer. You may try this, download it from here http://www.csvviewer.com/
    I've never used Notepad for opening CSV files, because sometimes it contains some symbols which are not not at all compatibile with Notepad.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Help exporting in csv format

    Post Author: Vivek Sharma
    CA Forum: Exporting
    Hello All,
    Version of Crystal Reports: 11.0.0.1282
    Wanted to find out if it is possible to export data from a main report and subreport together in csv format?  So far if I export in csv format it only exports data from main report and not from subreport.
    Thanks,Vivek

    Daniel and Atul highlight the two different kinds of data out processes that Essbase supports: targeted exports of selected parts of the database and full backup/migration-ready exports.
    You didn't state what you were trying to do, but you will want to follow one or the other approach, depending on need. I wouldn't, for instance, use a targetted export to write out the entire db -- it would be very slow (to put it mildly). By the same token, writing out the entire db to a comma delimted columnar file to get 50 records would be a bit of a time waster, too.
    Regards,
    Cameron Lackpour

  • Show user entered date when ssrs report exported to csv format

    Hi All,
    How can I show date range parameter entered by user when ssrs report is exported to csv format.
    my csv output should look like this....
    Date : 01/01/2015 TO 01/31/2015 (user selected dates)
    ID,EmpFirstName,EmpLastName,Location
    1,Tom,Garry,NY
    2,John,Graham,NJ
    3,Ron,Lorrie,CA
    Thanks,
    RH
    sql

    Hi RH,
    You can add two textbox at the top outside the tablix and using expression to get the parameter value use have selected to display in the textbox as blew:
    TextBox1: =Parameters!Date.Value
    TextBox2: =Parameters!To.Value
    For Multiple value parameter you can use the expression like : =Join(Parameters!Date.Value,",")
    You can rename the two textbox' name in the properties as "Date" and "To"  then the two textboxs will display like belkow in the CSV report:
    Date                 TO
    01/01/2015      01/31/2015 
    ID   EmpFirstName    EmpLastName   Location
    1      Tom                  Garry                  NY
    2      John                 Graham               NJ
    3      Ron                   Lorrie                 CA
    If you still have any problem, please feel free to ask.
    Regards
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • How to get Date Format from Local Object.

    Hi All,
    I am new to Web Channel.
    I need to know Date format From date of locale.
    suppose there is a date "01/25/2010" date in date field I want to get string "mm/dd/yyyy". Actually I have to pass date format to backend when I call RFC. 
    Is there any way to get Date format from "Locale" object. I should get date format for local object
    I get local object from "UserSessionData" object but how to get Date format from it.
    I am not looking for Date value. I am looking for current local date format ("mm/dd/yyyy or dd/mm/yyyy or mon/dd/yyyy) whatever local date format.  I could not find example which show how to get date format from "Locale" object.
    Any help will be appreciated with rewards.
    Regards.
    Web Channel

    Hi,
    You can get it from "User" or "Shop" business object.
    Try to get User or Shop Business Object as shown below.
    BusinessObjectManager bom = (BusinessObjectManager) userSessionData.getBOM(BusinessObjectManager.ISACORE_BOM);
    User user = bom.getUser();
    char decimalNotation = user.getDecimalPointFormat().getGroupingSeparator();
    If you are seeing "1,234.00" then above code will return "."
    I hope this information help you to resolve your issue.
    eCommerce Developer.

  • Apply conditional formatting when a report is exported to CSV format

    Hello
    OBIEE dasboard has the option to export the report data to CSV format.
    But the problem is that on some columns of the report, it uses various different types of conditional formatting that tells, what to display when data is equal to one of those edge cases. So hence the report on the dashboard page shows accordingly which is fine.
    But when the report is exported to CSV format, no conditional formatting is applied and all the raw data is shown without any formatting.
    Is there any way to make sure that the conditional formatting is applied even in the data exported to CSV format.
    thanks

    CSV is supposed to be a data dump .. i dont think you can have formatting saved when u download csv file.. try downloading it to excel and changing it to CSV

  • Exporting in Hd format from premiere

    Hello, I hava a really simple question about exporting in Hd format from premiere.
    Proyect:
    Flash ANIMATION (1280x720) at 12 frames, Soundboth AUDIO at 44, 1000 stero, plus lots of incidental on mp3.
    Duration: 4:00 minutes.
    I want to know what is the best way to export this kind of projects into a very small compression, I'm talking about 4mg and still be able to watch the animation at a acceptable compressed quality?

    You'll have to experiment until you get one whose quality and file size are acceptable.

  • EXPORT to text or CSV format from a form

    Dear all,
    Could you please help me to export the data from my form to a text file or to a csv format. I am very new to forms.
    i need to export the data from the oracle form to a text file or CSV file format.
    I had created form named as form1.
    In form1 i have a block named as block1. In this block i have 4fields as field1, field2, field3, field4. using a tabe1 which has the same 4fields.
    This form is in tabular form.
    Example:
    In the form i have data like as below and i got this data from table1. I used a execute query to get the data from the table into this form.
    field1 field2 field3 field4
    raj 1234 abc 510
    dil 777 hi 787
    Now my requirement is i need to export this data into a file, when i click on a button(Export) it has to browse for a folder on my desktop and i have to name the filename to save the data.
    Please help me.
    Thanks in advance.

    This should be almost same as in your previous task for import data.
    Try this:
    DECLARE
       v_file_name   VARCHAR2 (100);
       v_file        client_text_io.file_type;  
       v_delimiter VARCHAR2(1) := ',';
    BEGIN
       v_file_name := webutil_file.file_save_dialog;
       v_file := client_text_io.fopen (v_file_name, 'w');
       GO_BLOCK ('block1');  
       FIRST_RECORD;
       LOOP
            client_text_io.PUT_LINE(v_file, :block1.field1||v_delimiter||:BLOCK1.field2||v_delimiter||:BLOCK1.field3||v_delimiter||:BLOCK1.field4);
        IF :SYSTEM.LAST_RECORD = 'TRUE' THEN
             EXIT;
        END IF;     
        NEXT_RECORD;
       END LOOP;
       client_text_io.fclose (v_file);
    END;

  • How to pass csv data from file into DLL using TestStand

    Hi,
    We have data files which are of CSV format. Each row contains
    about 9 items of data, and have about 5 rows of this data (ie, 5
    test points) :
    eg
    TErrAdd1,UUT,UUT,STM1E,AU4/FR,PRBS23,BIT,10,60
    TErrAdd2,UUT,UUT,STM4O,AU3/UNFR,PRBS15,B1,20,60
    TErrAdd3,UUT,UUT,STM16O,AU4_16C/UNFR,PRBS9,BIT,7,60
    TErrAdd4,UUT,UUT,STM0E,AU3/UNFR,PRBS20,B2,5,60
    TErrAdd5,UUT,UUT,STM64O,AU4_4C/FR,PRBS11,B1,6,60
    What we want to do is to be able to directly pass each
    row of data to a C/C++ DLL. The DLL fn accepts this
    data as a vector of strings.
    eg.
    void DLLTestFn( vector const & configData )
    However, we can write a wrapper for the DLL as I don't
    think TestStand will know about vectors.
    We don't really want to have to hardcode individial references
    to each item of data in TestStand. Is this possible?
    Just read in a row from a data file, and sent it direct
    to the DLL?

    Hi Richardi,
    the principle is quite simple, however, you still need to use a programming language to make the initial file read.
    Once you've done this, you could have it as an array of strings, and pass this directly to a wrapper DLL, which would then pass the data into a string vector.
    Look up the examples\AccessingArrays\PassingArrayParametersToDll\AccessingArrays.seq
    to see how to do this without passing the sequence context.
    If you've read in the details into a container type structure already, then I've made an example which demonstrates this principle and what you'll need to pass it to a vector. (Similar principle can be used to fill in the container when you read the file in the first place.
    You cannot go directly to a vector, since TestStand doesn't understand them.
    Vector classes are difficult to export polymorphically from a DLL since the template class doesn't export, and needs specifically defining. This is what I'm assuming you're ultimately trying to do. (see ref :
    How to Export STL components inside and outside of a class
    I've used VIsual C++ 6 and TestStand 3.0
    Please let me know if this helps to answer your query.
    Thanks
    Sacha Emery
    National Instruments (UK)
    // it takes almost no time to rate an answer
    Attachments:
    for hannah vectors.zip ‏1619 KB

  • How to Generate CSV Output from JD Edwards BI Publisher

    Hi All,
    I have a report "Critical Date Report" - R15611 in JD Edwards 8.11. This report has to be generated as CSV output from BI Publisher which is embedded to JDE.
    The purpose we want use BI Publisher is to move some of the data displaying to different place in the page(ex: Move the company address from top left corner to Bottom right corner).
    In order to achieve this
    1.We created blank rtf template and upload to XML repository using P95600 application
    2.Create report definition using P95620 application
    3.Here I see the available output types as PDF,RTF,HTML,EXCEL,POWERPOINT and XML,ETEXT(GRAYED OUT)
    Which output type we can use for CSV ?
    4.Execute the report definition of the critical date report from P95620 to get the XML source
    5.This XML source will be loaded into the blank rtf template
    6.From this point no idea how to design the rtf template in order to get the CSV output.
    7.We did design and output type as excel - but the result data is not in good formatting and alignment*(Headers and footers are repeating).*
    If any one has worked on similar type of requirement,let us know how to do or send a sample XML source,rtf template and how the CSV output will be. Or any document link present in Oracle site will be helpful. Please let me know if you need more details.
    Thanks in Advance.
    Vijay

    Hi Vijay,
    For CSV output, you need an E-text template (not RTF) that's why its grayed out! You can use Excel as output type and have (No headers and footers) , then you can open the file in Excel and store it as CSV. Does not always display correctly though.
    Why are you compelled to use BI publisher? you can use the JDE standard csv output report, (as is used by most EDI systems) of course this may involve a bit of customization if you wants the fields arranged differently.
    -Domnic

  • How to generate CSV ouput from JD Edwards 8.11 using rtf template

    Hi,
    I have a report "Critical Date Report" - R15611 in JD Edwards 8.11. This report has to be generated as CSV output from BI Publisher which is embedded to JDE. why we choose the output in BI Publisher is to move some of the data displaying to different place in the page(ex: Move the company address from top left corner to Bottom right corner).
    In order to achieve this
    1.We create blank rtf template and upload to XML repository using P95600 application
    2.Create report definition using P95620 application
    3.Here I see the available output types as PDF,RTF,HTML,EXCEL,POWERPOINT and XML,ETEXT(GRAYED OUT)
    Which output type we can use for CSV ?
    4.Execute the report definition of the critical date report from P95620 to get the XML source
    5.This XML source will be loaded into the blank rtf template
    6.From this point no idea how to design the rtf template in order to get the CSV output.
    7.We did design and output types as excel - but the result data is not in good formatting and alignment.
    If anyone has worked on similar type of requirement,let us know how to do or send a sample XML source,rtf template and how the CSV output will be.
    Thanks in Advance.
    Vijay

    Ive replied to your other post.

  • How to upload .CSV file from Application Server

    Hi Experts,
        How to upload .CSV file separated by ',' from Application server to an internal table.
    Invoice No,Cust No,Item Type,Invoice Date,days,Discount Amount,Gross Amount,Sales Amount,Customer Order No.,Group,Pay Terms
    546162,3233,1,9/4/2007,11,26.79,5358.75,5358.75,11264,HRS,11
    546163,2645,1,9/4/2007,11,3.07,305.25,305.25,10781,C,11
    Actually I read some already answered posts. But still I have some doubts.
    Can anybody please send me the code.
    Thanks in Advance.

    Hi Priya,
    Check this code
    Yhe logic used here is as follows,
    Get all the data into an internal table in the simple format ie: a row with one field contains an entire line
    After getting the data, we split each line of the table on every occurrence of the delimiter (comma in your case)
    Here, I have named the fields as field01, field02 etc, you could use your own names according to your requirement
    parameters: p_file(512).
      DATA : BEGIN OF ITAB OCCURS 0,
              COL1(1024) TYPE C,
             END OF ITAB,
             WA_ITAB LIKE LINE OF ITAB.
      DATA: BEGIN OF ITAB_2 OCCURS 0,
        FIELD01(256),
        FIELD02(256),
        FIELD03(256),
        FIELD04(256),
        FIELD05(256),
        FIELD06(256),
        FIELD07(256),
        FIELD08(256),
        FIELD09(256),
        FIELD10(256),
        FIELD11(256),
        FIELD12(256),
        FIELD13(256),
        FIELD14(256),
        FIELD15(256),
        FIELD16(256),
       END OF ITAB_2.
      DATA: WA_2 LIKE LINE OF ITAB_2.
        OPEN DATASET p_FILE FOR INPUT IN TEXT MODE ENCODING NON-UNICODE.
        IF SY-SUBRC = 8.
          WRITE:/ 'File' , p_FILE , 'cannot be opened'.
          LV_LEAVEPGM = 'X'.
          EXIT.
        ENDIF.
        WHILE SY-SUBRC <> 4.
          READ DATASET p_FILE INTO WA_ITAB.
          APPEND WA_ITAB TO ITAB.
        ENDWHILE.
        CLOSE DATASET p_FILE.
      LOOP AT ITAB INTO WA_ITAB.
        SPLIT WA_ITAB-COL1 AT ','    " where comma is ur demiliter
         INTO WA_2-FIELD01 WA_2-FIELD02 WA_2-FIELD03 WA_2-FIELD04
         WA_2-FIELD05 WA_2-FIELD06 WA_2-FIELD07 WA_2-FIELD08 WA_2-FIELD09
         WA_2-FIELD10 WA_2-FIELD11 WA_2-FIELD12 WA_2-FIELD13 WA_2-FIELD14
         WA_2-FIELD15 WA_2-FIELD16.
        APPEND WA_2 TO ITAB_2.
        CLEAR WA_2.
      ENDLOOP.
    Message was edited by:
            Kris Donald

  • Issue while exporting to CSV Format

    Hi,
    Pls help me...
    I have a report when i export that report to CSV format..
    some duplicate rows are coming...
    the two rows are exactly same and both the rows are displaying but i dont need this..
    i need distinct rows..how can i achieve this..
    Thanks in advance

    Hi,
    when i checked the distinct option...error is coming..
    Error
         View Display Error
    Error generating view. Error getting cursor in GenerateHead
    Error Details
    Error Codes: OAMP2OPY:ACIOA5LN
    Assertion failure: getFieldPosByKey(sKey) == n at line 67 of ./project/webquerymanager/customizedsql.cpp

  • Dropping zeros when exported to CSV format

    I formated in Numbers using 5 digit place holder and setting "hide seperator" and "show zeros" This looks perfect in Numbers but when I export to CSV (I want to import the mailing list to AddressBook) it drops the front zero. I tried formating a new column as text and pasting the list into it, but it turned into numerical format and dropped the zero again when exported to CSV. Any suggestions would be appreciated. I can't help but feel I am being stupid. This shouldn't be so difficult.

    I did the following test:
    1) I formatted a column as text and entered several cells worth of 5-digit zip codes that had leading zeros.
    2) I formatted a column with a custom format of five digits, leading zeros, and no separator. I typed in a few numbers with less than five digits and they displayed with leading zeros. No surprise there.
    3) I formatted a column as text and copy/pasted from column in (2) to this text-formatted column. I was actually surprised it kept the leading zeros because the underlying data (a bunch of 3 and 4 digit numbers) does not actually have them.
    4) I exported this file as CSV.
    5) I opened the CSV in TextEdit and the leading zeros were there in all three of these columns.
    This all seems to be working as you would want it to. Am I doing something different than you?
    To complete the test, I opened the CSV with Numbers and it dropped all the leading zeros upon import. But you are not re-importing it into Numbers so this last step wasn't really a fair test.

  • How to create .csv file from ABAP report

    Hi
    We have a requirement to generate .csv file from abap report.
    Currently user saves data from abap report to spreadsheet(.xls format) in desktop.  Then opens excel file and save as .csv format.  Need option to save directly in .csv format instead of .xls format.
    Please let me know, if there is any standard function module available to create .csv file.
    Regards
    Uma

    I tried with your code it's going to dump
    REPORT ZTEMP101 message-id 00.
    tables: lfa1.
    types: begin of t_lfa1,
          lifnr like lfa1-lifnr,
          name1 like lfa1-name1,
          end of t_lfa1.
    data: i_lfa1 type standard table of t_lfa1,
          wa_lfa1 type t_lfa1.
    types truxs_t_text_data(4096) type c occurs 0.
    data: csv_converted_table type table of TRUXS_T_TEXT_DATA.
    select-options: s_lifnr for lfa1-lifnr.
    select lifnr name1 from lfa1 into table i_lfa1
           where lifnr in s_lifnr.
    CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
    EXPORTING
       I_FIELD_SEPERATOR          = ';'
             I_LINE_HEADER              =
             I_FILENAME                 =
             I_APPL_KEEP                = ' '
      TABLES
        I_TAB_SAP_DATA             = I_LFA1
    CHANGING
       I_TAB_CONVERTED_DATA       = csv_converted_table
    EXCEPTIONS
       CONVERSION_FAILED          = 1
       OTHERS                     = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE                  = ' '
      CODEPAGE                      = ' '
       FILENAME                      =
       'C:\Documents and Settings\ps12\Desktop\Test folder\exl.cvs'
      FILETYPE                      = 'DAT'
      MODE                          = ' '
      WK1_N_FORMAT                  = ' '
      WK1_N_SIZE                    = ' '
      WK1_T_FORMAT                  = ' '
      WK1_T_SIZE                    = ' '
      COL_SELECT                    = ' '
      COL_SELECTMASK                = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      TABLES
        DATA_TAB                      = csv_converted_table
      FIELDNAMES                    =
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_WRITE_ERROR              = 2
      INVALID_FILESIZE              = 3
      INVALID_TYPE                  = 4
      NO_BATCH                      = 5
      UNKNOWN_ERROR                 = 6
      INVALID_TABLE_WIDTH           = 7
      GUI_REFUSE_FILETRANSFER       = 8
      CUSTOMER_ERROR                = 9
      OTHERS                        = 10
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    my version is 4.6c

Maybe you are looking for