Column headings as HTMLDB_ITEMS
Is there a way to return column headings and HTMLDB_ITEMS? I am trying to place select lists into certain columns to be used as column filters to dynamicly build where clauses.
James,
I think it is possible, though I haven't tried something like this before. You would start with building your report region as a PL/SQL function returning SQL query, the query could look something like this:
return 'select ename, job, sal, comm, deptno from emp';
You would have to include some dynamic where clause of course. In the next step, you would go the reports attributes page and change the column headings type to be a PL/SQL function returning a colon-delimited list. And that function could look like this for the query above:
return 'Name:Job:Salary:Commission:'||htmldb_item.select_list_from_query(1,null,'select dname, deptno from dept')
Then you need to also have a submit button that actually submits your page and a branch that takes you back to your page. Or you could have the select list in your column headings do an auto-submit instead, this could be done when using the following function for the headings instead of the one shown above:
return 'Name:Job:Salary:Commission:'||htmldb_item.select_list_from_query(1,null,'select dname, deptno from dept','onChange="doSubmit(''f01'');"')
And you will also need a after submit process, that assigns the value selected to e.g. a page item that you then could use to build your dynamic SQL query. You can find information and examples for how to process items build using the htmldb_item package in the following How-To document. This document is about tabular forms, so it is different from what you are building, but it should provide you with the information needed.
http://www.oracle.com/technology/products/database/htmldb/howtos/tabular_form.html
I hope this gives you some ideas, let me know how it works out,
Regards,
Marc
Similar Messages
-
Webforms - Wrap Text/Word Wrap for Column Headings
I have some member aliases that are set as my webform's column headings, but they are fairly long. Setting the column width to a custom value that fits most of the text in the heading makes the form very wide and ugly to work with. I don't see any option to Wrap Text or use Word Wrap in the column headings. Is there any way to do this?
Thanks!Hi,
I am not aware of any option which allows you to wrap the text, it may be possible customizing the [CSS |http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/html_hp_admin/ch12s03.html] though to be honest I am not even sure about that and even if it was possible it would apply to all apps.
Cheers
John
http://john-goodwin.blogspot.com/ -
LOV of column names with a report's custom column headings?
I have a list ov values definition that looks like this:
select column_name d, column_name r from all_tab_columns where table_name = 'DATABASE_LIST'
I'd like to list the custom column headings from a report as d, rather than repeating the column_name. How can I do this?As Anton said, the best thing is to store your custom headings in a table so that you can use the table for your LOV as well as for your report headings.
To use dynamic report headings, you can use the 'PL/SQL function body returning colon-delimited headings' feature on the Report Attributes page.
So, if your report headings are stored in table t that function body can be
declare
l_headings varchar2(4000)
begin
for rec in (select heading from t) loop
l_headings := l_headings||':'||rec.heading;
end loop;
return ltrim(l_heading,':');
end;Hope this helps. -
Dynamic crystal report generation - issues with column headings
Hi All,<br>
I'm trying to generate a crystal report dynamically based on a "result set" data(Query: select REPORT_ID, REPORT_NAME, REPORT_DESC, RPT_FILE_NAME, LOCATION from IRS_REPORT_DETAILS). I'm able to generate the report run time, But the report is without columns heads. I would like to include the column headings as well. <br><br>
I searched the API(RAS) and found that there is a 'add(java.lang.String fieldName, java.lang.String headingText) " method present in "ReportObjectController" using which we can add the headings.<br><br>
ReportDefController reportDefController = clientDoc.getReportDefController();
ReportObjectController reportObjectController = reportDefController.getReportObjectController();
reportObjectController.add( "{Table.Field}", "FieldName" );
<br><br>
I'm facing problems in using this code. When trying to use this function for my fields(Ex: reportObjectController.add( "{ IRS_REPORT_DETAILS.REPORT_ID}", "Report ID" );) it is giving me the following error:<br><br>"com.crystaldecisions.sdk.occa.report.lib.ReportSDKGroupException: The field was not found.---- Error code:-2147213310 Error code name:fieldNotFound"<br><br>
<b>The following is my dynamic crystal report generation code:</b><br><br>
public ReportClientDocument execute(String repName, String query) {
ReportClientDocument boReportClientDocument = null;
try {
boReportClientDocument = new ReportClientDocument();
boReportClientDocument.newDocument();
// Add a table based on the given Resultset to the report.
dbConnResultSet mySampleResultSet = new dbConnResultSet();
//mySampleResultSet.execute(query);
boReportClientDocument.getDatabaseController().addDataSource(
mySampleResultSet.execute(query));
IReportSource test = boReportClientDocument.getReportSource();
// Access all the database fields
DatabaseController databaseController = boReportClientDocument
.getDatabaseController();
IDatabase database = databaseController.getDatabase();
Tables tables = database.getTables();
ITable table = (Table) tables.getTable(0);
int NO_OF_FIELDS = table.getDataFields().size();
int LEFT_POSITION = 200;
// Add all the database fields to the report document
for (int i = 0; i < NO_OF_FIELDS; i++) {
IField field = table.getDataFields().getField(i);
FieldObject fieldObject = new FieldObject();
fieldObject.setFieldValueType(field.getType());
fieldObject.setDataSource(field.getFormulaForm());
IReportObject rep = (IReportObject) fieldObject;
IObjectFormat objformat = rep.getFormat();
objformat.setEnableCanGrow(true);
objformat.setHorizontalAlignment(Alignment.from_int(1));
rep.setFormat(objformat);
rep.setLeft(LEFT_POSITION);
rep.setWidth(1000);
LEFT_POSITION = LEFT_POSITION + 1000 + 50;
ISection section = boReportClientDocument
.getReportDefController().getReportDefinition()
.getDetailArea().getSections().getSection(0);
//***************** Data being added to the report here, But headings are not added*****************
boReportClientDocument.getReportDefController()
.getReportObjectController().add(rep, section, i);
boReportClientDocument.createReport();
/*Some report saving code is present down*/
} catch (ReportSDKException ex) {
ex.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
return boReportClientDocument;
<br><br>
appreciate your help.IField field = table.getDataFields().getField(i);
Here you are getting the first field in the array. This may not be the field you want to add since we aren't sure how the arrays are ordered when retrieving fields from the report. It is better to retrieve the fields with the findObjectByName method, thus ensuring you are retrieving the field you want to add to your heading. -
Column headings are missing in the output for ALV?
Hi all,
i have coded a small report in ALV mode. i am getting the data but the column headings are missing.
iam not getting the column headings in the output. it is coming as blank. Could you all please help me out in this?
below is the code of my program:
Includes *
*---Standard header and footer routines
INCLUDE zsrepthd.
*--- ALV Routines
INCLUDE zvsdi_alv_routines_ver3.
*--- Authorization Check
INCLUDE z_selection_auth_check.
Types Declarations *
tables : ekpo.
Types Declarations *
TYPES: BEGIN OF ty_ekpo,
EBELN(18) TYPE C,
EBELP(20) TYPE C,
MATNR(18) TYPE C,
WERKS(11) TYPE C,
END OF ty_ekpo.
*-Output field name
TYPES: BEGIN OF ty_output,
EBELN(18) TYPE C,
EBELP(20) TYPE C,
MATNR(18) TYPE C,
WERKS(11) TYPE C,
END OF ty_output.
*-Output field name
TYPES: BEGIN OF ty_fields,
fname(60) TYPE c,
END OF ty_fields.
Internal Table Declarations *
DATA:it_ekpo TYPE STANDARD TABLE OF ty_ekpo,
*--- Alv parameters
it_out_alvp TYPE typ_alv_form_params, "for alv parameters
*-Field catalog for ALV display
it_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
*-Field names for Excel column headings
it_ekpo_fields TYPE STANDARD TABLE OF ty_fields WITH HEADER LINE.
**--To store output for Principial Pegging data
DATA: BEGIN OF it_output occurs 0,
EBELN(18) TYPE C,
EBELP(20) TYPE C,
MATNR(18) TYPE C,
WERKS(11) TYPE C,
END OF it_output.
**--To store output for 2nd
DATA: BEGIN OF it_output1 occurs 0,
text(2000),
END OF it_output1.
Data Declarations *
data: v_ebeln TYPE ekpo-ebeln,
v_ebelp TYPE ekpo-ebelp,
v_matnr TYPE ekpo-matnr,
v_werks TYPE ekpo-werks.
Constants Declarations *
CONSTANTS:
c_0 TYPE i VALUE 0,
c_x TYPE char1 VALUE 'X',
c_i TYPE char1 VALUE 'I',
c_eq TYPE char2 VALUE 'EQ',
c_ekpo TYPE char4 VALUE 'EKPO',
c_hyfn TYPE char1 VALUE '-'.
Work Area Declarations *
DATA: x_output_ekpo type ty_output,
x_ekpo type ty_ekpo.
Selection Screen *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-f01.
SELECT-OPTIONS:
s_ebeln FOR v_ebeln OBLIGATORY,
s_ebelp FOR v_ebelp,
s_matnr FOR v_matnr,
s_werks FOR v_werks.
SELECTION-SCREEN END OF BLOCK b1.
At Selection Screen *
AT SELECTION-SCREEN.
Start-of-Selection *
START-OF-SELECTION.
*--- Check Authorizations for Selection-screen
PERFORM z_selection_auth_check.
*--- Fetch Purchasing Document Item data
PERFORM fetch_status_pp.
End-of-Selection *
END-OF-SELECTION.
**-- Download data to final internal table.
PERFORM data_output.
IF NOT it_output[] IS INITIAL.
*--- Fill the structure for calling the ALV form
PERFORM initialize_alv_params.
**-- Display ALV Report
PERFORM setup_and_display_alv_ver2
USING
it_out_alvp "Parameter structure
it_output[] "Internal Data table(header table)
it_output[]. "Dummy table for Hierarchical ALV!!(item table)
ENDIF.
IF it_output[] IS INITIAL.
MESSAGE i999(zi) WITH 'No data found for selection'(i02).
ENDIF.
*& Form FETCH_STATUS_PP
Get data from ekpo table
FORM FETCH_STATUS_PP .
*-Fetch PP Data from ekpo table
REFRESH it_ekpo.
SELECT EBELN
EBELP
MATNR
WERKS
FROM ekpo
INTO TABLE it_ekpo
WHERE ebeln IN s_ebeln
AND ebelp IN s_ebelp.
IF sy-subrc = c_0.
SORT it_ekpo BY ebeln ebelp.
ENDIF.
ENDFORM. " FETCH_STATUS_PP
*& Form f_top_of_page
*This is to write the top of page
FORM top_of_page.
DATA: lt_list TYPE slis_t_listheader,
lx_list TYPE slis_listheader.
*--- Title name
CLEAR lx_list.
lx_list-typ = 'S'.
lx_list-key = 'Title name'(t13).
lx_list-info = sy-title.
APPEND lx_list TO lt_list.
IF NOT lt_list IS INITIAL.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = lt_list.
ENDIF.
ENDFORM. "top_of_page
*& Form init_page_head
Description : This subroutine initializes the fields in table BHDGD *
for printing the report heading. *
FORM init_page_head.
bhdgd-line1 = 'SLA Status Report'(h04).
bhdgd-line2 = sy-title.
bhdgd-lines = sy-linsz.
bhdgd-fcpyrt = sy-uline.
bhdgd-inifl = '0'.
ENDFORM. "init_page_head
*& Form initialize_alv_params
Description : Form to initialize ALV Params
FORM initialize_alv_params.
CONSTANTS: lc_alv_grid TYPE char1 VALUE 'G', "Grid
lc_u TYPE char1 VALUE 'U'.
MOVE 'IT_OUTPUT' TO it_out_alvp-tablname. "final table
MOVE sy-repid TO it_out_alvp-repid.
MOVE lc_alv_grid TO it_out_alvp-alvtype.
MOVE c_x TO it_out_alvp-bringdefaultvar.
MOVE lc_u TO it_out_alvp-variantsavetype.
ENDFORM. " initialize_alv_params
FORM it_out_init_events *
-->this is form is to modify the events
FORM it_out_init_events
CHANGING
alevnts TYPE slis_t_event.
FIELD-SYMBOLS <alevnt> TYPE slis_alv_event.
LOOP AT alevnts ASSIGNING <alevnt>.
CASE <alevnt>-name.
WHEN slis_ev_top_of_page.
MOVE 'TOP_OF_PAGE' TO <alevnt>-form.
ENDCASE.
ENDLOOP.
ENDFORM. "it_out_init_events
*& Form DATA_OUTPUT
Download data to final internal table
FORM DATA_OUTPUT .
loop at it_ekpo into x_ekpo.
x_output_ekpo-ebeln = x_ekpo-ebeln.
x_output_ekpo-ebelp = x_ekpo-ebelp.
x_output_ekpo-matnr = x_ekpo-matnr.
x_output_ekpo-werks = x_ekpo-werks.
append x_output_ekpo to it_output.
endloop.
ENDFORM. " DATA_OUTPUT
FORM it_out_alv_fieldcat_before *
--> PT_FCAT *
--> ALVP *
FORM it_out_alv_fieldcat_before CHANGING
pt_fcat TYPE slis_t_fieldcat_alv
alvp TYPE typ_alv_form_params.
DATA: lx_fcat TYPE slis_fieldcat_alv.
CLEAR lx_fcat.
lx_fcat-tabname = 'IT_OUTPUT'.
lx_fcat-fieldname = 'EBELN'.
lx_fcat-col_pos = '1'.
lx_fcat-ddictxt = 'M'.
lx_fcat-seltext_l = 'Purchasing Doc No'(018).
lx_fcat-seltext_m = 'Purchasing Doc No'(018).
lx_fcat-seltext_s = 'Purchasing Doc No'(018).
lx_fcat-reptext_ddic = 'Purchasing Doc No'(018).
APPEND lx_fcat TO pt_fcat.
CLEAR lx_fcat.
lx_fcat-tabname = 'IT_OUTPUT'.
lx_fcat-fieldname = 'EBELP'.
lx_fcat-col_pos = '1'.
lx_fcat-ddictxt = 'M'.
lx_fcat-seltext_l = 'Item No Purchasing Doc'(020).
lx_fcat-seltext_m = 'Item No Purchasing Doc'(020).
lx_fcat-seltext_s = 'Item No Purchasing Doc'(020).
lx_fcat-reptext_ddic = 'Item No Purchasing Doc'(020).
APPEND lx_fcat TO pt_fcat.
CLEAR lx_fcat.
lx_fcat-tabname = 'IT_OUTPUT'.
lx_fcat-fieldname = 'MATNR'.
lx_fcat-col_pos = '1'.
lx_fcat-ddictxt = 'M'.
lx_fcat-seltext_l = 'Material'(010).
lx_fcat-seltext_m = 'Material'(010).
lx_fcat-seltext_s = 'Material'(010).
lx_fcat-reptext_ddic = 'Material'(010).
APPEND lx_fcat TO pt_fcat.
CLEAR lx_fcat.
lx_fcat-tabname = 'IT_OUTPUT'.
lx_fcat-fieldname = 'WERKS'.
lx_fcat-col_pos = '1'.
lx_fcat-ddictxt = 'M'.
lx_fcat-seltext_l = 'Supply plant'(013).
lx_fcat-seltext_m = 'Supply plant'(013).
lx_fcat-seltext_s = 'Supply plant'(013).
lx_fcat-reptext_ddic = 'Supply plant'(013).
APPEND lx_fcat TO pt_fcat.
ENDFORM. " it_out_alv_fieldcat_before.
Regards,
Shalini
Edited by: shalini reddy on Oct 7, 2008 5:08 PMHi,
The heading are in the table pt_fcat - you don't seem to be passing that in form....
PERFORM setup_and_display_alv_ver2
USING
it_out_alvp "Parameter structure
it_output[] "Internal Data table(header table)
it_output[]. "Dummy table for Hierarchical ALV!!(item table)
which I guessing in in one of the includes?
Saying that the extract pof code does not show where you are calling form it_out_alv_fieldcat_before ...which populates the headings...
Regards
Stu -
Column headings in a file extract to excel
I am writing a program that will extract data and download it as a tab delimited file which will be input to excel. I need to put column headings on the file and I have attached an sample of the code that I am using. It is working fine but I am not sure if this is the correct approach I have a file that has 87 columns in it.
thanks in advance for the help.
DATA: begin of header_line occurs 0,
line(50) type c,
end of header_line.
FORM build_header_line.
header_line-line = 'Vendor'.
append header_line.
header_line-line = 'CoCd'.
append header_line.
header_line-line = 'POrg'.
append header_line.
header_line-line = 'Group'.
append header_line.
header_line-line = 'Name'.
append header_line.
.(87 times)
ENDFORM. " build_header_line.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_path
write_field_separator = 'X'
TABLES
fieldnames = header_line
data_tab = it_extract_data
EXCEPTIONSHi Timothy,
The current approach of your code doesnt include a header to your file.
Header is used add information about the code page and the byte sequence if the internal table was created through a code page conversion using gui_convert_codepage and it is of type hexadecimal with a length of at most 1023 bytes.
1)Have a separate internal table for your structure and pass this internal table data to FM 'GUI_DOWNLOAD'.
2)Have a second internal table which holds your data and use FM 'GUI_DOWNLOAD' with Importing parameter APPEND as 'X' with the same FILENAME which you used in first GUI_DOWNLOAD function module.
Thanks,
Vinay -
How to haveour own titles/captions in selection screen & in column headings
we have SAP B1 2005 A, MS SQL 2005
though i am new to MSSQL/T-SQL programming, purely through lot of trials & errors i have learnt & managed to develop many reports/queries !
but, i am facing some problems : how to have our own captions/title for the options in selection screen & aso in reports/queries column headings.
e.g. :
for Customer Aging analysis, i would like to accept a set of 3 parameters (aging days) from the user. where the user may enter the values 30, 60 & 90 OR any other values.
i have the following codes for this purpose (considering my question's (over) size, only small portions of my program are given below)
declare @mdue1 int,
@mdue2 int,
@mdue3 int
set @mdue1 = [%1]
set @mdue2 = [%2]
set @mdue3 = [%3]
but, in the selection screen, the system displays "%1 Debit Amount Greater than" as the caption & 0.00 as the default value. the same is the case for the other two parameters [%2] & [%3] also.
i tried defining the variable @mdue1 as smallint & also tinyint, but the result is the same.
how to have our own captions/title for the options in selection screen instead of the ones displayed by t-sql based on our SELECT statement.
how to have our own column headings, dynamically defined/coined using variables instead of hard coded columns headings (within quotes).
e.g. in the select statement, instead of defining a column as '<= 30 Days' = T0.due_1
i would like to get the number of days from the user, who may enter 30 or 40 or whatever.
i would like to display the value that the user entered in the column heading using a variable say @mcol1
declare @mcol1 varchar(10)
set @mcol1 = '<= 'convert(varchar(10), @mdue1)' Days'
SELECT T0.CardCode,@mcol1 = T0.due_1 from #CustAging T0
but, this ends up in error.
i have already searched the net for ebooks, articles, etc. for a solution to this problem, but till now, i could not find any addressing these problems.
i have just registered in this forum with a hope to get a solution. thanks a lot in advance.
Thanks & Regards,
Raghu Iyer
Place : Vapi, Gujarat, Indiathanks a lot, lstvan.
i think, it i a good "trick" worth trying out.
well, i will now mark this question as answered, but still, if anyone has a direct solution "problem", please do share with us.
i am able to write queries (in fact, full fledged programs) in T-SQL & getting the desired output and for such a trivial thing i do not want to go for an add-on SDK module. but, considering the limitations of T-SQL and the complex requirements of real business world, i think, we have to go the .net way only.
regarding add-ons, i heard that add-ons will slow down SAP B1. is it true ?
Thanks & Regards,
Raghu iyer -
Hi Max,
If you remember in one of my last post I asked for changing the column headings in ALV display for example from 'Material' to 'Material used'.
I am using
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
IT_FIELDCAT = field_body
I_SAVE = g_save
IS_VARIANT = g_variant
IT_EVENTS = events
TABLES
T_OUTTAB = itab.
And you suggested me the following way....
loop at field_body into field_wa.
case field_wa-fieldname.
when 'Material'.
field_wa-seltext_l = 'Material used'.
field_wa-seltext_m = 'Material used'.
field_wa-seltext_s = 'Material used'.
endcase.
modify field_body from field_wa.
endloop.
It is working well. In ALV display the column heading is changed to what I wanted. But the question is when I export the displayed ALV to Excel using ALV functionality, Export->Spreadsheet... I see that <b>I dont get the Column Heading into Excel as it was in the ALV display.</b>
I get in the Excel as 'Material u' or 'Mat. Used'. But when I add this line in the code.....
when 'Material'.
field_wa-seltext_l = 'Material used'.
field_wa-seltext_m = 'Material used'.
field_wa-seltext_s = 'Material used'.
<b> field_wa-outputlen = 20.</b>
Then I see that I get the complete heading in the Excel. But this way the columns with outputlen 20 are taking much space in ALV display.
Is there any fix for this. May be not mentioning the outputlen but still get the column headings into Excel as it was in ALV display.
Anyone with ideas please respond. Waiting for replies. ThanksHi
The labels have a fixed size:
seltext_l is long text: 20 char
seltext_m is medium text: 15 char
seltext_s is short text: 10 char
The text 'Material used' is long 13 char so you should write:
field_wa-seltext_l = 'Material used'.
field_wa-seltext_m = 'Material used'.
field_wa-seltext_s = 'Mat. used'.
You can try to set the field colwidth_optimize of parameter IT_LAYOUT.
This field should optimize the width of the colunm
So
data layout type SLIS_LAYOUT_ALV.
layout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
IT_LAYOUT = layout
IT_FIELDCAT = field_body
I_SAVE = g_save
IS_VARIANT = g_variant
IT_EVENTS = events
TABLES
T_OUTTAB = itab.
and you can decide which label has to be used:
field_wa-seltext_l = 'Material used'.
field_wa-seltext_m = 'Material used'.
field_wa-seltext_s = 'Mat. used'.
If you want to set the short text
field_wa-ddictxt = 'S'.
...medium
field_wa-ddictxt = 'M'.
...long
field_wa-ddictxt = 'L'.
Max -
ALV download to EXCEL with column headings etc.
Getting data from a grid to EXCEL can be done in "List" mode vis system==>save etc but it's not particularly user friendly and in any case if you are displaying a nice ALV why should the user have to switch into LIST mode anyway.
Anyway here's a decent way to do it and it gives great formatted column headings etc etc.
1) in the ON_TOOLBAR method add this code
method ON_TOOLBAR.
type-pools icon.
CLEAR ls_toolbar.
MOVE 0 TO ls_toolbar-butn_type.
MOVE 'EXCEL' TO ls_toolbar-function.
MOVE space TO ls_toolbar-disabled.
MOVE icon_xxl TO ls_toolbar-icon.
MOVE 'Excel' TO ls_toolbar-quickinfo.
MOVE 'EXCEL' TO ls_toolbar-text.
APPEND ls_toolbar TO e_object->mt_toolbar.
2) In the ON_USER_COMMAND method add the following
(if you have a class defined with SE24 you don't need the commented code).
method ON_USER_COMMAND.
FOR EVENT before_user_command OF cl_gui_alv_grid
IMPORTING
e_ucomm
sender.
CASE e_ucomm.
....... other toolbar funcs if you have any
WHEN 'EXCEL'.
CALL METHOD me->download_to_excel.
ENDCASE.
endmethod.
3) code this method to download to EXCEL
method DOWNLOAD_TO_EXCEL.
FIELD-SYMBOLS:
<fs0> TYPE STANDARD TABLE,
<fs1> TYPE STANDARD TABLE.
ASSIGN g_outtab1->* TO <fs0>.
ASSIGN g_fldcat1->* TO <fs1>.
CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
EXPORTING
it_fieldcat_lvc = <fs1>
is_layout_lvc = m_cl_variant->ms_layout
is_tech_complete = ' '
IMPORTING
es_layout_kkblo = ls_layout
et_fieldcat_kkblo = lt_fieldcat.
LOOP AT lt_fieldcat INTO lt_fieldcat_wa.
CLEAR lt_fieldcat_wa-tech_complete.
IF lt_fieldcat_wa-tabname IS INITIAL.
lt_fieldcat_wa-tabname = '1'.
MODIFY lt_fieldcat FROM lt_fieldcat_wa.
ENDIF.
l_tabname = lt_fieldcat_wa-tabname.
ENDLOOP.
CALL FUNCTION 'ALV_XXL_CALL'
EXPORTING
i_tabname = l_tabname
is_layout = ls_layout
it_fieldcat = lt_fieldcat
i_title = sy-title
TABLES
it_outtab = <fs0>
EXCEPTIONS
fatal_error = 1
no_display_possible = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
endmethod.
You get nice column headings etc and decently formatted EXCEL spreadsheet.
For Office 2007 I think you need to apply a SAP note but it certainly works with OFFICE 2003 which is what we are still using.
Cheers
jimboGetting data from a grid to EXCEL can be done in "List" mode vis system==>save etc but it's not particularly user friendly and in any case if you are displaying a nice ALV why should the user have to switch into LIST mode anyway.
Anyway here's a decent way to do it and it gives great formatted column headings etc etc.
1) in the ON_TOOLBAR method add this code
method ON_TOOLBAR.
type-pools icon.
CLEAR ls_toolbar.
MOVE 0 TO ls_toolbar-butn_type.
MOVE 'EXCEL' TO ls_toolbar-function.
MOVE space TO ls_toolbar-disabled.
MOVE icon_xxl TO ls_toolbar-icon.
MOVE 'Excel' TO ls_toolbar-quickinfo.
MOVE 'EXCEL' TO ls_toolbar-text.
APPEND ls_toolbar TO e_object->mt_toolbar.
2) In the ON_USER_COMMAND method add the following
(if you have a class defined with SE24 you don't need the commented code).
method ON_USER_COMMAND.
FOR EVENT before_user_command OF cl_gui_alv_grid
IMPORTING
e_ucomm
sender.
CASE e_ucomm.
....... other toolbar funcs if you have any
WHEN 'EXCEL'.
CALL METHOD me->download_to_excel.
ENDCASE.
endmethod.
3) code this method to download to EXCEL
method DOWNLOAD_TO_EXCEL.
FIELD-SYMBOLS:
<fs0> TYPE STANDARD TABLE,
<fs1> TYPE STANDARD TABLE.
ASSIGN g_outtab1->* TO <fs0>.
ASSIGN g_fldcat1->* TO <fs1>.
CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
EXPORTING
it_fieldcat_lvc = <fs1>
is_layout_lvc = m_cl_variant->ms_layout
is_tech_complete = ' '
IMPORTING
es_layout_kkblo = ls_layout
et_fieldcat_kkblo = lt_fieldcat.
LOOP AT lt_fieldcat INTO lt_fieldcat_wa.
CLEAR lt_fieldcat_wa-tech_complete.
IF lt_fieldcat_wa-tabname IS INITIAL.
lt_fieldcat_wa-tabname = '1'.
MODIFY lt_fieldcat FROM lt_fieldcat_wa.
ENDIF.
l_tabname = lt_fieldcat_wa-tabname.
ENDLOOP.
CALL FUNCTION 'ALV_XXL_CALL'
EXPORTING
i_tabname = l_tabname
is_layout = ls_layout
it_fieldcat = lt_fieldcat
i_title = sy-title
TABLES
it_outtab = <fs0>
EXCEPTIONS
fatal_error = 1
no_display_possible = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
endmethod.
You get nice column headings etc and decently formatted EXCEL spreadsheet.
For Office 2007 I think you need to apply a SAP note but it certainly works with OFFICE 2003 which is what we are still using.
Cheers
jimbo -
Using Excel 2008 for a Mac on my laptop
Part of toolbar has disappeared (windows, help, view, etc) --- want to restore
Need to freeze column headings but freezing option was not working prior to disappearance of tool barHi Alveretta,
Thanks for posting in MSDN forum.
This forum is for developers discussing developing issues on Windows platform. I suggest to get more effective response from
Office for mac forum.
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or
learn from your interaction with us.
Thanks for your understanding.
Best regards
Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to create a form with two column headings
I have a business request to create a data form to handle multi year data by month. This will require creating a form with two column headings - with the first row be Year and second row be month, and data entry will begin in the third row and down.
I can do multiple row headings in the layout design, but somehow can not get it to work for multiple column headings.
Thanks in advanceIf you're in the "Layout" tab, simply pull the "Years" dimension and the "Period" dimension into the Column section. Planning can be a little picky about where you "drop" the dimension as you're dragging and dropping it. Drop it in the cell directly under the letter name of the column. Other than that, there's not much to it.
Hopefully this helped,
- Jake -
How do I restore column headings in Response table after accidently deleting them? Undo doesn't work (only seems to go back one level). I also have so many headings I won't be able to type them in manually!
With the help of information from user, ptressel, in [https://support.mozilla.org/en-US/questions/1032154#answer-673322 a post here about the existence of sessionstore.js when version 33 was released], I was able to easily recover my tabs and tab groups as follows:
# close Firefox and, perhaps, allow a few seconds (30s?) for any final closing of files;
# check to see if you have a sessionstore.js file in your profile folder, named like the one I documented in my original post above;
# if it is not timestamped prior to the discovery of your problem, open the sessionstore-backups folder;
# check if the recovery.js file is suitably timestamped and, if not, the recovery.bak.
# At this point, you are likely to find that none of them are prior to your problem occuring. If so, open your backups of this folder and go through steps 2-4 to find a file prior to your problem occuring.
# When you find a file, copy it to the root of your current profile folder and name it, "sessionstore.js"
# Open Firefox. Mine opened up as desired.
This is a Windows solution. Sorry I can't comment on other platforms, but I'd bet that as this is just a file copy and renaming, it is likely the same.
For Windows users, you may find you need to sign out and login as an administrator in order to access the backups. You need not logoff your standard account, but do have Firefox closed as described above.
Hope that helps. -
How to get the Text variables in the Columns Headings
Hi,
My requirement is I need to get data for weekly wise and for the last 10 weeks also. For this purpose I used the restricted KF based on the variables (customer exit) and offset. Also used the text variable for displaying from and to days in the column headings. I am getting the right text for the first column only. But the text offset is not considering.
Ex 07/04/2007 to 07/10/2007 06/27/2007 to 07/03/2007 like that.
I used the two text variables one for from data and other for to date using the customer exit. I am getting the same text as of the first column for the subsequent columns also. Please help me for getting the right text in the columns.
Thanks,
visuHello ,
The quite simple way is to create a text variable with replacement path , as it replaces the value of customer exit used in the report.
create two text variables
First variable:
1 Replace variable with -
external characteristic key value
For interval use ---from value
2.Secod text variable
Replace variable with -
external characteristic key value
For interval use ---To value
offset start -0000 offset length0000
use these variables in the column headings.
hope it is clear,
assign points if useful -
How to display the column headings in Script
Hi Experts,
I am getting the script output like as follows.
000001 aaaaaaa
000002 bbbbbbb
but I want to maintain the column headings for these like
Material description
000001 aaaaaaa
000002 bbbbbbb
Please tell me how to maintain the headings for script ouput.
Thanks & Regards,
Nagaraju C.In the main window,
/E Item Header
HD Material,, Description
/E Item Line
HD &ITAB-MATNR&,, &ITAB-MAKTX&
HD is the paragraph format for which you have to maintain the tabs, margins etc.,
Thanks,
Srinivas -
Problem with black Genius bar and column headings
I have just installed the latest version of iTunes and when in Grid view all the column headings have a black background and also the Genius sidebar has a black background.
I have tried to create a new iTunes library and they are still black.
I have installed and uninstalled iTunes - no help.
I've checked my display settings and they are 32 bit color.To go back, reinstall from your last Lion or Snow Leopard backup.
Maybe you are looking for
-
Illustrator CS4 mac file won't open on a PC
Hi, I'm trying to open a .AI file made on Illustrator CS4 for Mac on a PC at home and it won't open. Do the two versions talk to each other or I'm just losing my time? On my PC I have CS4 as well. I've tryied saving an EPS for CS4 and CS3 and it won'
-
Filter data table in Powershell
Hi All, I have one script, where i have one datatable, from that datatable i want to get data based on one search filter. #Get the excel as csv and load in datatable... $empTable = New-Object System.Data.DataTable; $empTable = Import-Csv -Path "~\Em
-
"insufficient data for an image when i open a .pdf document
When I try to open a .pdf document that was previously ok the document opens and is blurry and i get a window which opens and says " insufficient data for an image" Please help Thanks
-
I've just been informed by the production house encoding my video into flash for the net that there's a problem with the fields interlacing that's visible on diagonal lines. They wanted the file written as dv, so I wrote it through dv-stream. Should
-
One record form for 2 table insert
Hi: I have a record form to insert a table in the User_login DB (user name, password, email). With this record form I want to also create a insert in the User_info DB and be able to pass the user email to this DB. It's this possible? The user registr