GUI_DOWNLOAD - Column Width

Hi all,
I have a requirement to use gui download but im having problem in its column width, i want the excel to have a column width same as the title of the column, is this possible (to have different column width in the output excel file)
Thanks.

Hi,
Refer the below mentioned sample code:
INCLUDE ole2incl.                       "include used for providing classes used for using create object for creating application and worksheets
DATA: application TYPE ole2_object,
       workbook TYPE ole2_object,
       sheet TYPE ole2_object,
       cells TYPE ole2_object.
CONSTANTS: row_max TYPE i VALUE 256.
DATA index TYPE i.
*DATA: BEGIN OF itab1 OCCURS 0, first_name(10), END OF itab1.
*DATA: BEGIN OF itab2 OCCURS 0, last_name(10), END OF itab2.
DATA: BEGIN OF itab3 OCCURS 0, formula(50), END OF itab3.
TABLES: vbap,mara.
TYPES: BEGIN OF itab,
       lifnr TYPE lfa1-lifnr,
       land1 TYPE lfa1-land1,
*       name1 TYPE lfa1-name1,
*       ort01 TYPE lfa1-ort01,
       END OF itab.
DATA: BEGIN OF itab2 OCCURS 0,
matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
END OF itab2.
data : v_row type sy-tabix.
DATA: itab1 TYPE STANDARD TABLE OF itab WITH HEADER LINE.
DATA: IT_XLSTAB TYPE STANDARD TABLE OF ITAB ,
      WA_XLSTAB LIKE LINE OF IT_XLSTAB.
START-OF-SELECTION.
  SELECT lifnr land1 fROM lfa1  INTO CORRESPONDING FIELDS OF TABLE itab1 UP TO 5 ROWS.
  SELECT matnr
  ersda
  ernam
  FROM mara
  INTO CORRESPONDING FIELDS OF
  TABLE itab2 UP TO 5 ROWS.
*START-OF-SELECTION
START-OF-SELECTION.
  CREATE OBJECT application 'excel.application'.
  SET PROPERTY OF application 'visible' = 1.
  CALL METHOD OF application 'Workbooks' = workbook.
  CALL METHOD OF workbook 'Add'.
* Create first Excel Sheet
  CALL METHOD OF application 'Worksheets' = sheet
                               EXPORTING #1 = 1.
  CALL METHOD OF sheet 'Activate'.
  SET PROPERTY OF sheet 'Name' = 'Sheet1'.
  clear v_row.
  LOOP AT itab1.
     v_row = sy-tabix.
      perform fill_cell  using  v_row 1  itab1-lifnr.
      perform fill_cell  using  v_row 2 itab1-land1.
  ENDLOOP.
* Create second Excel sheet
  CALL METHOD OF application 'Worksheets' = sheet
                               EXPORTING #1 = 2.
  SET PROPERTY OF sheet 'Name' = 'Sheet2'.
  CALL METHOD OF sheet 'Activate'.
  clear v_row.
  LOOP AT itab2.
     v_row = sy-tabix.
      perform fill_cell using  v_row 1 itab2-matnr.
      perform fill_cell using  v_row 2 itab2-ersda.
      perform fill_cell using  v_row 3 itab2-ernam.
  ENDLOOP.
* Save excel speadsheet to particular filename
  CALL METHOD OF sheet 'SaveAs'
                  EXPORTING #1 = 'c:\temp\excelgeet.xls'     "filename
                            #2 = 1.                          "fileFormat
*  Closes excel window, data is lost if not saved
  SET PROPERTY OF application 'visible' = 0.
*  call method of sheet 'CLOSE'
*  EXPORTING #1 = 'YES'.
*& both the below coding closes the apllication permanently from the task manager also.
SET PROPERTY OF application 'DisplayAlerts' = 0.
   free OBJECT application.
**  call method of application 'QUIT'.
**  FREE OBJECT: APPLICATION,
**               SHEET.
*&      Form  fill_cell
*       text
*      -->P_1      text
*      -->P_V_COL  text
*      -->P_ITAB1_LIFNR  text
form fill_cell  using row  col val.
    CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = row  #2 = col.
    SET PROPERTY OF cells 'Value' = val.
endform.                    " fill_cell
Hope it helps
Regards
Mansi

Similar Messages

  • In Sales Order changing the column width to see all item desciption?

    When in the sales order screen .
    Expand the column width of say the item description.
    How do I save the column width for all the sales documents  for the field item description in sales order ?

    Hi,
    The column width of the Document will be defaulted to the same size at which the user has saved the last document.
    So, if a user has saved the Sales Order with a big column width for the 'Item Description' then after saving and re-entering into the Sales Order, the user can see the same column width for all the Sales Order's.
    I hope the above helps.
    Cheers~
    Jitin Chawla

  • Dynamically setting column width doesn't work all the time

    I wanted to dynamically set the width of a column in a JTable to be half of the width of a another column. This should happen whenever the frame is resized. But somehow I need to tell this twice to Java. If I don't then sometimes the column width isn't set new.
    Is this a Java bug or what?
    public void componentResized(ComponentEvent ce)
         try
              ref.table.getColumn(ref.rsmd.getColumnLabel(5)).setMaxWidth(ref.table.getColumn(ref.rsmd.getColumnLabel(1)).getWidth() / 2);
              ref.table.getColumn(ref.rsmd.getColumnLabel(5)).setMinWidth(ref.table.getColumn(ref.rsmd.getColumnLabel(1)).getWidth() / 2);
              // Again, or it won't work:
              ref.table.getColumn(ref.rsmd.getColumnLabel(5)).setMaxWidth(ref.table.getColumn(ref.rsmd.getColumnLabel(1)).getWidth() / 2);
              ref.table.getColumn(ref.rsmd.getColumnLabel(5)).setMinWidth(ref.table.getColumn(ref.rsmd.getColumnLabel(1)).getWidth() / 2);
         catch(SQLException e)
    }

    Is it possible that your call to
    ref.table.getColumn(ref.rsmd.getColumnLabel(5)).setMinWidth(ref.table.getColumn(ref.rsmd.getColumnLabel(1)).getWidth() / 2);
    is altering the response created by
    ref.table.getColumn(ref.rsmd.getColumnLabel(5)).setMaxWidth(ref.table.getColumn(ref.rsmd.getColumnLabel(1)).getWidth() / 2);
    ? Have you tried calling them once but in the other order? Or just calling the "setMaxWidth" call twice and leaving out the second "setMinWidth"?
    Good luck... :)

  • How to extract the column width in ALv report if its executed in background

    I am executing an ALV report in background , in front end i am getting data properly, in back end for some columns some of the digits are missing.For example if PO no is of 10 digits it will display only 8 becos column size is like that , how to extract coulmns in back ground.
    I have executed in background and checked the spool and  for some of the columns width is not sufficient to display comeplete data so please suggest how to extract the columns sizes if executed inj background for an ALV

    Hi Deepthi,
    you can try with the above mentioned suggestions ,if its worked its fine ,
    If not use Docking container instead of custom container, For ALV in back ground jobs, its suggest to use docking container instead of custom container , below you can find the declaration for docking container and code to use docking and custom container in your program for fore and back ground.
    or you can use docking container alone for both operations.
    Data : G_DOCK1 TYPE REF TO CL_GUI_DOCKING_CONTAINER,
    IF CCON IS INITIAL. (ccon is container name )
    *Check whether the program is run in batch or foreground
        IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.
    *Run in foreground
          CREATE OBJECT CCON
            EXPORTING
              CONTAINER_NAME = 'CON1'.
        CREATE OBJECT GRID1
            EXPORTING
              I_PARENT = parent_1.
    ELSE.
    *Run in background
          CREATE OBJECT GRID1
            EXPORTING
              I_PARENT = G_DOCK1.
        ENDIF.
      ENDIF.
    B&R,
    Saravana.S

  • How to set dynamic column width for analysis item

    Dear Experts,
    I have a query view which is added in the web template as an analysis item. The web item properties on width is not working - I tried entering a value in the width but when I execute the template, the query view's width still stays the same.
    Module com.sap.ip.bi.rig.ColumnWidth don't seem correct because I don't want the column width to be static. As my number of columns may change, I wanted the overall width of my query view to stay the same.
    Appreciate any ideas which can solve this issue
    Thanks and Regards,
    huimin
    BW newbie

    Hi Huimin,
    I don't think it is possible to fix the width of the Analysis webitem since it dynamically adjusts its width based on the text maxlength within its cells. Unless you use com.sap.ip.bi.rig.ColumnWidth where the cols are static, you cannot achieve this.
    Even if you do override the css settings using a cell padding or something, the portal settings would override the same. How about using a Report webitem to insert tables/charts & check if the width can be adjusted here - just a thought.
    --Priya

  • Web Application Designer: Column width on analysis_item with BW 7.0

    Hi,
    I'm new to SAP world and I have found a problem I'm not able to solve. I'm working with the Web Application Designer and I want to modify the cell properties (such as cell width) for aligning different queries. In fact, my question are:
    <b>
    1. Is it possible to hard-code/specify column widths of the analysis_item?
    2. The property width of the analysis_item doesn't work, does it?
    </b>
    Thanks for your time and efforts.
    Message was edited by:
            Daniel Rubio

    Hi,
    I have just discovered the capability of modifying columns widths with css properties.
    So if I add to the head section of the html:
    div.prueba2 .urSTTDBdr1
    div.prueba2 .urSTTDBdr
    div.prueba2 .urSTTDBdr2
    And later I put the AnalysisItem between a div class="prueba2" and /div, the columns widths are changed.
    Do you know where can I find all the style properties (such as urSTTDBdr1) and its functions?
    Thanks

  • How to resize column width in report?

    hi all,
    i read somewhere here that in order to resize column width in a report, you need to go to report attributes, then edit the column you wish to resize and then go to the CSS Style and place something like "width=600px". while this works very well in Internet Explorer, it somehow has no effect in Firefox 3.0. is there a way to make it work both browsers?
    thanks
    allen

    Hi,
    Sorry, I misunderstood. There are several methods you could use:
    1 - Use the span tags around the data itself - this would require adding the tags into the sql statement itself
    2 - Use javascript to set the column widths by adding a style to the TD tags for each cell
    3 - Create a new Report Template and use COL tags immediately after the TABLE tag in the Before Rows section to specify the widths of all columns
    Option 3 may be the easiest?
    Andy

  • How to controll column width in report ?

    Dear All,
    i have created Classic Report but here Column width is too large.
    i want to controll column width in report .
    How can i do this..
    Thanks

    Hi Vedant,
    There are two possibilities in your case.
    1.width of your column heading is too large.
    include break in your column heading
    for ex .. column heading is employee department number then write it as *[Employee(br)Department(br)Number]* // replace ( with < and ) with > in br
    2) Value is too large
    Go to Report Attributes->edit your column->column formatting->css style
    In CSS style put this display:block;width:100px;white-space:wrap
    Hope this will helps you,
    Thanks,
    Jitendra

  • How can I modify column width in a spreadsheet report without using an Excel template

    I currently use the LabVIEW Report Generation toolkit in LabVIEW 2011SP1 to create simple spreadsheet reports that I can build/print without having Microsoft Office products installed.  I really like being able to do this, and it allows me to generate nice on-demand data reports - I'm also not tied to having Office installed on the system I'm using, so this works on just about any test fixture I can install the software on.  
    I recently have a requirement that I must have variable-length columns in my report.  I currently use the VI "Append Text Table to Report" in order to create a text table, but the column width requirement is that all columns must be equal width UNLESS I use an Excel Template file to define my column widths.  
    My questions are:
    Is it possible to create a text table and define per-column widths without using an Excel Template?  If so, how?  My report mainly has a lot of small numerical values for the columns, but some columns contain system names or status messages - I really hate the longer text blocks wrapping and taking up so much real-estate when if I could control the column widths I can get all my data on a single line.
    I'll admit I haven't tried this myself yet, but if I use an Excel Template will that require me to have Excel installed on the PC in order to print/generate reports?
    Is there a recommended way (with an example) of generating a text table in a report with or without using the "Append Text Table to Report" VI that allows me to have custom column widths that doesn't require me to manually build a custom print page?  If I do have to create a custom print page, what would be the most straightforward approach?
    Thanks!
    -Danny

    Sure, I'll provide a pared down example that demonstrates my use-case:
    I have a control to the VI that takes in a 2D array of strings representing the data I want printed in a table.  I am generating a standard report, adding a table to the report, and printing it.  The first VI is "New Report.vi", the second VI is "Append Table to Report.vi", and the third is "Print Report.vi", all found standard in the Report Generation palette.
    Note that the "Append Table to Report.vi" has an input parameter "Column Width" with a default value of (1).  This input parameter is a single input parameter, which defines the column widths of ALL the columns in my table - hence, with the VI the way it is, all my columns will be 1 inch wide.  
    I find myself needing to be able to define per-column widths, not just a single global column width parameter.  
    The only way I have found to do this is by using an Excel template file.  The "New Report.vi" takes in a "template" parameter, and if used, the report generation toolkit can be set to ignore the "Column Width" input parameter on the "Append Table to Report.vi" by setting the width value to -1.  Instead it will launch Excel, open the template file provided, build the table using the template, will close Excel, and will attach the generated table to the report.  However, I have a strict requirement that Microsoft Office NOT be required to be installed on the computer.  
    So, without using Excel, is there a way to generate a table in a report and define the width of each column individually?
    -Danny

  • Is it possible to resize page column widths at runtime (by the user)?

    hi all,
    i have cretaed a page using the 2-columns narrow/wide layout.  this layout is perfect for what i want to do.
    however, the users have complained that they would like to be able to resize the columns, just like they are able to do with the Detailed Navigation column (using the small "<" and ">" arrows).
    is it posssible to add this functionality to my custom pages so that can also resize the columns?
    i searched for options in the properties, but didn't find anything.
    thanks,
    mm

    This was a great place for me to start
    Thank you
    I took profdant139's suggestions a bit further as my real goal was to have the "Document column" narrower. The goal to be able to see all the other document info that was usually hidden way out to the right
    To achieve my results I right clicked in the upper bar with the column names and chose from the drop down box "comments" column (as suggested). I then dragged it to the far right. This pushed all the other columns over.
    In the end of the day I ended up adding "Size" and "Date modified" columns as well to get my desired results.
    Remember one can move different columns around to be in the order you need by clicking on the column to get it active and then left click and drag it to where you want
    Another great thing is that by default (Using Mavericks) the date modified, opened,created columns have date and time. One can shrink them down to xx/xx/xx format by manually adjusting the column width like one does in Excel - click on column separator up top and drag
    Once all that is done, at least on my box, I closed it out and opened up a new finder window and everything was as I wanted.
    Thank you for the help  from the above helper to get me here

  • Reports 6i default column widths

    Reports 6i does not appear to pull the correct column width for varchar2 columns when building reports through the wizard. It sets them to 10 regardless of the length.
    Is there a way to either always define a specific database column to a specific width in reports or to get reports to size the column correctly through the wizard?
    Thanks

    Thanks for the quick answer Jay! I tried the latter approach and it didn't work.
    Given my limited understanding of CSS I first researched what the # signifies and found that it precedes a value from an ID attribute of an element. Which makes sense because this override would need to know specifically what to adjust.
    Next I scanned the source and couldn't find an ID of portletColumnFormatter_0 the closest thing I found was a summary field (summary="Portlet column formatter table.").
    Edit: Hmmm...
    A quick scan of portal.bea.com shows that ID does in fact exist there but it appears that site is on version 6.5.0
    Was this ID value missing in an earlier install version perhaps?
    Edit: Aha!
    Yet a few moments later I realized my err...our dev environment is still on 6.1.0 which, if memory serves, was missing this key attribute!
    It appears my first priority should be to syncrhonize our two environments and THEN worry about customizations.
    Thanks again for the help, I'll refer back to this as soon as I'm upgraded:)
    Edited by geoffgarcia at 04/30/2008 10:04 AM

  • Interactive report column width

    Hi,
    I have some numeric fields in an IR, where columns widths are much more wider than data (there are a lot of empty space). Is it possible to decrease column width?
    András

    Please tell me where is the css style sheet? I have no idea where to find it.

  • Interactive Report Column Width adjustable?

    I am using the interactive reports in 3.1.2 and love them. That said, I have a question/problem. I have a column in my report that is essentially comments. It often contains hundreds of bytes of text per row of data. When I use the interactive report I find no where that I can define a default column width or number of report rows to display. So, when I run the report, the column with the comments defaults to a column width of about 25 characters and this causes it to display many html rows for this report row and makes the report very ugly.
    Does anyone know if there is a way to redefine a column in an interactive report to prevent this?

    Scott,
    Using FOP.
    Standard reports PDF can resize columns.
    Interactive report does not. Additionally, the page size does not work the same as the regular reports. Moving between landscape and portrait changes the size of the height and width.
    I assume there are several problems.
    1. The report does not resize horizontally. I will have to create a second report to see if I can duplicate the issue.
    2. The Print page of the report region does not have the same fields as the regular reports. I am not sure why or how to overcome the lack of being able to resize columns, etc.
    3. The functionality on the page does not seem to all work. At least not the same way as the regular reports. Changing paper size and orientation are two examples I have verified.
    4. Can't select a template. How can a different XSL-FO template be used?
    I am going to try and push it to Word.
    Sam
    Edited by: slavanaway on Mar 26, 2009 1:13 PM

  • Portal Report from SQL query will not fill the page irrespective of column width.....

    I'm displaying a report in a portal and if you run in full screen the table does not fill the page.
    I can change the column width from xx percent to xx pixel and nothing makes a difference
    any ideas?

    Hi,
    Which version of portal are you using. This is a bug. It has been fixed in 30984.
    Thanks,
    Sharmila

  • Can't figure out how to maximize the space on the page by increasing the column width

    Trouble with pages app:
    can't figure out how to maximize the space on the page by increasing the column width
    I have 3 columns and they have spaces btw them that I cannot close the gap on.

    Whatever the version, you can click on the gutter figure and edit it.
    Click once on the column and a second time on the Gutter measurement.
    Peter

Maybe you are looking for