Multiple lines in a cell in excel download

Hi,
I have used insert_full of i_oi_spreadsheet interface for downloading internal table.. i have a text field which i need to display in multiple lines in one cell.
Is that possible? Please help,
Regards,
Rohit.

Rohit,
Clipboard this code into your editor and see if it helps you out.  Please reward points.
*& Report  ZR_SANDBOX_PROG
REPORT Zsandbox_prog .
INCLUDE OLE2INCL.
DATA: hExcel TYPE OLE2_OBJECT,      " Excel object
      hWorkBooks TYPE OLE2_OBJECT,  " list of workbooks
      hWorkbook TYPE OLE2_OBJECT,   " workbook
      hSheet TYPE OLE2_OBJECT,      " worksheet object
      hRange TYPE OLE2_OBJECT,      " range object
      hRange2 TYPE OLE2_OBJECT,      " range object
      hBorders TYPE OLE2_OBJECT,    " Border object
      hInterior TYPE OLE2_OBJECT,   " interior object - for coloring
      hColumn TYPE OLE2_OBJECT,     "column
      hCell TYPE OLE2_OBJECT,       " cell
      hFont TYPE OLE2_OBJECT,       " font
      hSelected TYPE OLE2_OBJECT,   " range object
      hPicture TYPE OLE2_OBJECT,    "picture object
      hLogo TYPE OLE2_OBJECT.       "Logo object
types:  begin of t_Excel,
          Period_Literal(20),
          Pd_Wk_Literal(20),
          Coop_Literal(40),
          Sugg_Price(20),
          Cost(20),
          Margin(20),
          Comments(100),
        end of t_Excel.
data: r_Excel type t_Excel.
data: i_Excel type table of t_Excel with header line.
field-symbols: <Val> type any.
data: col_Cnt type i.
data: row_Cnt type i.
data: l_range(30).
  parameters: wraptext as checkbox.
  CREATE OBJECT hExcel 'EXCEL.APPLICATION'.
  PERFORM ERR_HDL.
get list of workbooks, initially empty
  CALL METHOD OF hExcel 'Workbooks' = hWorkbooks.
  PERFORM ERR_HDL.
add a new workbook
  CALL METHOD OF hWorkbooks 'Add' = hWorkbook.
  PERFORM ERR_HDL.
Get Worksheet object.
  get property of hWorkbook 'ActiveSheet' = hSheet.
  SET PROPERTY OF hExcel  'Visible' = 1.
  row_cnt = 1.  col_cnt = 1.
  do 5 times.
    Perform Load_Dummy_Values.
  enddo.
*Pass the internal table values to the spreadsheet.
  loop at i_Excel into r_Excel.
    do 7 times.
      assign component sy-index of STRUCTURE r_excel TO <Val>.
      PERFORM Fill_The_Cell USING row_cnt col_cnt 0 <Val>.
      col_cnt = col_cnt + 1.      "increment column
    enddo.
    row_cnt =   row_cnt + 1.    "increment row
    col_cnt = 1.                  "reset column to A (ie. col 1)
  endloop.
  if not WrapText is initial.
    move 'G:G' to l_range.
    CALL METHOD OF hExcel 'RANGE' = hRange EXPORTING #1 = l_range.
    set property of hRange 'WrapText' = 1.
  endif.
Release excel.
  FREE OBJECT hExcel.
  PERFORM ERR_HDL.
FORM Fill_The_Cell USING I J BOLD TheValue.
  CALL METHOD OF hExcel 'Cells' = hCell EXPORTING #1 = I #2 = J.
  PERFORM ERR_HDL.
  SET PROPERTY OF hCell 'Value' = TheValue.
  PERFORM ERR_HDL.
  GET PROPERTY OF hCell 'Font' = hFont.
  PERFORM ERR_HDL.
  SET PROPERTY OF hFont 'Bold' = BOLD.
  PERFORM ERR_HDL.
ENDFORM.
*&      Form  ERR_HDL
      outputs OLE error if any
-->  p1        text
<--  p2        text
FORM ERR_HDL.
  IF SY-SUBRC <> 0.
    message i000(zz) with 'OLE Automation error: ' SY-SUBRC.
    exit.
  ENDIF.
ENDFORM.                    " ERR_HDL
Form Load_Dummy_Values.
  r_excel-Period_Literal = 'Period 1'.
  r_excel-Pd_Wk_Literal = 'P1 / Wk1'.
  r_excel-Coop_Literal = 'Promo Event'.
  r_excel-Sugg_Price = '$ 1.25'.
  r_excel-Cost  = '$ 0.50'.
  r_excel-Comments =
   'This is a really long field with one hundred bytes to it.'.
  append r_excel to i_Excel.
EndForm.

Similar Messages

  • How do i add multiple lines in a cell (like a list) in Excel for MAC?

    I'm trying to add multiple lines (in the form of a list) in a individual cell in Excel for MAC.  I used ALT Enter on my PC but that doesn't work on the iMac.  Does anyone know how to do this?
    Thanks!

    It's been a while but I think you hold SHIFT while typing a page break (RETURN) to make a new line without shifting to another cell.
    However, as Excel isn't an Apple product, I am sure you will get a faster and more current answer by using Microsoft's Office:Mac forums here:
    Office for Mac forums
    They are very good.

  • How do I add multiple lines to a cell

    I am trying to create an assignment sheet in Numbers. I am using the "Schedule" template. Under each day of the week, I want to add daily assignments. But each assignment may need multiple lines. In the screenshot below, I want to add another line under "Genesis 5" but still have it within the same cell. How can I do that?

    I do extensive research  build on the work of others

  • How to display a long text with several in multiple lines in template cell

    Hi,
       here i have one string such as 'Power MOS_TestTestTest'. But it will display in the template cell as
       'Power
       MOS_TestTestTest'.
       And what i want is 'Power MOS_TestTes
                                   tTest'.
      How to achieve this ? ths

    Hi,
    If the Width of the Templete in not sufficient to display whole text then from the next word it is dislpayed in the next line. As in your case ..
    'Power
    MOS_TestTestTest'.
    If you want to have this like
    'Power MOS_TestTes
    tTest'.
    You need to write the logic to split the string as per your rquirement and print them.

  • Swing Problem : Wrap Multiple line in a Cell (JTable)

    Hello...
    I'm doing a swing app. The functions included are to print the Jtable...
    in Colum 3 i've applied wrapping word in a cell.. the problem is when i print the table, the border in column 3 which wrap the word will not be visible...y?how can i solve this problem...can see my code like below
    MyCellRenderer cellRenderer = new MyCellRenderer(); 
    TableColumn column = null;
      column = tblProgram.getColumn(ResourceBundle.getBundle("Program").getString("TBL_DESC"));
    //get data in column 3  
    column.setCellRenderer(cellRenderer);
      public class MyCellRenderer extends JTextArea implements TableCellRenderer {
            public MyCellRenderer() {
              setLineWrap(true);
              setWrapStyleWord(true);
              setMargin(new Insets(0, 5, 0, 5));
          public Component getTableCellRendererComponent(JTable table, Object
                  value, boolean isSelected, boolean hasFocus, int row, int column) {
               setText((String)value);
              setSize(table.getColumnModel().getColumn(column).getWidth(),
                      getPreferredSize().height);
              if (table.getRowHeight(row) != getPreferredSize().height) {
                      table.setRowHeight(row, getPreferredSize().height);
              return this;
       } ty in advance :D

    Multi-Post:
    http://forum.java.sun.com/thread.jspa?threadID=741629&tstart=20
    Thanks for fixing the code format tags, next time just edit the post instead of reposting.

  • Several line in a cell

    is it possible to create several line in one cell in a table?

    it's nothing to do with wrapping text, i just want to create multiple line in one cell,
    i want to create
    cell1   cell2     cell3
    ab       ab1     1
              ab2     
              ab3     
    but..... ab1, ab2, and ab3 in one cell

  • Adding multiple rows to a cell?

    Is it possible to add multiple rows of text to a single cell? I am trying to create a workout log. Typicaly I would record several exercises with weights and repititions to a single days workout. Is this possible in Numbers?
    Suggestion?
    Thanks.

    Hi Dcneuro,
    I am trying to create a workout log. Typicaly I would record several exercises with weights and repititions to a single days workout.
    You can enter multiple lines of text in a cell... But I'm wondering why you would want to do that. A log would be more useful if you structure it like this, one exercise to a row and repeat the date where appropriate:
    If you structure it that way or similarly (rather than entering multiple lines in a cell) then you can then use Numbers to do the things spreadsheet software is designed to do: derive summary statistics, charts, etc.  The formulas in this summary table are:
    B2, copied down:  =COUNTIF(Log::B,A2)
    C2, copied down: =SUMIF(Log::B,A2,Log::D)
    D2, copied down: =AVERAGEIF(Log::B,A2,Log::D)
    E2, copied down: =AVERAGEIF(Log::B,A2,Log::C)
    Obviously these workout numbers make no sense. This is just a simple example to give you an idea of the kinds of things you can do if you structure your log properly.
    Also, have a look at the Running Log template (File>New>Personal>Running Log on the Mac, or on the iPad: + then Create Spreadsheet then scroll down to the Personal section).
    SG

  • How to download data into one cell of excel in different lines

    Hi All,
    My Report downloads data from R/3 to excel. Now one particular field contains multiple lines, which i needs to download into different lines into that particular cell(of excel). how can i do this.
    I found one method for this and that is cl_abap_char_utilities=>newline.But this is in abap version 6.0.
    But i am working in version 4.6c. do we have any method or anything that meets my requirement in 4.6c.
    Please let me know.
    Thanx in Advance
    Subhani.

    why do you split them to the internal table ,then download it?
    Is you special field long text?
    If is ,you can use FM READ_TEXT to put it into an internal table ,then download it.

  • Download to excel with multiple lines in header

    Hi experts,
    Is there any Funtion module available to download an internal table contents into Local directory of PC with multiple lines in header.
    i.e.  let us say i hv internal table of 5 entries with 3 columns...
    i need to download this 5 entries into an excel file with some texts above the table contents...
    For eg : in the below format...
    Sample line 1
    sample line 2
    sample line 3
    colheader1     colheader2     colheader3
    item1                              
    item2
    item3
    item4
    item5
    Please help.
    Edited by: Lakshmiraj on Jul 15, 2010 3:26 AM

    There is another option of using OLE automation Please check the link below
    http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-OLEAutomationusing+MS-Excel
    OR
    chek for the example program in Tcode DWDM ( OLE example )
    OR
    Use FM KCD_EXCEL_OLE_TO_INT_CONVERT ( Fm Uses the same OLE automation)
    Hope it helps
    Anup

  • Multiple Lines in a Single ALV Grid Cell

    Is there any way to Display Multiple Lines in a Single ALV Grid Cell.
    This can be accomplished by Sorting the First 3 fields and Make it Looks like below displayed format.
    But My problem is while downloading also it should be Displayed in the same format.
    All inputs are highly appreciated.

    there was a post similar to this some days back... search it..
    any ways...
    what u can do is...
    arrange ur final internal table so that it will look like same line...
    like...lets say ur internal table is :
    A1 B1 C1 D1 123
    A1 B1 C2 D2 123
    A1 B2 C1 D1 123
    A1 B2 C2 D2 123
    and u can rearrange ur table to be like
    A1 B1 C1 D1 123
          C2 D2 123
    A1 B2 C1 D1 123
          C2 D2 123
    what i mean to say is dont pass the fields if they are same in the previous line... try it out..
    and then pass it two ur ALV.
    it will look like they are in one line
    Edited by: soumya prakash mishra on Jun 17, 2009 1:31 PM

  • Multiple Lines in a Jtable Cell

    I am trying to place multiple lines in a single cell of Jtable
    The text Of the cell comes from the database.I am trying to do it using a JLabel .If anyone can help me please do so
    thanks
    kishore
    [email protected]

    It can be done but it is quite a lot of work. Basically you have to produce your own cell renderer and use that instead. A good book on swing will tell you how to do it.

  • Table Cell Editor which allows to input multiple lines of text...

    Hi there
    Does anyone know how to write a table cell editor which allows users to input multiple lines of text? please provide some sample if possible...
    Thanks
    Ken

    I'm assuming you also want the renderer to display multiple lines? if so, make a class that extends JTextArea and that implements the TableCellEditor and TableCellRenderer interfaces, then set instances of this as the editor and renderer for the TableColumn in question. The implementation of most of the methods in these interfaces is trivial, often just this.setBackground() based on the table.getSelectionBackground() or table.getBackground(), a this.setText() based on the value passed in, then just a 'return this'.
    You might want to make an abstract class which implements these interfaces for you, and which delegates to a simple abstract method that you override to return the renderer/editor component.
    Note that you must use two instances of the class you make, one for the renderer and one for the editor, since it must be able to be able to render the remainder of the table's cells without interfering with the JTextArea performing the editing. (alternatively you could make two classes that extend JTextArea, each just implementing one of the interfaces, but this is more effort I think.) Also note that you must increase the table's row height to get more than one row visible.

  • Gui Upload and Line Feed within a CSV cell from Excel

    Hi all,
    I am facing the problem that my CSV file to be uploaded via GUI_UPLOAD is containing cells where the Excel user has split the line within the cell. So there are CRLF at the end of the CSV row and single LF within a cell between the field separators.
    GUI_UPLOAD is not making a difference and splits the line within the cell.
    Is there any solution for this?
    Thanks in advance for hints.
    Axel

    Hi Axel,
    I didn't know that it was considering CRLF and LF the same way. A workaround is to do the job yourself: call GUI_UPLOAD using BIN format (you'll get the characters as bytes), get the frontend encoding (cl_gui_frontend_services=>GET_SAPLOGON_ENCODING), then convert the bytes into characters using CL_ABAP_CONV_IN_CE class (see documentation), and split (statement SPLIT AT) the characters at cl_abap_char_utilities=>cr_lf to get each line, then split each line at cl_abap_char_utilities=>horizontal_tab.
    BR
    Sandra

  • Multiple line items with eCATT....again

    Hi folks,
    I am struggling with adding multiple lines in an eCATT script. For this example I will use the Airline demo example from SAP help: http://help.sap.com/saphelp_nw70ehp1/helpdata/en/fd/4f6b3f3d643b3be10000000a114084/content.htm.
    (You initialize the Airline demo data with SE38>>SAPBC_DATA_GENERATOR first.)
    The demo is based on transaction EC_TUTORIAL_SAPGUI.
    Start transaction EC_TUTORIAL_SAPGUI
    Open an airline and flight
    Right click on a date and select New Booking
    Pick a customer from F4 list
    Select Passengers tab
    Enter a last name, title and date of birth.
    I have created the script, system and test data containers and test configuration. Everything runs great.
    Now I want to modify it a little so I can add multiple passengers into one flight booking request.
    I have read Sapna Modi & Rakesh Kumar Jain's excellent blogs and have been able to start using eCATT productively with their help. Also from reading all the SDN posts I think I need the DO...ENDDO loop. (I would like to do it without inline ABAP mainly because I don't know ABAP at all and we will want to do similar things in the future with other non-ABAP'ers.)
    Here is my test script ZTUTORIAL_TS_LOOP:
    SAPGUI ( EC_TUTORIAL_SAPGUI_100_1 ).
    SAPGUI ( EC_TUTORIAL_SAPGUI_120_1 ).
    GETGUI ( EC_TUTORIAL_SAPGUI_100_4 ).
    Switch to Passengers tab. Cursor in Class field.
    SAPGUI ( EC_TUTORIAL_SAPGUI_100_STE_1 ).
    Delete first row so I start with empty table.
    SAPGUI ( EC_TUTORIAL_SAPGUI_100_STE_2 ).
    This is where I am stuck. I don't know how to add as many rows as there are variants (records) in my test data containter.
    The way it is below, it inserts the same record twice and the whole script repeats for each record in the TDC.
    DO ( 2 ).
    Insert row and type passenger name, title, DOB.
    SAPGUI ( EC_TUTORIAL_SAPGUI_100_STE_3 ).
    ENDDO.
    Save.
    SAPGUI ( EC_TUTORIAL_SAPGUI_100_STE_4 ).
    Confirm pop-up.
    SAPGUI ( EC_TUTORIAL_SAPGUI_110_STE_1 ).
    Show message in status bar.
    SAPGUI ( EC_TUTORIAL_SAPGUI_100_STE_5 ).
    I know I have to pass the DO a parameter and somehow get that into the command and use that to loop through the test data container, I just haven't been able to put the pieces together. Can anybody help? Thank you,
    David

    Dear David,Vinay and Sebastian,
    I have an issue....I am new to ECATT.
    iam Using SECATT Transaction.
    I need 2 record PFCG to Create Role and assign Multiple Transactions.
    Now I have Gone through th eBlogs of Sapna and many other links.
    Firstly I have Tried Both the Methods,
    TCD and GUI as well.
    My Case is as Follows....
    1)while Creating Role in PFCG(Recording).
    I give
             a)Role Name
             b)Description Then Navigate to Menu Tab
             c)Click on  Transaction Button
             d)now this is where the Problem Arises.
    I  first    Enter VA01 and press enter
       Then  Enter Va02 and Press enter
    Similarly I make Multiple Entries.
    After that I Click on Assign Transaction and then Save my Recording and then go back.
    Now I am Done with my recording.
    Now issue is after creating my Test Script...When i Create the Test Configuration.
    I provide the Test Script Name and Download the Template.
    Now after Creating Template I give Entries as follows in tab Delimit Format.
    I modified my File as follows.
    [VARIANT]                          [DESCRIPTION]     V_ROLE_NAME     V_DESC     V_TCODE
                                          BDC field value     BDC field value     BDC field value
    *ECATTDEFAULT                           X104     A1     VL03N
    1          ROLE1     A1     SE37
    2          ROLE1     A1     SE38
    3          ROLE1     A1     SE51
    Problems:-
    1)Whenever I Execute The Recording it Shows Previous Entry which i made during Recording and says that the Role already Exists
    2)while recording in Foreground Teh File Picks ROLE1 then picks the Desc  A1 then when it Picks the Transaction  se37.
    now when it Goes to second line it Shows the Previous Entry I JUST ENTERED.i.e SE37 and says that Tcode laready Exists.
    How do i Clear this previus variables.
    2ndly if i Program My Code and dont Use External Vaiant.
    I made the File as Below as Text Delimit and This Time iam not using The Template.
    But when i Execute it It Gives Error.
    Is there any Problem with My File..Please Suggest.
    It has been 3 Days and iam Still Stuck at this issue.
    ROLE2     DES1     MB5B
    ROLE2     DES2     ME23N        
    Please Respond.
    Thanks Awaiting.
    Essam

  • Colored Cells in Excel sheet

    hi
    we have a excel sheet with values which we created based on a tutorial spreadsheet. We tried the exactly the same steps provided in the PDF but it did not work. however when we used the original file we got the same output that was shown in the PDF screenshot. Here is what we tried.
    we created a spreadsheet similar to the one given below
    City     JAN     FEB     MAR     APR     MAY     JUN     JUL     AUG     SEP     OCT     NOV     DEC     Low     High
    ABILENE, TX     44     49     56     65     73     80     84     83     76     66     54     45     44     84
    AMARILLO, TX     36     41     48     56     65     74     78     76     69     58     45     37     36     78
    AUSTIN/BERGSTROM, TX     48     53     60     67     75     80     83     82     78     69     58     50     48     83
    In the canvas we placed a spreadsheet table control which contained the city names , a line chart and 2 gauges for HIGH and LOW values.
    Now the problem we faced was when we click on the city name in the table control nothing changed in the chart even though it was mapped to the correct cells.
    In the original file that came with the PDF there were YELLOW and RED blank cells to which it asked to map but those cells didnot contain any hidden data also. We would like to know is there any significance of those colored cells. whenever we download some sample excel file from the internet for a dashboard creation it has some colored cells, we would like to know does those cells contain any hidden info to make the dashboard work.
    Thanks
    GURU

    Most of the times, colored cells are used by the dashboard's designer to represent cells that are used at run time as origin/destination cells. This means that although at design time they are empty (they indeed are - there is no "hidden" data there), they contain data when the dashboard is executed.
    Some suggestions:
    - Check the component's properties to see which cells it uses.
    - Also, when in Preview, go to File -> Snapshot -> Current Excel Data to see what the Excel file actually looks like at run time. There you should see data in the colored cells.
    HTH,
    JK

Maybe you are looking for