Fixed columns in dynamic report ( ?horizontal-break-table:1? )
Hi
I have a dynamic report that could strech over more than one page horozontally. I use the <?horizontal-break-table:1?> tag on my first header column to show this on every page, but I also need to show the last column on every page. That meens that I have a fixed column on each end of my dynamic report, the last one is just a signatur field so its no logic to it , but its important to show it on every page.
Any tips on this ?
PS.
Sry if this is a noob question, this is not really my knowlegde area, but have to fix it anyhow :)
Tim
Robert,
It sounds like you want a completely populated table regardless of the input data. To achieve you will need to create a "dummy table" in your database, either as an actual table, or by just doing a view, it's your choice. Here is a method for the view:
select '2009-M01' as Dim1
union
select '2009-M02' as Dim1
union
select '2009-M12' as Dim1
Next you'll have to introduce this to your universe as a "dummy table". In WebI, go to Edit Query and click add query, then add Dim1 to your result objects panel. After you run your query you can perform Merge Dimensions on Dim1 to the first dimension from your report, and voila, you'll have a fully populated table.
Thanks,
John
Similar Messages
-
hi!
i wrote an alv report. i want the first 3 columns of the report to be fixed, and let the option of scrolling to the left or to the right to the rest of the columns.
thanks
yifathi Yifat,
Try The KEY option in your field catalogue..
If this field is set, the ALV Grid Control color-codes the column as a key field and fixes this column during horizontal scrolling
regards
satesh -
Hello,
Can anyone help me out to write a vb.net script.
I need to read the column names from excel and based on that column names I need to create a table in database(I have more than one sheet in excel).
For each sheet columns will be changing and should create a table dynamically for each sheet.
Any help would be appreciated.Refer the below script to read columns in each sheet.
Dim excelfile As String = Dts.Variables("ExcelPath").Value.ToString
Dim connectionstring As String = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + excelfile + ";Extended Properties=Excel 8.0"
Dim oledbcon As New OleDb.OleDbConnection(connectionstring)
oledbcon.Open()
Dim dt As DataTable
Dim schemaTable As DataTable
Dim OLEDBCMD As New OleDb.OleDbCommand
Dim oledbdatareader As OleDb.OleDbDataReader
Dim columns As String = ""
dt = oledbcon.GetSchema("Tables")
Dim TABCOMMAND(20) As String
Dim TABCOUNT As Integer = 0
For Each row As DataRow In dt.Rows
TABCOMMAND(TABCOUNT) = "SELECT * FROM [" & row.Item("TABLE_NAME").ToString & "]"
OLEDBCMD.CommandText = TABCOMMAND(TABCOUNT)
OLEDBCMD.Connection = oledbcon
oledbdatareader = OLEDBCMD.ExecuteReader(CommandBehavior.KeyInfo)
schemaTable = oledbdatareader.GetSchemaTable()
For Each myfield As DataRow In schemaTable.Rows
For Each myproperty As DataColumn In schemaTable.Columns
If myproperty.ColumnName = "ColumnName" Then
columns = columns & myfield(myproperty).ToString & ","
MsgBox(myfield(myproperty).ToString)
End If
Next
Next
oledbdatareader.Close()
OLEDBCMD.Dispose()
Next
oledbcon.Close()
Regards, RSingh -
Find (fix) column number in report list
Dear ABAPers,
Currently I develop a report that can show detail level. I use standard list to display the report.
In this report I have 3 main fields (FIN Doc No, PO No, and OLA No) in one line that if they are double clicked they will go to another different page.
The challege is to find out which one on the list that is double clicked, is it FIN No, PO No, or OLA No.
I use sy-cucol to find the column number but I just notice that sy-cucol will count the column from the beginning of screen shown, not from the very beginning of report. So sy-cucol is number of column relative to SAP left screen side. What I need is number of column fixed from the very beginning of report.
For example:
I write field to list as follow
WRITE: /2 T_OUT-BELNR,
160 T_OUT-EBELN,
182 T_OUT-KONNR.
And the screen listener as follow
IF sy-lsind = 1.
IF sy-cucol > 2 AND sy-cucol < 13.
"user double click on FIN Doc No
"routine for FIN Doc No
ELSEIF sy-cucol > 159 AND sy-cucol < 182.
"user double click on PO No
"routine for PO No
ELSEIF sy-cucol > 181 AND sy-cucol < 200.
"user double click on OLA No
"routine for OLA No
ENDIF.
ENDIF.
However this code doesn't work because when I scroll the screen to right sy-cucol is recalculate from 0 in the very left side of screen. So it means that sy-cucol will differenciate when I scroll the report to the right - left.
Does any body have solution for it? Are there any other system field that can replace sy-cucol?
Thanks
Regards
HadiHi,
Use the statement GET CURSOR FIELD XX to determine the column in the list.
Sample code.
TABLES mara.
DATA it_mara TYPE TABLE OF mara.
DATA wa_mara TYPE mara.
DATA gv_field TYPE char30.
SELECT-OPTIONS: s_matnr FOR mara-matnr.
START-OF-SELECTION.
SELECT *
FROM mara
INTO TABLE it_mara
WHERE matnr IN S_matnr.
IF sy-subrc = 0.
LOOP AT it_mara INTO wa_mara.
WRITE:/ wa_mara-mandt, wa_mara-matnr,wa_mara-mtart.
HIDE: wa_mara-mandt, wa_mara-matnr.
ENDLOOP.
ENDIF.
AT LINE-SELECTION.
CASE sy-lsind.
WHEN 1.
GET CURSOR FIELD gv_field.
WRITE 'TEST1'.
ENDCASE.
Regards,
Vasanth -
HOW TO FIX COLUMN IN BEX REPORT
Hello Gurus,
I have created BEX report in which user want 1st two column (Material and its describtion) to be fixed as if he want to check all relavent result related to Material the first 2 column should not be move it should be fixed and rest other results and other column should move,Hi Wajid,
The VBA code i gave earlier will do this automatically for your users. Please use it. It freezest columns A and B so that columns A and B dont move even if your users scroll to the right. It just stays there.
In your workbook after you have inserted your query, go to Tools->Macro->Visual Basic Editor. Then go to Insert Menu->Module. Double click the module that have been created (probable name is Module1) and then on the code editor paste this code:
Public Sub SAPBEXonRefresh(queryID As String, resultArea As Range)
Range("C1").Select
ActiveWindow.FreezePanes = True
End Sub
Everytime the users refresh your query it will freeze the first to columns. So at least you are sure that the columns A and B are frozen. -
To make different colours for the columns of ALV report in Grid display.
Hai Friends,
I have created an ALV report in grid display method by using the call function reuse_alv_grid_display.
I have obtained the report.In that report i want to change the colour of each column.Plz provide the answer with a sample program.
Thank u.hi i had a program for the rows with diff colors....do the same thing for the columns..
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
line_color(4) type c, "Used to store row color attributes
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
form build_fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
Set layout field for row attributes(i.e. color)
gd_layout-info_fieldname = 'LINE_COLOR'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
data: ld_color(1) type c.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
*Populate field with color attributes
loop at it_ekko into wa_ekko.
ld_color = ld_color + 1.
Only 7 colours so need to reset color value
if ld_color = 8.
ld_color = 1.
endif.
concatenate 'C' ld_color '10' into wa_ekko-line_color.
wa_ekko-line_color = 'C410'.
modify it_ekko from wa_ekko.
endloop.
endform. " DATA_RETRIEVAL
regards,
venkat -
How to create report with Fixed Labels and Dynamic Columns
I have static column labels in left side of report and field in 3 columns coming dynamically from 3 different command queries.
Please let me know how to create it..Following is the sample data for report.Following is the sample report. Left side lables are fixed.
I tried using pivot table functionality, earlier discussed in the forum.
But they are creating huge no.of records. As it will turn the rows into columns.
Is there any way to get this report done normally.? -
Matrix report with dynamic and fixed columns
Hi all,
I have a matrix report which has dynamic as well as few fixed columns.
It is a fixed asset Report in which the sum(cost) in cell should be grouped according to column and row-wise.
The row consists of the activity such as additions, retirements etc and the dynamic column is the category and other fixed columns such as CIP cost, CWIP cost will be grouped only according to row.
the actual layout should be like this
| category 1 | category 2 | category 3 ...... | CIP cost | CWIP cost
Additions | Sum(cost) | Sum(cost) | Sum(cost) .......| 1234 | 4500
retirements | Sum(cost) | Sum(cost) | Sum(cost) .......| 1000 | 2500but due to fixed colums in the layout the report builder pushes the fixed colums to the next row with single query i get
| category 1 | category 2 | category 3 ...... |
Additions | Sum(cost) | Sum(cost) | Sum(cost) .......|
CIP cost | CWIP cost
1234 | 4500
retirements | Sum(cost) | Sum(cost) | Sum(cost) .......|
CIP cost | CWIP cost
1000 | 2500if i try to add those columns alone in a seperate query and then build the report i get the layout like this
| category 1 | category 2 | category 3 ...... |
Additions | Sum(cost) | Sum(cost) | Sum(cost) .......|
retirements | Sum(cost) | Sum(cost) | Sum(cost) .......|
CIP cost | CWIP cost
2234 | 7000This is my query, i have used union to get the row-wise column activity
/* Formatted on 03-Sep-12 5:23:11 PM (QP5 v5.114.809.3010) */
SELECT DISTINCT /*ASSET_ID
SUM (cost),
SUM (cip_cost),
SUM (cip_cost_pk),
cat_desc--,sub_cat_desc
,activity
FROM (-- cip cost
SELECT DISTINCT asset_id,
cost,
ytd_deprn,
deprn_amount,
deprn_reserve acc_deprn,
cost - deprn_reserve net_bk_val,
cip_cost,
cip_cost_pk,
description cat_desc,
fat_desc sub_cat_desc,
activity
FROM (SELECT DISTINCT
fb.asset_id,
fb.cost,
facc.cost cip_cost,
0 cip_cost_pk,
ds.ytd_deprn,
ds.deprn_reserve,
fc.description,
fat.description fat_desc,
ds.deprn_amount,
DECODE (
facc.asset_type
|| '-'
|| fc.segment1
|| '-'
|| di.transtype,
'CIP'
|| '-'
|| fc.segment1
|| '-'
|| 'TRANSFER',
'CIP T/F',
'CIP-0012-' || di.transtype,
'Additions Project Khalifa assets',
'CAPITALIZED-' || fc.segment1 || di.transtype,
'0',
'Additions'
activity
FROM fa_books fb,
fa_additions_b fa,
fa_methods fm,
fa_financial_inquiry_cost_v fic,
fa_categories_vl fc,
fa_capitalize_cip_v facc,
fa_additions_tl fat,
fa_deprn_summary ds,
fa_distribution_inquiry_v di
WHERE ds.asset_id = fa.asset_id
AND fb.asset_id = fa.asset_id
AND fb.asset_id = fic.asset_id
AND di.asset_id = fb.asset_id
AND fb.life_in_months = fm.life_in_months
AND fb.book_type_code = ds.book_type_code
AND fb.book_type_code = fic.book_type_code
AND fa.last_update_date >
TO_DATE (
'01'
|| 'JAN'
|| TO_CHAR (SYSDATE, 'RRRR'),
'DD-MON-RRRR'
AND ds.deprn_run_date =
(SELECT DISTINCT MAX (deprn_run_date)
FROM fa_deprn_summary
WHERE asset_id = fb.asset_id)
AND fic.transaction_header_id_in =
(SELECT DISTINCT
MAX (transaction_header_id_in)
FROM fa_financial_inquiry_cost_v
WHERE asset_id = fb.asset_id)
AND fb.date_effective =
(SELECT DISTINCT MAX (date_effective)
FROM fa_books
WHERE asset_id = fb.asset_id)
AND di.transaction_header_id =
(SELECT DISTINCT
MAX (transaction_header_id)
FROM fa_distribution_inquiry_v
WHERE asset_id = fb.asset_id)
AND fa.attribute_category_code =
fc.segment1 || '-' || fc.segment2
AND fc.segment1 <> '0012'
AND fb.asset_id = facc.asset_id
AND fa.asset_id = fat.asset_id
--AND facc.asset_type <> 'CAPITALIZED'
AND fb.deprn_method_code = fm.method_code
AND ds.deprn_source_code <> 'BOOKS'
AND DECODE (
facc.asset_type || '-' || fc.segment1,
'CIP-0012',
'Additions Project Khalifa assets',
'CAPITALIZED-' || fc.segment1,
'0',
'Additions'
) <> '0'/*ORDER BY fb.asset_id*/
UNION
--cip cost pk
SELECT DISTINCT asset_id,
cost,
ytd_deprn,
deprn_amount,
deprn_reserve acc_deprn,
cost - deprn_reserve net_bk_val,
cip_cost,
cip_cost_pk,
description cat_desc,
fat_desc sub_cat_desc,
activity
FROM (SELECT DISTINCT
fb.asset_id,
fb.cost,
0 cip_cost,
facc.cost cip_cost_pk,
ds.ytd_deprn,
ds.deprn_reserve,
fc.description,
fat.description fat_desc,
ds.deprn_amount,
DECODE (
facc.asset_type
|| '-'
|| fc.segment1
|| '-'
|| di.transtype,
'CIP'
|| '-'
|| fc.segment1
|| '-'
|| 'TRANSFER',
'CIP T/F',
'CIP-0012-' || di.transtype,
'Additions Project Khalifa assets',
'CAPITALIZED-' || fc.segment1 || di.transtype,
'0',
'Additions'
activity
FROM fa_books fb,
fa_additions_b fa,
fa_methods fm,
fa_financial_inquiry_cost_v fic,
fa_categories_vl fc,
fa_capitalize_cip_v facc,
fa_additions_tl fat,
fa_deprn_summary ds,
fa_distribution_inquiry_v di
WHERE ds.asset_id = fa.asset_id
AND fb.asset_id = fa.asset_id
AND fb.asset_id = fic.asset_id
AND di.asset_id = fb.asset_id
AND fb.life_in_months = fm.life_in_months
AND fb.book_type_code = ds.book_type_code
AND fb.book_type_code = fic.book_type_code
AND fa.last_update_date >
TO_DATE (
'01'
|| 'JAN'
|| TO_CHAR (SYSDATE, 'RRRR'),
'DD-MON-RRRR'
AND ds.deprn_run_date =
(SELECT DISTINCT MAX (deprn_run_date)
FROM fa_deprn_summary
WHERE asset_id = fb.asset_id)
AND fic.transaction_header_id_in =
(SELECT DISTINCT
MAX (transaction_header_id_in)
FROM fa_financial_inquiry_cost_v
WHERE asset_id = fb.asset_id)
AND fb.date_effective =
(SELECT DISTINCT MAX (date_effective)
FROM fa_books
WHERE asset_id = fb.asset_id)
AND di.transaction_header_id =
(SELECT DISTINCT
MAX (transaction_header_id)
FROM fa_distribution_inquiry_v
WHERE asset_id = fb.asset_id)
AND fa.attribute_category_code =
fc.segment1 || '-' || fc.segment2
AND fc.segment1 = '0012'
AND fb.asset_id = facc.asset_id
AND fa.asset_id = fat.asset_id
--AND facc.asset_type <> 'CAPITALIZED'
AND fb.deprn_method_code = fm.method_code
AND ds.deprn_source_code <> 'BOOKS'
AND DECODE (
facc.asset_type || '-' || fc.segment1,
'CIP-0012',
'Additions Project Khalifa assets',
'CAPITALIZED-' || fc.segment1,
'0',
'Additions'
) <> '0'/*ORDER BY fb.asset_id*/
UNION
-- Disposal / Transferred / Retired
( -- retired
SELECT DISTINCT asset_id,
cost,
ytd_deprn,
deprn_amount,
deprn_reserve acc_deprn,
cost - deprn_reserve net_bk_val,
cip_cost,
cip_cost_pk,
description cat_desc,
fat_desc sub_cat_desc,
activity
FROM (SELECT DISTINCT
fb.asset_id,
fb.cost,
0 cip_cost,
0 cip_cost_pk,
ds.ytd_deprn,
ds.deprn_reserve,
fc.description,
fat.description fat_desc,
ds.deprn_amount,
'Disposal / Transferred / Retired' activity
FROM fa_books fb,
fa_additions_b fa,
fa_methods fm,
fa_financial_inquiry_cost_v fic,
fa_categories_vl fc,
fa_additions_tl fat,
fa_deprn_summary ds,
fa_mass_ext_retirements_v ret
WHERE ds.asset_id = fa.asset_id
AND fb.asset_id = fa.asset_id
AND fb.asset_id = fic.asset_id
AND fb.life_in_months = fm.life_in_months
AND fb.book_type_code = ds.book_type_code
AND fb.book_type_code = fic.book_type_code
AND fa.last_update_date >
TO_DATE (
'01'
|| 'JAN'
|| TO_CHAR (SYSDATE, 'RRRR'),
'DD-MON-RRRR'
AND ds.deprn_run_date =
(SELECT DISTINCT MAX (deprn_run_date)
FROM fa_deprn_summary
WHERE asset_id = fb.asset_id)
AND fic.transaction_header_id_in =
(SELECT DISTINCT
MAX (transaction_header_id_in)
FROM fa_financial_inquiry_cost_v
WHERE asset_id = fb.asset_id)
AND fb.date_effective =
(SELECT DISTINCT MAX (date_effective)
FROM fa_books
WHERE asset_id = fb.asset_id)
AND fa.attribute_category_code =
fc.segment1 || '-' || fc.segment2
AND fb.asset_id = ret.asset_id
AND fa.asset_id = fat.asset_id
AND fb.deprn_method_code = fm.method_code
AND ds.deprn_source_code <> 'BOOKS'/*ORDER BY fb.asset_id*/
UNION
--transfer
SELECT DISTINCT asset_id,
cost,
ytd_deprn,
deprn_amount,
deprn_reserve acc_deprn,
cost - deprn_reserve net_bk_val,
cip_cost,
cip_cost_pk,
description cat_desc,
fat_desc sub_cat_desc,
activity
FROM (SELECT DISTINCT
fb.asset_id,
fb.cost,
facc.cost cip_cost,
0 cip_cost_pk,
ds.ytd_deprn,
ds.deprn_reserve,
fc.description,
fat.description fat_desc,
ds.deprn_amount,
'Disposal / Transferred / Retired' activity
FROM fa_books fb,
fa_additions_b fa,
fa_methods fm,
fa_financial_inquiry_cost_v fic,
fa_categories_vl fc,
fa_capitalize_cip_v facc,
fa_additions_tl fat,
fa_deprn_summary ds,
fa_distribution_inquiry_v di
WHERE ds.asset_id = fa.asset_id
AND fb.asset_id = fa.asset_id
AND fb.asset_id = fic.asset_id
AND di.asset_id = fb.asset_id
AND fb.life_in_months = fm.life_in_months
AND fb.book_type_code = ds.book_type_code
AND fb.book_type_code = fic.book_type_code
AND fa.last_update_date >
TO_DATE (
'01'
|| 'JAN'
|| TO_CHAR (SYSDATE, 'RRRR'),
'DD-MON-RRRR'
AND ds.deprn_run_date =
(SELECT DISTINCT MAX (deprn_run_date)
FROM fa_deprn_summary
WHERE asset_id = fb.asset_id)
AND fic.transaction_header_id_in =
(SELECT DISTINCT
MAX (transaction_header_id_in)
FROM fa_financial_inquiry_cost_v
WHERE asset_id = fb.asset_id)
AND fb.date_effective =
(SELECT DISTINCT MAX (date_effective)
FROM fa_books
WHERE asset_id = fb.asset_id)
AND di.transaction_header_id =
(SELECT DISTINCT
MAX (transaction_header_id)
FROM fa_distribution_inquiry_v
WHERE asset_id = fb.asset_id
AND transtype = 'TRANSFER')
AND fa.attribute_category_code =
fc.segment1 || '-' || fc.segment2
AND fb.asset_id = facc.asset_id
AND fa.asset_id = fat.asset_id
AND facc.asset_type = 'CAPITALIZED'
AND fb.deprn_method_code = fm.method_code
AND ds.deprn_source_code <> 'BOOKS'/*ORDER BY fb.asset_id*/
GROUP BY cat_desc, activity
ORDER BY activityBrgds,
MaxHi all,
I have a matrix report which has dynamic as well as few fixed columns.
It is a fixed asset Report in which the sum(cost) in cell should be grouped according to column and row-wise.
The row consists of the activity such as additions, retirements etc and the dynamic column is the category and other fixed columns such as CIP cost, CWIP cost will be grouped only according to row.
the actual layout should be like this
| category 1 | category 2 | category 3 ...... | CIP cost | CWIP cost
Additions | Sum(cost) | Sum(cost) | Sum(cost) .......| 1234 | 4500
retirements | Sum(cost) | Sum(cost) | Sum(cost) .......| 1000 | 2500but due to fixed colums in the layout the report builder pushes the fixed colums to the next row with single query i get
| category 1 | category 2 | category 3 ...... |
Additions | Sum(cost) | Sum(cost) | Sum(cost) .......|
CIP cost | CWIP cost
1234 | 4500
retirements | Sum(cost) | Sum(cost) | Sum(cost) .......|
CIP cost | CWIP cost
1000 | 2500if i try to add those columns alone in a seperate query and then build the report i get the layout like this
| category 1 | category 2 | category 3 ...... |
Additions | Sum(cost) | Sum(cost) | Sum(cost) .......|
retirements | Sum(cost) | Sum(cost) | Sum(cost) .......|
CIP cost | CWIP cost
2234 | 7000This is my query, i have used union to get the row-wise column activity
/* Formatted on 03-Sep-12 5:23:11 PM (QP5 v5.114.809.3010) */
SELECT DISTINCT /*ASSET_ID
SUM (cost),
SUM (cip_cost),
SUM (cip_cost_pk),
cat_desc--,sub_cat_desc
,activity
FROM (-- cip cost
SELECT DISTINCT asset_id,
cost,
ytd_deprn,
deprn_amount,
deprn_reserve acc_deprn,
cost - deprn_reserve net_bk_val,
cip_cost,
cip_cost_pk,
description cat_desc,
fat_desc sub_cat_desc,
activity
FROM (SELECT DISTINCT
fb.asset_id,
fb.cost,
facc.cost cip_cost,
0 cip_cost_pk,
ds.ytd_deprn,
ds.deprn_reserve,
fc.description,
fat.description fat_desc,
ds.deprn_amount,
DECODE (
facc.asset_type
|| '-'
|| fc.segment1
|| '-'
|| di.transtype,
'CIP'
|| '-'
|| fc.segment1
|| '-'
|| 'TRANSFER',
'CIP T/F',
'CIP-0012-' || di.transtype,
'Additions Project Khalifa assets',
'CAPITALIZED-' || fc.segment1 || di.transtype,
'0',
'Additions'
activity
FROM fa_books fb,
fa_additions_b fa,
fa_methods fm,
fa_financial_inquiry_cost_v fic,
fa_categories_vl fc,
fa_capitalize_cip_v facc,
fa_additions_tl fat,
fa_deprn_summary ds,
fa_distribution_inquiry_v di
WHERE ds.asset_id = fa.asset_id
AND fb.asset_id = fa.asset_id
AND fb.asset_id = fic.asset_id
AND di.asset_id = fb.asset_id
AND fb.life_in_months = fm.life_in_months
AND fb.book_type_code = ds.book_type_code
AND fb.book_type_code = fic.book_type_code
AND fa.last_update_date >
TO_DATE (
'01'
|| 'JAN'
|| TO_CHAR (SYSDATE, 'RRRR'),
'DD-MON-RRRR'
AND ds.deprn_run_date =
(SELECT DISTINCT MAX (deprn_run_date)
FROM fa_deprn_summary
WHERE asset_id = fb.asset_id)
AND fic.transaction_header_id_in =
(SELECT DISTINCT
MAX (transaction_header_id_in)
FROM fa_financial_inquiry_cost_v
WHERE asset_id = fb.asset_id)
AND fb.date_effective =
(SELECT DISTINCT MAX (date_effective)
FROM fa_books
WHERE asset_id = fb.asset_id)
AND di.transaction_header_id =
(SELECT DISTINCT
MAX (transaction_header_id)
FROM fa_distribution_inquiry_v
WHERE asset_id = fb.asset_id)
AND fa.attribute_category_code =
fc.segment1 || '-' || fc.segment2
AND fc.segment1 <> '0012'
AND fb.asset_id = facc.asset_id
AND fa.asset_id = fat.asset_id
--AND facc.asset_type <> 'CAPITALIZED'
AND fb.deprn_method_code = fm.method_code
AND ds.deprn_source_code <> 'BOOKS'
AND DECODE (
facc.asset_type || '-' || fc.segment1,
'CIP-0012',
'Additions Project Khalifa assets',
'CAPITALIZED-' || fc.segment1,
'0',
'Additions'
) <> '0'/*ORDER BY fb.asset_id*/
UNION
--cip cost pk
SELECT DISTINCT asset_id,
cost,
ytd_deprn,
deprn_amount,
deprn_reserve acc_deprn,
cost - deprn_reserve net_bk_val,
cip_cost,
cip_cost_pk,
description cat_desc,
fat_desc sub_cat_desc,
activity
FROM (SELECT DISTINCT
fb.asset_id,
fb.cost,
0 cip_cost,
facc.cost cip_cost_pk,
ds.ytd_deprn,
ds.deprn_reserve,
fc.description,
fat.description fat_desc,
ds.deprn_amount,
DECODE (
facc.asset_type
|| '-'
|| fc.segment1
|| '-'
|| di.transtype,
'CIP'
|| '-'
|| fc.segment1
|| '-'
|| 'TRANSFER',
'CIP T/F',
'CIP-0012-' || di.transtype,
'Additions Project Khalifa assets',
'CAPITALIZED-' || fc.segment1 || di.transtype,
'0',
'Additions'
activity
FROM fa_books fb,
fa_additions_b fa,
fa_methods fm,
fa_financial_inquiry_cost_v fic,
fa_categories_vl fc,
fa_capitalize_cip_v facc,
fa_additions_tl fat,
fa_deprn_summary ds,
fa_distribution_inquiry_v di
WHERE ds.asset_id = fa.asset_id
AND fb.asset_id = fa.asset_id
AND fb.asset_id = fic.asset_id
AND di.asset_id = fb.asset_id
AND fb.life_in_months = fm.life_in_months
AND fb.book_type_code = ds.book_type_code
AND fb.book_type_code = fic.book_type_code
AND fa.last_update_date >
TO_DATE (
'01'
|| 'JAN'
|| TO_CHAR (SYSDATE, 'RRRR'),
'DD-MON-RRRR'
AND ds.deprn_run_date =
(SELECT DISTINCT MAX (deprn_run_date)
FROM fa_deprn_summary
WHERE asset_id = fb.asset_id)
AND fic.transaction_header_id_in =
(SELECT DISTINCT
MAX (transaction_header_id_in)
FROM fa_financial_inquiry_cost_v
WHERE asset_id = fb.asset_id)
AND fb.date_effective =
(SELECT DISTINCT MAX (date_effective)
FROM fa_books
WHERE asset_id = fb.asset_id)
AND di.transaction_header_id =
(SELECT DISTINCT
MAX (transaction_header_id)
FROM fa_distribution_inquiry_v
WHERE asset_id = fb.asset_id)
AND fa.attribute_category_code =
fc.segment1 || '-' || fc.segment2
AND fc.segment1 = '0012'
AND fb.asset_id = facc.asset_id
AND fa.asset_id = fat.asset_id
--AND facc.asset_type <> 'CAPITALIZED'
AND fb.deprn_method_code = fm.method_code
AND ds.deprn_source_code <> 'BOOKS'
AND DECODE (
facc.asset_type || '-' || fc.segment1,
'CIP-0012',
'Additions Project Khalifa assets',
'CAPITALIZED-' || fc.segment1,
'0',
'Additions'
) <> '0'/*ORDER BY fb.asset_id*/
UNION
-- Disposal / Transferred / Retired
( -- retired
SELECT DISTINCT asset_id,
cost,
ytd_deprn,
deprn_amount,
deprn_reserve acc_deprn,
cost - deprn_reserve net_bk_val,
cip_cost,
cip_cost_pk,
description cat_desc,
fat_desc sub_cat_desc,
activity
FROM (SELECT DISTINCT
fb.asset_id,
fb.cost,
0 cip_cost,
0 cip_cost_pk,
ds.ytd_deprn,
ds.deprn_reserve,
fc.description,
fat.description fat_desc,
ds.deprn_amount,
'Disposal / Transferred / Retired' activity
FROM fa_books fb,
fa_additions_b fa,
fa_methods fm,
fa_financial_inquiry_cost_v fic,
fa_categories_vl fc,
fa_additions_tl fat,
fa_deprn_summary ds,
fa_mass_ext_retirements_v ret
WHERE ds.asset_id = fa.asset_id
AND fb.asset_id = fa.asset_id
AND fb.asset_id = fic.asset_id
AND fb.life_in_months = fm.life_in_months
AND fb.book_type_code = ds.book_type_code
AND fb.book_type_code = fic.book_type_code
AND fa.last_update_date >
TO_DATE (
'01'
|| 'JAN'
|| TO_CHAR (SYSDATE, 'RRRR'),
'DD-MON-RRRR'
AND ds.deprn_run_date =
(SELECT DISTINCT MAX (deprn_run_date)
FROM fa_deprn_summary
WHERE asset_id = fb.asset_id)
AND fic.transaction_header_id_in =
(SELECT DISTINCT
MAX (transaction_header_id_in)
FROM fa_financial_inquiry_cost_v
WHERE asset_id = fb.asset_id)
AND fb.date_effective =
(SELECT DISTINCT MAX (date_effective)
FROM fa_books
WHERE asset_id = fb.asset_id)
AND fa.attribute_category_code =
fc.segment1 || '-' || fc.segment2
AND fb.asset_id = ret.asset_id
AND fa.asset_id = fat.asset_id
AND fb.deprn_method_code = fm.method_code
AND ds.deprn_source_code <> 'BOOKS'/*ORDER BY fb.asset_id*/
UNION
--transfer
SELECT DISTINCT asset_id,
cost,
ytd_deprn,
deprn_amount,
deprn_reserve acc_deprn,
cost - deprn_reserve net_bk_val,
cip_cost,
cip_cost_pk,
description cat_desc,
fat_desc sub_cat_desc,
activity
FROM (SELECT DISTINCT
fb.asset_id,
fb.cost,
facc.cost cip_cost,
0 cip_cost_pk,
ds.ytd_deprn,
ds.deprn_reserve,
fc.description,
fat.description fat_desc,
ds.deprn_amount,
'Disposal / Transferred / Retired' activity
FROM fa_books fb,
fa_additions_b fa,
fa_methods fm,
fa_financial_inquiry_cost_v fic,
fa_categories_vl fc,
fa_capitalize_cip_v facc,
fa_additions_tl fat,
fa_deprn_summary ds,
fa_distribution_inquiry_v di
WHERE ds.asset_id = fa.asset_id
AND fb.asset_id = fa.asset_id
AND fb.asset_id = fic.asset_id
AND di.asset_id = fb.asset_id
AND fb.life_in_months = fm.life_in_months
AND fb.book_type_code = ds.book_type_code
AND fb.book_type_code = fic.book_type_code
AND fa.last_update_date >
TO_DATE (
'01'
|| 'JAN'
|| TO_CHAR (SYSDATE, 'RRRR'),
'DD-MON-RRRR'
AND ds.deprn_run_date =
(SELECT DISTINCT MAX (deprn_run_date)
FROM fa_deprn_summary
WHERE asset_id = fb.asset_id)
AND fic.transaction_header_id_in =
(SELECT DISTINCT
MAX (transaction_header_id_in)
FROM fa_financial_inquiry_cost_v
WHERE asset_id = fb.asset_id)
AND fb.date_effective =
(SELECT DISTINCT MAX (date_effective)
FROM fa_books
WHERE asset_id = fb.asset_id)
AND di.transaction_header_id =
(SELECT DISTINCT
MAX (transaction_header_id)
FROM fa_distribution_inquiry_v
WHERE asset_id = fb.asset_id
AND transtype = 'TRANSFER')
AND fa.attribute_category_code =
fc.segment1 || '-' || fc.segment2
AND fb.asset_id = facc.asset_id
AND fa.asset_id = fat.asset_id
AND facc.asset_type = 'CAPITALIZED'
AND fb.deprn_method_code = fm.method_code
AND ds.deprn_source_code <> 'BOOKS'/*ORDER BY fb.asset_id*/
GROUP BY cat_desc, activity
ORDER BY activityBrgds,
Max -
Need to fix the width of a column in interactive report
Hi,
I have a column named 'Comment'. Its have a huge data due to which the lenght of that column in interactive report get increased. I need to fix the length to a desired value.
I used following code in Region Footer:
<style>
table.apexir_WORKSHEET_DATA td[headers=COMMENTS] {
_width: 300px;
min-width: 50px;
max-width: 300px }
</style>
Its solved the problem by fixing the width of the column but the column is not showing the full data now. It is hiding most of its part to fit it in that column.
Please give some idea.
Thanks,
ChandruHi,
I believe you will want to add a height specification to allow for multiple lines. And you may want/need to specifiy how you want lines to wrap.
Add (for example):
height: 60px;
white-space: nowrap;
word-wrap: break-word;
There are defaults and several options for white-space and word-wrap. You may want to look them up and give them a try for comparison.
Howard -
How to fix Width of column in classic report.
Dear Friends
i am using Apex 3.2.
i have created Clasic Report and i have summary column in my report that column have description of issue so i want to fix width of that column nn Classic report .
i have try some code in html expression
<span>style="width: 480px; display: block; white-space: normal; font-size: 11px;">#ACTIVITY_SUMMARY#</span>
{code
after apply abovemention code that display me in my summary like this and not manage width of column.
style="width: 480px; display: block; white-space: normal; font-size: 11px;">Dear Cherryl, Greetings !! Thank you very much for the new query and we are pleased to confirm the availability of one single cabin in all the three categories of cabin on M.V. Mahabaahu. We would like to inform you that both the departures 15th Oct 2013 & 29th Oct 2013 (Golden triangle with Cruise) are operational and attached are the prices for your kind consideration. As a special promotion for the 15th Oct 2013 departure only, we are offering USD 100 per person reduction on the Golden triangle portion combined with the cruise. Kindly review and advise us to block the accommodation accordingly. Regards...pankaj
How to fix Width of column in classic report.
ThanksHi,
I'm working an example in APEX 4.2 so YMMV (your milage may vary!).
For Classic Reports, where the Column Attributes "Display As" is set to Display as Text (escape special characters ...:
1) I find that Column width and Element Width setting have no effect to make the column smaller or larger.
2) Here is one way that works:
- In the Region's Region Definition, under Attributes give the Static ID a name (no spaces), say, class-report.
- In the columns you want to affect, place "<div>#ENAME#</div>" in the columns Column Formatting "HTML Expression". Where "ENAME" here is the actual column name.
I'm using the EMP table as an example.
- Finally, in the page's HTML Header put, for example
<style>
#classic-report td.data[headers="ENAME"] div {
width: 200px;
color: blue;
#classic-report td.data[headers="JOB"] div {
width: 50px;
white-space: nowrap;
word-wrap: break-word;
</style>This makes the ENAME column wider and the JOB column smaller and wraps it.
Much more could be said. If you tweak you will find you can also affect spacing above, below and right/left of the data.
#classic-report .report-standard th.header {
border-left: #9fa0a0 1px solid;
padding: 2px 3px 4px 5px; /* top right bottom left margins */
font-size: 11px;
font-weight: bold;
vertical-align: bottom;
#classic-report .report-standard td.data {
border-left: #9fa0a0 1px solid;
padding: 3px 4px 5px 6px;
font-size: 9px;
}Does this help?
Howard -
Creating dynamic columns in rdlc report
Hi,
I want to generate an rdlc report where columns are not fixed and decided on the basis of user input.
So I can not design the report before and it should be done dynamically at run time. I have the data in datatable.
Can anyone help how to achieve this.Hi,
You can do this by creating a crosstab report so that the column heading is from an item in the folder.
You cannot have dynamic headings for a table report.
Rod West -
halo fellow SAPiens,
i need to show dynamic columns for a particular material........the scenario is as follows....
1) there r 7 fixed columns describing the material...
2)when the material returns back to the plant for some reason , i need to insert a column which shows the date and reason(char) of return.
3)again after dispatching the material for some reason it comes back again a new column shld be displayed showin the date and reason(char).
4)if the material doesnt come back...the report shows only 7 columns.
any solution?try <a href="http://www.alvrobot.com.ar/home.php">here</a> ......its a useful tool for dealing with ALV
<b>reward points if useful</b> -
Designing Dynamic column in BI Report Template
Hi,
In one of my report i have a table grid where the columns are dynamic.How do i design dynamic column in BI rtf Template
Is it possible to hide/Show column for BI report
Please advice
Regards
JeethiHi ,
Check the below link
http://download.oracle.com/docs/cd/E10091_01/doc/bip.1013/b40017/T421739T481157.htm#4535400
search for the Column Formatting you will find the example for dynamic cloumn creation.
Thanks,
Ananth -
To increase dynamically columns in ALV report
hi everyone,
Could any one give me a sample code ,to increase columns in ALV report output dynamically as record increase, i need to increase columns so that i can keep all the years data of a particular project in one rowPlease refer to the code piece
*& Report ZTEST_DYNAMIC_ALV
REPORT ztest_dynamic_alv.
DATA: gt_fcat TYPE lvc_t_fcat,
gw_grid TYPE REF TO cl_gui_alv_grid.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-s01.
PARAMETERS: p_number TYPE i.
SELECTION-SCREEN : END OF BLOCK b1.
** Start of Selection
START-OF-SELECTION.
*1) Create Base Catalog
PERFORM sub_create_base_catalog.
*2) Add additional fields
PERFORM sub_fill_addtional.
*3) Display output data.
PERFORM sub_display_output.
*& Form SUB_CREATE_BASE_CATALOG
* Create Base catalog for display
FORM sub_create_base_catalog .
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZSTRCT'
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
ENDFORM. " SUB_CREATE_BASE_CATALOG
*& Form SUB_FILL_ADDTIONAL
* text
FORM sub_fill_addtional .
DATA: lw_fcat TYPE lvc_s_fcat,
lw_from TYPE i,
lw_data TYPE REF TO data,
lw_fname TYPE stfna,
lw_index(2) TYPE n.
FIELD-SYMBOLS: <l_output> TYPE table.
DESCRIBE TABLE gt_fcat LINES lw_from.
DO p_number TIMES.
lw_from = lw_from + 1.
lw_index = sy-index.
CONCATENATE 'DYNA' lw_index INTO lw_fname SEPARATED BY '-'.
lw_fcat-col_pos = lw_from.
lw_fcat-fieldname = lw_fname.
lw_fcat-tabname = '1'.
lw_fcat-scrtext_l = lw_fcat-scrtext_m = lw_fcat-scrtext_s = lw_fname.
APPEND lw_fcat TO gt_fcat.
CLEAR lw_fcat.
ENDDO.
** Convert gt_fcat to internal table.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fcat
IMPORTING
ep_table = lw_data
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc = 0.
** Create the internal table form field catalog.
ASSIGN lw_data->* TO <l_output>.
** display the ALV data.
CREATE OBJECT gw_grid
EXPORTING
i_parent = cl_gui_container=>screen0
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc = 0.
CALL METHOD gw_grid->set_table_for_first_display
CHANGING
it_outtab = <l_output>
it_fieldcatalog = gt_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc = 0.
MESSAGE s000(zrak) WITH p_number 'DISPLAYED DYNAMICALLY'.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " SUB_FILL_ADDTIONAL
*& Form SUB_DISPLAY_OUTPUT
* text
FORM sub_display_output .
CALL SCREEN '9001'.
ENDFORM. " SUB_DISPLAY_OUTPUT
*& Module STATUS_9001 OUTPUT
* text
MODULE status_9001 OUTPUT.
SET PF-STATUS ' '.
SET TITLEBAR 'MAIN00'.
ENDMODULE. " STATUS_9001 OUTPUT
*& Module USER_COMMAND_9001 INPUT
* text
MODULE user_command_9001 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR
'CANC' OR
'%EX'.
SET SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_9001 INPUT -
Dynamically selecting column names in report builder ???
Dear members,
I have a requirement in which the user dynamically selects the tables column names. Like suppose take DEPT table. My query would be
select &P Report from dept;
so if the user selects DNAME then i would get the dname values and so on... This is fine but if one gives the value for the lexical parameter as DEPTNO,DNAME then i should get two columns in my report output. The select statement then becomes
select DEPTNO,DNAME Report from dept;
But i am not able to do this in report builder(6i). If i use just one value for the parameter then i get the o/p but if i use more than one (eg: DEPTNO,DNAME) then its giving an error.when i run this query through toad or sql plus then i am getting the desired o/p but wher as in report builder i am not able to get the o/p.
My report triggers are :
Before Parameter form :
:P := NULL;
After parameter Form :
function AfterPForm return boolean is
begin
IF :P = 'DNAME,DEPTNO' THEN
:P := ' DNAME,DEPTNO ' ;
ELSE
:P := NULL;
END IF;
return (TRUE);
end;
Your comments and suggestions are welcomed.
thanks
regards
sandeepNumber of columns can not be changed at run time. If your data model has three columns, lexical parameter should pass 3 values. If you have query like this in data model:
select &p_1 from table
Whatevere you have as initial value in user parameter p_1, data model captures that info.
Maybe you are looking for
-
Can I just plug in my external harddrive to download the saved pictures from my windows computer to my Imac?
-
Characteristic values as hyperlinks in a web report
Hi All I have a web report with only one characteristic and some key figures. And the number of values for that characteristics are 5 and they are always fixed (structure). In my report I need to make each of that characteristic value a hyper link. I
-
I keep getting a message that reads "This XML file does not appear to have any style information associated with it. The document tree is shown below." when I try to view certain images with the document tree reading something like this: <Error> <Cod
-
How can I remove the black borders after draggin in a M2TS file?
I record gaming videos with my HD PVR and the output of the file is M2TS. Everytime I drag it in Premiere, it will show small black borders at the top and to the right of the video. I knew how to do this in Vegas but am clueless on how to do it in Pr
-
Full screen contact pic troubles
full screen contact pic not possible even after 1.reset my iphone 2. take photo from phone camera in Edit Contact 3.Change Camera to HDR and interestingly, after saving pic in contact it reverts back to small pic again after a while though a couple o