Problem while downloadind data from ALV in excel format.

Hi Experts,
I have developed one ALV Report.
it have 53 columns. when i tried to download it in excel format using standard functionality, all columns are not coming in one line i.e 50 cloumns in one line and rest columns to the next line.
For Example.
Row 1 Header->    Fld1    Fld2    Fld3   Fld4   Fld5 
                           Fld6    Fld7
Row 2 Values->    Val1    Val2    Val3  Val4   Val5
                           Val6    Val7
how i will get all these 53 columns in one line in EXCEL..
its urget........
Usefull answer will be rewarded...

hi,
there are some specific restrictions in downloading data in alv.
i.e you cannot have morethan 1024 characters that can be downloaded in single row.
so change your report columns accordingly.

Similar Messages

  • Problem while opening data from mysql  in Excel

    Hi friends
    when i try to download data from MySQL to excel sheet I am getting error of
    This file is not in a recognizable format.
    . If you know the file is from another program which is incompatible with Microsoft Office Excel,click Cancel then open this file in its original application.If you want to open the file later in Microsoft Office Excel,save it in a format that is compatible,such as text format.
    etc
    Code is
    Class.forName("org.gjt.mm.mysql.Driver");
    Connection conn = DriverManager.getConnection("xxxxxx");
    Statement st = conn.createStatement();
    StringBuffer sb = new StringBuffer();
    sb.append("SAP#" + "\t");
    sb.append("x-plant status" + "\t");
    sb.append("Total Amount" +"\t");
    sb.append(">90 days" + "\t");
    sb.append("\n");
    try
    String query="select * from temp_Xplant";
    ResultSet rs = st.executeQuery(query);
    while(rs.next()){
    sb.append(rs.getString("sapNo") + "\t");
    sb.append(rs.getString("status")+ "\t");
    sb.append(rs.getString("amt") + "\t");
    sb.append(rs.getString("days") + "\t");
    sb.append("\n");
    conn.close();
    st.close();
    catch (Exception e)
    out.println("error");
    conn.close();
    st.close();
    response.setContentType("application/vnd.ms-excel");
    response.setHeader("Content-Disposition", "attachment; filename=\"test.XLS\"");
    I can open them after clicking OK, but before that it is showing the above error message
    Thank you
    Edited by: priyap on Apr 3, 2008 4:54 AM

    hi,
    there are some specific restrictions in downloading data in alv.
    i.e you cannot have morethan 1024 characters that can be downloaded in single row.
    so change your report columns accordingly.

  • Problem while transfering data from form to excel

    Hi all.
    I have a little problem. I have a procedure that fires on when-button-pressed trigger that goes to current block and download the data into an excel file.
    The block has 2200 records.
    The problem is that if I make the application visible all is ok; if I make the application not visible it remains "append" and nothing happens.
    I'm on developer suite 10g.
    Here is the code:
    PROCEDURE pr_Forms_to_Excel(p_block_name IN VARCHAR2 DEFAULT NAME_IN('system.current_block')) IS
    -- Declare the OLE objects
    application OLE2.OBJ_TYPE;
    workbooks OLE2.OBJ_TYPE;
    workbook OLE2.OBJ_TYPE;
    worksheets OLE2.OBJ_TYPE;
    worksheet OLE2.OBJ_TYPE;
    cell OLE2.OBJ_TYPE;
    range OLE2.OBJ_TYPE;
    range_col OLE2.OBJ_TYPE;
    -- Declare handles to OLE argument lists
    args OLE2.LIST_TYPE;
    -- Declare form and block items
    form_name VARCHAR2(100);
    f_block VARCHAR2(100);
    l_block VARCHAR2(100);
    f_item VARCHAR2(100);
    l_item VARCHAR2(100);
    cur_block VARCHAR2(100) := NAME_IN('system.current_block');
    cur_item VARCHAR2(100) := NAME_IN('system.current_item');
    cur_record VARCHAR2(100) := NAME_IN('system.cursor_record');
    item_name VARCHAR2(100);
    baslik VARCHAR2(100);
    row_n NUMBER;
    col_n NUMBER;
    filename VARCHAR2(100);
    BEGIN
    -- Start Excel
    application:=OLE2.CREATE_OBJ('Excel.Application');
    OLE2.SET_PROPERTY(application, 'Visible', 'TRUE');
    -- Return object handle to the Workbooks collection
    workbooks:=OLE2.GET_OBJ_PROPERTY(application, 'Workbooks');
    -- Add a new Workbook object to the Workbooks collection
    workbook:=OLE2.GET_OBJ_PROPERTY(workbooks,'Add');
    -- Return object handle to the Worksheets collection for the Workbook
    worksheets:=OLE2.GET_OBJ_PROPERTY(workbook, 'Worksheets');
    -- Get the first Worksheet in the Worksheets collection
    -- worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Add');
    args:=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, 1);
    worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Item',args);
    OLE2.DESTROY_ARGLIST(args);
    -- Return object handle to cell A1 on the new Worksheet
    go_block(p_block_name);
    baslik := get_block_property(p_block_name,FIRST_ITEM);
    f_item := p_block_name||'.'||get_block_property(p_block_name,FIRST_ITEM);
    l_item := p_block_name||'.'||get_block_property(p_block_name,LAST_ITEM);
    first_record;
    LOOP
    item_name := f_item;
    row_n := NAME_IN('SYSTEM.CURSOR_RECORD');
    col_n := 1;
    LOOP
    IF get_item_property(item_name,ITEM_TYPE)<>'BUTTON' AND
    get_item_property(item_name,VISIBLE)='TRUE'
    THEN
    -- Set first row with the item names
    IF row_n=1 THEN
    baslik:=NVL(get_item_property(item_name,PROMPT_TEXT),baslik);
    args:=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, row_n);
    OLE2.ADD_ARG(args, col_n);
    cell:=OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', args);
    OLE2.DESTROY_ARGLIST(args);
    OLE2.SET_PROPERTY(cell, 'Value', baslik);
    OLE2.RELEASE_OBJ(cell);
    END IF;
    -- Set other rows with the item values
    args:=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, row_n+1);
    OLE2.ADD_ARG(args, col_n);
    cell:=OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', args);
    OLE2.DESTROY_ARGLIST(args);
    IF get_item_property(item_name,DATATYPE)<>'NUMBER' THEN
    OLE2.SET_PROPERTY(cell, 'NumberFormat', '@');
    END IF;
    OLE2.SET_PROPERTY(cell, 'Value', name_in(item_name));
    OLE2.RELEASE_OBJ(cell);
    END IF;
    IF item_name = l_item THEN
    exit;
    END IF;
    baslik := get_item_property(item_name,NEXTITEM);
    item_name := p_block_name||'.'||get_item_property(item_name,NEXTITEM);
    col_n := col_n + 1;
    END LOOP;
    EXIT WHEN NAME_IN('system.last_record') = 'TRUE';
    NEXT_RECORD;
    END LOOP;
    -- Autofit columns
    range := OLE2.GET_OBJ_PROPERTY( worksheet,'UsedRange');
    range_col := OLE2.GET_OBJ_PROPERTY( range,'Columns');
    OLE2.INVOKE( range_col,'AutoFit' );
    OLE2.RELEASE_OBJ( range );
    OLE2.RELEASE_OBJ( range_col );
    -- Get filename and path
    args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG( args, p_block_name );
    OLE2.ADD_ARG( args,'Excel Workbooks (*.xls, *.xls');
    filename := OLE2.INVOKE_CHAR( application,'GetSaveAsFilename',args );
    OLE2.DESTROY_ARGLIST( args );
    -- Save as worksheet
    IF NVL(filename,'0')<>'0' THEN
    args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG( args,filename );
    OLE2.INVOKE( worksheet,'SaveAs',args );
    OLE2.DESTROY_ARGLIST( args );
    END IF;
    -- Close workbook
    OLE2.INVOKE( workbook ,'Close');
    -- Release the OLE objects
    OLE2.RELEASE_OBJ(worksheet);
    OLE2.RELEASE_OBJ(worksheets);
    OLE2.RELEASE_OBJ(workbook);
    OLE2.RELEASE_OBJ(workbooks);
    OLE2.INVOKE(application, 'Quit');
    OLE2.RELEASE_OBJ(application);
    -- Focus to the original location
    go_block(cur_block);
    go_record(cur_record);
    go_item(cur_block||'.'||cur_item);
    END;
    Is there anyone that can help me????
    Thanks,
    Fabrizio

    Hi all.
    I have a little problem. I have a procedure that fires on when-button-pressed trigger that goes to current block and download the data into an excel file.
    The block has 2200 records.
    The problem is that if I make the application visible all is ok; if I make the application not visible it remains "append" and nothing happens.
    I'm on developer suite 10g.
    Here is the code:
    PROCEDURE pr_Forms_to_Excel(p_block_name IN VARCHAR2 DEFAULT NAME_IN('system.current_block')) IS
    -- Declare the OLE objects
    application OLE2.OBJ_TYPE;
    workbooks OLE2.OBJ_TYPE;
    workbook OLE2.OBJ_TYPE;
    worksheets OLE2.OBJ_TYPE;
    worksheet OLE2.OBJ_TYPE;
    cell OLE2.OBJ_TYPE;
    range OLE2.OBJ_TYPE;
    range_col OLE2.OBJ_TYPE;
    -- Declare handles to OLE argument lists
    args OLE2.LIST_TYPE;
    -- Declare form and block items
    form_name VARCHAR2(100);
    f_block VARCHAR2(100);
    l_block VARCHAR2(100);
    f_item VARCHAR2(100);
    l_item VARCHAR2(100);
    cur_block VARCHAR2(100) := NAME_IN('system.current_block');
    cur_item VARCHAR2(100) := NAME_IN('system.current_item');
    cur_record VARCHAR2(100) := NAME_IN('system.cursor_record');
    item_name VARCHAR2(100);
    baslik VARCHAR2(100);
    row_n NUMBER;
    col_n NUMBER;
    filename VARCHAR2(100);
    BEGIN
    -- Start Excel
    application:=OLE2.CREATE_OBJ('Excel.Application');
    OLE2.SET_PROPERTY(application, 'Visible', 'TRUE');
    -- Return object handle to the Workbooks collection
    workbooks:=OLE2.GET_OBJ_PROPERTY(application, 'Workbooks');
    -- Add a new Workbook object to the Workbooks collection
    workbook:=OLE2.GET_OBJ_PROPERTY(workbooks,'Add');
    -- Return object handle to the Worksheets collection for the Workbook
    worksheets:=OLE2.GET_OBJ_PROPERTY(workbook, 'Worksheets');
    -- Get the first Worksheet in the Worksheets collection
    -- worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Add');
    args:=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, 1);
    worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Item',args);
    OLE2.DESTROY_ARGLIST(args);
    -- Return object handle to cell A1 on the new Worksheet
    go_block(p_block_name);
    baslik := get_block_property(p_block_name,FIRST_ITEM);
    f_item := p_block_name||'.'||get_block_property(p_block_name,FIRST_ITEM);
    l_item := p_block_name||'.'||get_block_property(p_block_name,LAST_ITEM);
    first_record;
    LOOP
    item_name := f_item;
    row_n := NAME_IN('SYSTEM.CURSOR_RECORD');
    col_n := 1;
    LOOP
    IF get_item_property(item_name,ITEM_TYPE)<>'BUTTON' AND
    get_item_property(item_name,VISIBLE)='TRUE'
    THEN
    -- Set first row with the item names
    IF row_n=1 THEN
    baslik:=NVL(get_item_property(item_name,PROMPT_TEXT),baslik);
    args:=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, row_n);
    OLE2.ADD_ARG(args, col_n);
    cell:=OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', args);
    OLE2.DESTROY_ARGLIST(args);
    OLE2.SET_PROPERTY(cell, 'Value', baslik);
    OLE2.RELEASE_OBJ(cell);
    END IF;
    -- Set other rows with the item values
    args:=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, row_n+1);
    OLE2.ADD_ARG(args, col_n);
    cell:=OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', args);
    OLE2.DESTROY_ARGLIST(args);
    IF get_item_property(item_name,DATATYPE)<>'NUMBER' THEN
    OLE2.SET_PROPERTY(cell, 'NumberFormat', '@');
    END IF;
    OLE2.SET_PROPERTY(cell, 'Value', name_in(item_name));
    OLE2.RELEASE_OBJ(cell);
    END IF;
    IF item_name = l_item THEN
    exit;
    END IF;
    baslik := get_item_property(item_name,NEXTITEM);
    item_name := p_block_name||'.'||get_item_property(item_name,NEXTITEM);
    col_n := col_n + 1;
    END LOOP;
    EXIT WHEN NAME_IN('system.last_record') = 'TRUE';
    NEXT_RECORD;
    END LOOP;
    -- Autofit columns
    range := OLE2.GET_OBJ_PROPERTY( worksheet,'UsedRange');
    range_col := OLE2.GET_OBJ_PROPERTY( range,'Columns');
    OLE2.INVOKE( range_col,'AutoFit' );
    OLE2.RELEASE_OBJ( range );
    OLE2.RELEASE_OBJ( range_col );
    -- Get filename and path
    args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG( args, p_block_name );
    OLE2.ADD_ARG( args,'Excel Workbooks (*.xls, *.xls');
    filename := OLE2.INVOKE_CHAR( application,'GetSaveAsFilename',args );
    OLE2.DESTROY_ARGLIST( args );
    -- Save as worksheet
    IF NVL(filename,'0')<>'0' THEN
    args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG( args,filename );
    OLE2.INVOKE( worksheet,'SaveAs',args );
    OLE2.DESTROY_ARGLIST( args );
    END IF;
    -- Close workbook
    OLE2.INVOKE( workbook ,'Close');
    -- Release the OLE objects
    OLE2.RELEASE_OBJ(worksheet);
    OLE2.RELEASE_OBJ(worksheets);
    OLE2.RELEASE_OBJ(workbook);
    OLE2.RELEASE_OBJ(workbooks);
    OLE2.INVOKE(application, 'Quit');
    OLE2.RELEASE_OBJ(application);
    -- Focus to the original location
    go_block(cur_block);
    go_record(cur_record);
    go_item(cur_block||'.'||cur_item);
    END;
    Is there anyone that can help me????
    Thanks,
    Fabrizio

  • Problem while retrving data from a view

    Hi Friends
      i have a problem while retriving data from a view <b>v_t685a</b>.
    the error message is :""" "V_T685A" is not defined in the ABAP Dictionary as a table, projection view or database view."""
    i wrote : select single VTEXT1 from V_T685A into w_cst_jin1 where
                        KSCHL = 'JIN1' and
                        KAPPL = 'V'.
    how to retrive the data.
    waiting for quick response
    Regards
    Mukesh

    Hi
    This is a Maintenance View, not a Database View
    SO can't fetch data using select statement.
    You can use the Table <b>T685</b> directly to fetch the condition Types data straight away instead of the view. write the same select for this table and use.
    Regards
    Anji
    Message was edited by:
            Anji Reddy Vangala

  • Problem while loading data from ODS to infoobject

    Hi guys,
    I am facing problem while loading data from <b>ODS to infoobject</b>.
    If I load data via PSA it works fine but
    if I load data without PSA its giving error as Duplicate records.
    Do u have any idea why it is so.
    Thanks in advance
    savio

    Hi,
    when you load the data via the PSA, what did you select? Serial or Paralel?
    If you select serial most likely you don't have duplicates within the same datapackage and your load can go through.
    Loading directly in the IObj will happen thefore if you have the same key in two different packages, the "duplicate records" will be raised; you can perhaps flag your IPack with the option "ignore duplicate records" as suggested...
    hope this helps...
    Olivier.

  • Problem while reading data from Serial Port

    Hi All,
    I am facing some problem while reading data from Serial Port.
    As per the requirement I am writing the data on Serial Port and waiting for response of that data.
    Notification for data availabilty is checked with method public void serialEvent(SerialPortEvent event) of javax.comm.SerialPortEventListener.
    When we are writing data on the port one thread i.e. "main" thread is generated and when data availability event occures another thread "Win32SerialPort Notification thread" is generated. This creates problem for me as we can't control thread processing.
    So can anybody pls explain me how to overcome this problem?
    Regards,
    Neha

    My Problem is:-
    I am simoultaneouly wrting data on port & reading data from port.
    First I write data on port using outputStream.write() method. Now when target side sends me response back for the request on serial port DATA_AVAILABLE of SerialPortEventListner event occured,we are reading data from serial port.Now till the time we didn't get the response from target next command can't be written on the serial port. When we are writing data on port main thread is executed.Now my problem starts when DATA_AVAILABLE event occured.At this point another thread is created.Due to this my program writes data of next command without reading response of previous command.To solve this prob. I have used wait() & notify() methods as follows.But again due to this my pc hangs after execution of 2 commands. (PC hang in while loop in a code provided below.)
    From SOPs I could figure it out that after 2 commands we are not able to write data on serial port so DATA_AVAILABLE event doesn't occure n pro. goes in wait state.
    Can anybody help me to solve this issue.
    Neha.
    Code:
    public void serialEvent(SerialPortEvent event)
              switch (event.getEventType())
                   case SerialPortEvent.BI:
                   case SerialPortEvent.OE:
                   case SerialPortEvent.FE:
                   case SerialPortEvent.PE:
                   case SerialPortEvent.CD:
                   case SerialPortEvent.CTS:
                   case SerialPortEvent.DSR:
                   case SerialPortEvent.RI:
                   case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
                                 break;
                   case SerialPortEvent.DATA_AVAILABLE:
                        try
                             dataThread = Thread.currentThread();
                             dataThread.setPriority(10);
                             dataAvailable = true;
                                                                                    byte[] tempArray=new byte[availableBytes];
                                        inputStream.read(tempArray);
                                                                       catch (IOException io)
                             SOP(io, "Error in serialEvent callback call for event DATA_AVAILABLE");
    public void  writetoPort(byte[] data) throws IOException
                             outputStream.write(data);
                              while(finalTimeOut >= actualTime)
                            if( ! dataAvailable)
                                    actualTime = System.currentTimeMillis();
                           else
              synchronized (mainThread)
                   mainThread = Thread.currentThread();
                   mainThread.wait();
    public  void sendDatatoUser(byte[] b) throws Exception, HWCCSystemFailure
              obj.returnData(b);
              synchronized(mainThread)
                   mainThread.notify();
                                                           

  • CL_SALV_BS_TT_RESULT_TABLE====CP error while downloading data from ALV grid

    Hi ,
    I am  facing a problem when ever i am going to donload data from ALV grid to excel file.I am getting CL_SALV_BS_TT_RESULT_TABLE====CP error in GET_CELL_VALUE. Could you please provide me is there any OSS note or any patch required to solve this issue.
    Thanks in Advance,
    Venkatarao.

    Hi,
    Just refer to OSS note 1356898 for guidelines.
    Regards,
    Vasanth

  • Download data from ALV to excel issue

    Hi All,
    Could you please tell me if there has any restriction on ALV grid data download to excel? I've a report contains 68 columns and about 500 rows, I want to download the data using the standard menu list->export->save to local file. but after I download them, I found the first 65 columns display in one line and the rest columns display in next line, just like ALV do not allow too many characters in one row and have to switch to new line. I can hide some columns but it's very strange that even after i hide 3 columns to fit the 500 rows download, then if the rows increase, the same problem occurs.
    I searched the forum and in the thread Re: Export ALV in EXCEL Issue Mr. Suvajit provided a solution by using menu List->export->spreadsheet, it looks very good. But I still want to know how this happen and is there a standard way to download data with more than 65 columns to local file with extension .xls so that user can open it directly?
    PS: I'm using FM REUSE_ALV_GRID_DISPLAY and the SAP version is SAP ECC6 with kernal package SAPKB70103.
    Thank you very much.
    Best Regards,
    Jeff
    Edited by: Jeff_liu_2010 on Mar 10, 2011 7:21 AM

    Hi Jeff,
    Please check if following analysis is helpful to you.
    Analysis/Solution:
    When we export ALV data to excel worksheet, as sap notes say the maximum lenght allowed is 1023 charaters and the max no of columns supported is 90.
    (I never faced any issue related to no of columns as it worked fine for columns >90 too)
    Issue occured when row size of exported data gets more than 1023 character.
    Therefore the row data must not exceed 1023 character, otherwise column splits and moves to next row.
    One additional aspect generally missed is that:
    When data in any particular column changes it's length, alv header also changes its lengh (short text, medium text, long text; depending on the length of of the longest cell in the column)
    therefore even if you have total length of row less than 1023 character, there might be cases when your ALV header size exceeds this length.
    Reducing the header size (by forcing to use short text or specifying own header names) should resolve the issue.
    Regards,
    Parveen

  • Problem while reading data from AL11

    Hi Experts,
    I am using OPEN DATASET
                          READ DATASET
                      CLOSE DATASET  to read data from the application sever. In application sever the file type is .CSV. So after reading data from application layer(AL11) to a text variable,  using statement ' SPLIT AT ','  ' all the values passing into correspoding internal table fields. And it getting updated successfully into DB also.
    In above scenario my question is, if aquantity figure with coma seperator( 95,000,000.000), then while SPLIT it's creating problem. Same case in .XLS file, it will be created # seperator in the application layer. if any field having # then it will create problem again.
    So can anybody suggest how can we over come the problem. Or is there any other way to read data properly from application layer(AL11)?
    Thanks and regards,
    Phani.

    to overcom this problem,
    normally we use tab as sparator
    so use CL_ABAP_CHAR_UTILITIES=>VERTICAL_TAB  to separate your fields!
    grx
    Andreas

  • Error while exporting data from ABAP to Excel

    Hello All,
    iam trying to download data from ABAP scrn to Excel using I_OI_SPREADSHEET METHODS. I get an error in method 'SET_RANGES_DATA' - 'Memory protection fault occurred in document interface'.
    I have pasted my code below. Kindly help me to solve this issue.
    Create container ??
      CALL METHOD c_oi_container_control_creator=>get_container_control
        IMPORTING
          control = g_control
          error   = g_error.
    Initialize
      CALL METHOD g_control->init_control
        EXPORTING
          r3_application_name      = 'Basis'
          parent                   = g_container
         register_on_close_event  = c_reg_on_close_event
         register_on_custom_event = c_reg_on_custom_event
         no_flush                 = c_no_flush
        IMPORTING
          error                    = g_error.
    Set Doc type
      g_document_type = 'Excel.Sheet'.
    Create Proxy
      CALL METHOD g_control->get_document_proxy
        EXPORTING
          document_type  = g_document_type
        IMPORTING
          document_proxy = g_document
          error          = g_error.
      CALL METHOD g_document->create_document
        EXPORTING
          document_title = 'Excel'.                             "#EC NOTEXT
      CALL METHOD g_document->get_spreadsheet_interface
        IMPORTING
          sheet_interface = g_handle.
      CHECK g_document IS NOT INITIAL.
    read selected line data from gtab
      READ TABLE g_tab_data INDEX 1  INTO l_wa_pos_trans.
    Get Field Descriptions
      CALL FUNCTION 'DDIF_FIELDINFO_GET'
        EXPORTING
          tabname        = 'TRIGS_EXPORT_EXCEL'
          langu          = sy-langu
        TABLES
          dfies_tab      = lt_dfies
        EXCEPTIONS
          not_found      = 1
          internal_error = 2
          OTHERS         = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Header for User Data
      l_h_cnt  = 1.
      LOOP AT lt_dfies INTO lwa_dfies.
        IF lwa_dfies-fieldname EQ 'USER_ID'          OR
           lwa_dfies-fieldname EQ 'EXCEL_DATE'       OR
           lwa_dfies-fieldname EQ 'EXCEL_TIME'       OR
           lwa_dfies-fieldname EQ 'SECURITY_ACCOUNT' OR
           lwa_dfies-fieldname EQ 'SECURITY_ID'      OR
           lwa_dfies-fieldname EQ 'COMPANY_CODE'.
          PERFORM fill_cell USING l_h_cnt 1 1 lwa_dfies-scrtext_m.
          l_h_cnt  =  l_h_cnt  + 1.
        ENDIF.
      ENDLOOP.
    Fill Header Values
      PERFORM fill_cell USING 1 2 1 sy-uname.
      PERFORM fill_cell USING 2 2 1 sy-datum.
      PERFORM fill_cell USING 3 2 1 sy-uzeit.
      PERFORM fill_cell USING 4 2 1 l_wa_pos_trans-company_code .
      PERFORM fill_cell USING 5 2 1 l_wa_pos_trans-security_account.
      PERFORM fill_cell USING 6 2 1 l_wa_pos_trans-security_id.
    Texts
    l_h_cnt = l_h_cnt + 1.
      PERFORM fill_cell USING l_h_cnt 1 1 text-011.
      PERFORM fill_cell USING l_h_cnt 3 1 text-012.
    Range for header
      range_item-name = 'RANGE1'.
      range_item-rows = '7'.
      range_item-columns = '3'.
      range_item-code = g_handle->spreadsheet_insertall.
      APPEND range_item TO range_list.
      CALL METHOD g_handle->set_selection
        EXPORTING
          left    = 1
          top     = 1
          rows    = 7
          columns = 3
        IMPORTING
          retcode = retcode.
      CALL METHOD g_handle->insert_range
        EXPORTING
          columns = 3
          rows    = 7
          name    = 'RANGE1'
        IMPORTING
          retcode = retcode.
      CALL METHOD g_handle->set_ranges_data
        EXPORTING
          ranges   = range_list
          contents = gt_cell_data
        IMPORTING
          retcode  = retcode.
    Columns for PC
      CLEAR: gt_cell_data[].
      l_pc_cnt  = l_h_cnt + 1.
      LOOP AT lt_dfies INTO lwa_dfies.
        IF lwa_dfies-fieldname EQ 'SBWHR' OR
           lwa_dfies-fieldname CP '_PC'.
          PERFORM fill_cell USING l_pc_cnt 1 0 lwa_dfies-scrtext_m.
          l_pc_cnt =  l_pc_cnt + 1.
        ENDIF.
      ENDLOOP.
    Pos Curr - Values
      PERFORM fill_cell USING 9 2 0  trls_position_value-sbwhr.
      PERFORM fill_cell USING 10 2 0 trls_position_value-purch_pc.
      PERFORM fill_cell USING 11 2 0 trls_position_value-charge_pc.
      PERFORM fill_cell USING 12 2 0 trls_position_value-impmnt_pc.
      PERFORM fill_cell USING 13 2 0 trls_position_value-amort_pc.
      PERFORM fill_cell USING 14 2 0 trls_position_value-val_ti_pc.
      PERFORM fill_cell USING 15 2 0 trls_position_value-val_idx_pc.
      PERFORM fill_cell USING 16 2 0 trls_position_value-val_ch_ti_pc.
      PERFORM fill_cell USING 17 2 0 trls_position_value-val_ti_npl_pc.
      PERFORM fill_cell USING 18 2 0 trls_position_value-val_idx_npl_pc.
      PERFORM fill_cell USING 19 2 0 trls_position_value-val_ch_ti_npl_pc.
      PERFORM fill_cell USING 20 2 0 trls_position_value-book_val_pc.
    Columns for VC
      l_vc_cnt = l_h_cnt + 1.
      LOOP AT lt_dfies INTO lwa_dfies.
        IF lwa_dfies-fieldname EQ 'SBWHR' OR
             lwa_dfies-fieldname CP '_VC'.
          PERFORM fill_cell USING l_vc_cnt 3 0 lwa_dfies-scrtext_m.
          l_vc_cnt =  l_vc_cnt + 1.
        ENDIF.
      ENDLOOP.
    Val Curr
      PERFORM fill_cell USING 9 4 0  trls_position_value-svwhr.
      PERFORM fill_cell USING 10 4 0 trls_position_value-purch_vc.
      PERFORM fill_cell USING 11 4 0 trls_position_value-charge_vc.
      PERFORM fill_cell USING 12 4 0 trls_position_value-impmnt_vc.
      PERFORM fill_cell USING 13 4 0 trls_position_value-amort_vc.
      PERFORM fill_cell USING 14 4 0 trls_position_value-val_ti_vc.
      PERFORM fill_cell USING 15 4 0 trls_position_value-val_fx_vc.
      PERFORM fill_cell USING 16 4 0 trls_position_value-val_idx_vc.
      PERFORM fill_cell USING 17 4 0 trls_position_value-val_ch_ti_vc.
      PERFORM fill_cell USING 18 4 0 trls_position_value-val_ch_fx_vc.
      PERFORM fill_cell USING 19 4 0 trls_position_value-val_fx_npl_vc.
      PERFORM fill_cell USING 20 4 0 trls_position_value-val_ti_npl_vc.
      PERFORM fill_cell USING 21 4 0 trls_position_value-val_idx_npl_vc.
      PERFORM fill_cell USING 22 4 0 trls_position_value-val_ch_ti_npl_vc.
      PERFORM fill_cell USING 23 4 0 trls_position_value-val_ch_fx_npl_vc.
      PERFORM fill_cell USING 24 4 0 trls_position_value-book_val_vc.
    Range for PC and VC
      CLEAR: range_list[].
      range_item-name = 'RANGE2'.
      range_item-rows = '17'.
      range_item-columns = '4'.
      range_item-code = g_handle->spreadsheet_insertall.
      APPEND range_item TO range_list.
      CALL METHOD g_handle->set_selection
        EXPORTING
          left    = 1
          top     = 9
          rows    = 17
          columns = 4
        IMPORTING
          retcode = retcode.
      CALL METHOD g_handle->insert_range
        EXPORTING
          columns = 4
          rows    = 17
          name    = 'RANGE2'
        IMPORTING
          retcode = retcode.
      CALL METHOD g_handle->set_ranges_data
        EXPORTING
          ranges   = range_list
          contents = gt_cell_data
        IMPORTING
          retcode  = retcode.
    ***********************************Form routine****************
    FORM fill_cell USING i j bold val.
      DATA:
       wa_cell_data TYPE soi_generic_item.
      wa_cell_data-row = i.
      wa_cell_data-column = j.
      wa_cell_data-value = val.
      APPEND wa_cell_data TO gt_cell_data.
    ENDFORM.                    "FILL_CELL

    Solved

  • Problem while reading data  from USB with JSR80

    Hi
    Iam using Fedora 9 with 32 bit.
    Iam using JSR80 api to read the data from USB devices.
    I successfully set-up the code as per given on JSR80 site on my eclipsce ide.
    below is my code which iam using to read data from usb
    import com.ibm.jusb.*;
    import java.util.List;
    import javax.usb.*;
    import java.util.List;
    public class USBReader {
    public static  UsbInterface interf = null;
         public static void main(String[] args) {
              try
            {// Access the system USB services, and access to the root
             // hub. Then traverse through the root hub.
               System.out.println("Application started");
             UsbServices services = UsbHostManager.getUsbServices();
             UsbHub rootHub = services.getRootUsbHub();
             traverse(rootHub);
             testIO(rootHub);
            } catch (Exception e) {
                 System.out.println("The Exception occured"+e.getMessage());
          public static void traverse(UsbDevice device){
               System.out.println("Iam in traverse ");
               if (device.isUsbHub()){  
                    // This is a USB Hub, traverse through the hub.
                    System.out.println("The device is hub");
                    List attachedDevices = ((UsbHub) device).getAttachedUsbDevices();
                    System.out.println("The attached devices size:"+attachedDevices.size());
                    for (int i=0; i<attachedDevices.size(); i++){
                         traverse((UsbDevice) attachedDevices.get(i));
                    if(attachedDevices !=null){
                         for(int j=0;j<attachedDevices.size();j++){
                              System.out.println("The device is"+attachedDevices.get(j));
           else{
              // This is a USB function, not a hub.
              // Do something.
                System.out.println("The device is not hub");
          public static void testIO(UsbDevice device) throws UsbClaimException, UsbNotActiveException, UsbDisconnectedException, UsbException{
               System.out.println("Iam in testIO");
              try{
                 // Access to the active configuration of the USB device, obtain
                 // all the interfaces available in that configuration.
                 UsbConfiguration config = device.getActiveUsbConfiguration();
                 List totalInterfaces = config.getUsbInterfaces();
                 System.out.println("The Total interfaces: "+totalInterfaces.size());
                 // Traverse through all the interfaces, and access the endpoints
                 // available to that interface for I/O.
                 for (int i=0; i<totalInterfaces.size(); i++){
                    interf = (UsbInterface) totalInterfaces.get(i);
                    System.out.println("The interfaces are "+totalInterfaces.get(i));
                    String strinf=interf.getInterfaceString();
                    System.out.println("Claimed Status: "+interf.isClaimed());
                    System.out.println("Active status : "+interf.isActive());
                    System.out.println("Settings :"+interf.getNumSettings());
                    //interf.release();
                    interf.claim();
                    List totalEndpoints = interf.getUsbEndpoints();
                    for (int j=0; j<totalEndpoints.size(); j++){
                       // Access the particular endpoint, determine the direction
                       // of its data flow, and type of data transfer, and open the
                       // data pipe for I/O.
                       UsbEndpoint ep = (UsbEndpoint) totalEndpoints.get(i);
                       int direction = ep.getDirection();
                       int type = ep.getType();
                       UsbPipe pipe = ep.getUsbPipe();
                       pipe.open();
                       // Perform I/O through the USB pipe here.
                       pipe.close();
                    interf.release();
              } catch (Exception e) {
                   System.out.println("Exception in TestIO"+e.getMessage());
                   e.printStackTrace();
    }When i execute the above code i get the following exception
    Exception in TestIOCannot claim an interface on a virtual root hub.
    javax.usb.UsbException: Cannot claim an interface on a virtual root hub.
         at com.ibm.jusb.VirtualRootUsbHubImp$VirtualRootUsbInterfaceOsImp.claim(VirtualRootUsbHubImp.java:143)
         at com.ibm.jusb.os.DefaultUsbInterfaceOsImp.claim(DefaultUsbInterfaceOsImp.java:54)
         at com.ibm.jusb.UsbInterfaceImp.claim(UsbInterfaceImp.java:109)
         at com.ibm.jusb.UsbInterfaceImp.claim(UsbInterfaceImp.java:83)
         at USBReader.testIO(USBReader.java:60)
         at USBReader.main(USBReader.java:15)iam not getting the clue for it .

    Cannot claim an interface on a virtual root hubSo don't do that? I have no idea how to tell, but clearly you need to test a few more attributes before you claim. Or else just log the claim error and continue with the next interface.

  • Problem while Fetchign data from

    Hi,
    I am fetching the  data from table CDHDR but though there exists data in the database table, the select query is giving 0 Entries..Please look into my code.
    SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr,                "Account Number of Vendor or Creditor
                    s_kunnr FOR kna1-kunnr,                "Customer Number
                    s_bp    FOR but000-partner,            "Business Partner
                    s_udate FOR cdhdr-udate OBLIGATORY.    "Create/Change Date
    TYPES: BEGIN OF ty_cdhdr_v,
           MANDANT    type MANDT,         "Client
           objectclas TYPE cdobjectcl,    "Object class
           objectid   TYPE cdobjectv,     "Object value
           changenr   TYPE cdchangenr,    "Document change number
           username   TYPE cdusername,    "User name of the person responsible in change document
           udate      TYPE cddatum,       "Creation date of the change document
           tcode      TYPE cdtcode,       "Transaction in which a change was made
           langu      TYPE langu,         "Language Key
           END OF ty_cdhdr_v.
    DATA : it_cdhdr_v TYPE STANDARD TABLE OF ty_cdhdr_v.
    start-of-selection.
    Get data from CDHDR for Vendors
      SELECT MANDANT        "Client
             objectclas     "Object class
             objectid       "Object value
             changenr       "Document change number
             username       "User name of the person responsible in change document
             udate          "Creation date of the change document
             tcode          "Transaction in which a change was made
             langu          "Language Key
               INTO TABLE it_cdhdr_v
               FROM cdhdr
               WHERE objectclas EQ 'KRED'
                 AND objectid   EQ s_lifnr
                 AND udate      EQ s_udate
                 AND tcode      IN ('XK01','XK02')
                 AND langu      EQ sy-langu.
    Regards,
    Deepthi.

    Get data from CDHDR for Vendors
      SELECT MANDANT        "Client
             objectclas     "Object class
             objectid       "Object value
             changenr       "Document change number
             username       "User name of the person responsible in change document
             udate          "Creation date of the change document
             tcode          "Transaction in which a change was made
             langu          "Language Key
               INTO TABLE it_cdhdr_v
               FROM cdhdr
               WHERE objectclas EQ 'KRED'
                 AND objectid   IN s_lifnr
                 AND udate      IN s_udate
                 AND tcode      IN ('XK01','XK02')
                 AND langu      EQ sy-langu.

  • Download data from memory to Excel format.

    Hi Gurus,
        How can I download data from Memory( not in application server ) to Excel format ? Now I am using below function modules  but not coming in proper format.
    CALL FUNCTION 'LIST_FROM_MEMORY'
           TABLES
                listobject = listobject
           EXCEPTIONS
                OTHERS     = 1.
    CALL FUNCTION 'LIST_TO_ASCI'      "report to ASCII text
             TABLES
                  listasci           = listasci
                  listobject         = listobject
             EXCEPTIONS
                  empty_list         = 1
                  list_index_invalid = 2
                  OTHERS             = 3.

    Hi,
    use this function module.
    CALL FUNCTION  'SAPGUI_PROGRESS_INDICATOR'
    Regards,
    NNR.

  • Problem in exporting data from alv output to excel

    Hi,
    I had developed  a report which has ALV report output.It is working fine and i am facing problem that when i am exporting it to the data to excel,it is not displaying the whole data in it. I am using reuse_alv_grid_display function module.
    Waiting for a positive response.
    Thanks & Regards,
    Rickky
    Moderator Message: FAQ. Please search for available information before posting.
    Edited by: kishan P on Nov 8, 2010 12:34 PM

    It is highly likely that the way you have built your field catalog is causing some data to drop on the export to excel. I have had this problem before. Check the fields in your fieldcat that are not working vs the ones that are working.

  • Reg : export data from ALV to excel file

    Hi All,
    I am using REUSE_ALV_GRID_DISPLAY to display the output. I have total 73 columns getting displayed in output but when i export the data to the excel file using (ctrlshiftF9) I am getting only first 43 columns in the first row and from 44th column on wards the data is populated in the 1st  column of second row.
    Please let me know is there any particular setting by which I can get all the 73 columns in a single row.
    Thanks in advance.
    VIJAY

    Hi vijay,
    You can try setting your line width to 255 in your abap program.
    Otherwise,  you can try an alternative:
    1. Put a customize button on the ALV toolbar.
    2. Go to se41 to create th buttons
    2. do i_callback_program in ALV function. or SET PF_STATUS
    3. Then in sy-ucomm, use 'GUI_DOWNLOAD' to xls.
    Hope this helps you.
    Thanks
    William Wilstroth
    Edited by: william wilstroth on Dec 18, 2007 5:06 PM

Maybe you are looking for