Report with Dynamic Cursor
hi forum
I need your help and I hope you can help me. In my job I need to do a Report, but the function that containts the cursor returns a ref cursor and this ref cursor doesn't return a special format 'cause the cursor that I use is Dynamic so when I try to do the report it is not generated.
the documentation says that should return something for example
type vref_cursor is ref cursor[b] return record;
or
type vref_cursor is ref cursor return depto%rowtype;
but if I use this in a dynamic cursor it generates an Error and don't accpet this declaration only the following
type vref_cursor is ref cursor;
Do you Know how should I do the report with a dynamic cursor ?
best regards
thank's a lot
That is not possible. From the online help:
Each ref cursor query is associated with a PL/SQL function that returns a strongly typed ref cursor.
Similar Messages
-
How to generate report with dynamic variable number of columns?
How to generate report with dynamic variable number of columns?
I need to generate a report with varying column names (state names) as follows:
SELECT AK, AL, AR,... FROM States ;
I get these column names from the result of another query.
In order to clarify my question, Please consider following table:
CREATE TABLE TIME_PERIODS (
PERIOD VARCHAR2 (50) PRIMARY KEY
CREATE TABLE STATE_INCOME (
NAME VARCHAR2 (2),
PERIOD VARCHAR2 (50) REFERENCES TIME_PERIODS (PERIOD) ,
INCOME NUMBER (12, 2)
I like to generate a report as follows:
AK CA DE FL ...
PERIOD1 1222.23 2423.20 232.33 345.21
PERIOD2
PERIOD3
Total 433242.23 56744.34 8872.21 2324.23 ...
The TIME_PERIODS.Period and State.Name could change dynamically.
So I can't specify the state name in Select query like
SELECT AK, AL, AR,... FROM
What is the best way to generate this report?SQL> -- test tables and test data:
SQL> CREATE TABLE states
2 (state VARCHAR2 (2))
3 /
Table created.
SQL> INSERT INTO states
2 VALUES ('AK')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('AL')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('AR')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('CA')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('DE')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('FL')
3 /
1 row created.
SQL> CREATE TABLE TIME_PERIODS
2 (PERIOD VARCHAR2 (50) PRIMARY KEY)
3 /
Table created.
SQL> INSERT INTO time_periods
2 VALUES ('PERIOD1')
3 /
1 row created.
SQL> INSERT INTO time_periods
2 VALUES ('PERIOD2')
3 /
1 row created.
SQL> INSERT INTO time_periods
2 VALUES ('PERIOD3')
3 /
1 row created.
SQL> INSERT INTO time_periods
2 VALUES ('PERIOD4')
3 /
1 row created.
SQL> CREATE TABLE STATE_INCOME
2 (NAME VARCHAR2 (2),
3 PERIOD VARCHAR2 (50) REFERENCES TIME_PERIODS (PERIOD),
4 INCOME NUMBER (12, 2))
5 /
Table created.
SQL> INSERT INTO state_income
2 VALUES ('AK', 'PERIOD1', 1222.23)
3 /
1 row created.
SQL> INSERT INTO state_income
2 VALUES ('CA', 'PERIOD1', 2423.20)
3 /
1 row created.
SQL> INSERT INTO state_income
2 VALUES ('DE', 'PERIOD1', 232.33)
3 /
1 row created.
SQL> INSERT INTO state_income
2 VALUES ('FL', 'PERIOD1', 345.21)
3 /
1 row created.
SQL> -- the basic query:
SQL> SELECT SUBSTR (time_periods.period, 1, 10) period,
2 SUM (DECODE (name, 'AK', income)) "AK",
3 SUM (DECODE (name, 'CA', income)) "CA",
4 SUM (DECODE (name, 'DE', income)) "DE",
5 SUM (DECODE (name, 'FL', income)) "FL"
6 FROM state_income, time_periods
7 WHERE time_periods.period = state_income.period (+)
8 AND time_periods.period IN ('PERIOD1','PERIOD2','PERIOD3')
9 GROUP BY ROLLUP (time_periods.period)
10 /
PERIOD AK CA DE FL
PERIOD1 1222.23 2423.2 232.33 345.21
PERIOD2
PERIOD3
1222.23 2423.2 232.33 345.21
SQL> -- package that dynamically executes the query
SQL> -- given variable numbers and values
SQL> -- of states and periods:
SQL> CREATE OR REPLACE PACKAGE package_name
2 AS
3 TYPE cursor_type IS REF CURSOR;
4 PROCEDURE procedure_name
5 (p_periods IN VARCHAR2,
6 p_states IN VARCHAR2,
7 cursor_name IN OUT cursor_type);
8 END package_name;
9 /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY package_name
2 AS
3 PROCEDURE procedure_name
4 (p_periods IN VARCHAR2,
5 p_states IN VARCHAR2,
6 cursor_name IN OUT cursor_type)
7 IS
8 v_periods VARCHAR2 (1000);
9 v_sql VARCHAR2 (4000);
10 v_states VARCHAR2 (1000) := p_states;
11 BEGIN
12 v_periods := REPLACE (p_periods, ',', ''',''');
13 v_sql := 'SELECT SUBSTR(time_periods.period,1,10) period';
14 WHILE LENGTH (v_states) > 1
15 LOOP
16 v_sql := v_sql
17 || ',SUM(DECODE(name,'''
18 || SUBSTR (v_states,1,2) || ''',income)) "' || SUBSTR (v_states,1,2)
19 || '"';
20 v_states := LTRIM (SUBSTR (v_states, 3), ',');
21 END LOOP;
22 v_sql := v_sql
23 || 'FROM state_income, time_periods
24 WHERE time_periods.period = state_income.period (+)
25 AND time_periods.period IN (''' || v_periods || ''')
26 GROUP BY ROLLUP (time_periods.period)';
27 OPEN cursor_name FOR v_sql;
28 END procedure_name;
29 END package_name;
30 /
Package body created.
SQL> -- sample executions from SQL:
SQL> VARIABLE g_ref REFCURSOR
SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2,PERIOD3','AK,CA,DE,FL', :g_ref)
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
PERIOD AK CA DE FL
PERIOD1 1222.23 2423.2 232.33 345.21
PERIOD2
PERIOD3
1222.23 2423.2 232.33 345.21
SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2','AK,AL,AR', :g_ref)
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
PERIOD AK AL AR
PERIOD1 1222.23
PERIOD2
1222.23
SQL> -- sample execution from PL/SQL block
SQL> -- using parameters derived from processing
SQL> -- cursors containing results of other queries:
SQL> DECLARE
2 CURSOR c_period
3 IS
4 SELECT period
5 FROM time_periods;
6 v_periods VARCHAR2 (1000);
7 v_delimiter VARCHAR2 (1) := NULL;
8 CURSOR c_states
9 IS
10 SELECT state
11 FROM states;
12 v_states VARCHAR2 (1000);
13 BEGIN
14 FOR r_period IN c_period
15 LOOP
16 v_periods := v_periods || v_delimiter || r_period.period;
17 v_delimiter := ',';
18 END LOOP;
19 v_delimiter := NULL;
20 FOR r_states IN c_states
21 LOOP
22 v_states := v_states || v_delimiter || r_states.state;
23 v_delimiter := ',';
24 END LOOP;
25 package_name.procedure_name (v_periods, v_states, :g_ref);
26 END;
27 /
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
PERIOD AK AL AR CA DE FL
PERIOD1 1222.23 2423.2 232.33 345.21
PERIOD2
PERIOD3
PERIOD4
1222.23 2423.2 232.33 345.21 -
Submit report with dynamic selections
Hi All,
I am trying to Submit a report with dynamic selections. I am using the option SUBMIT REPORT WITH FREE SELECTIONS.
But the dynamic selections are not getting passed.
Request you to kindly provide some inputs
My code is
DATA: trange TYPE rsds_trange,
trange_line LIKE LINE OF trange,
trange_frange_t_line LIKE LINE OF trange_line-frange_t,
trange_frange_t_selopt_t_line LIKE LINE OF trange_frange_t_line-selopt_t,
texpr TYPE rsds_texpr.
trange_line-tablename = 'PA0002'.
*trange_frange_t_line-tablename = 'PA0002'.
trange_frange_t_line-fieldname = 'GBJHR'.
trange_frange_t_selopt_t_line-sign = 'I'.
trange_frange_t_selopt_t_line-option = 'EQ'.
trange_frange_t_selopt_t_line-low = '1987'.
trange_frange_t_selopt_t_line-high = '1987'.
APPEND trange_frange_t_selopt_t_line TO trange_frange_t_line-selopt_t.
APPEND trange_frange_t_line TO trange_line-frange_t.
APPEND trange_line TO trange.
CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_EX'
EXPORTING
field_ranges = trange
IMPORTING
expressions = texpr.
submit RPCADVQ0
VIA SELECTION-SCREEN
WITH SELECTION-TABLE rspar_tab
WITH FREE SELECTIONS it_texpr
and returN.
Kindly provide your inputs
Regards
ReshmaHi Reshma,
Use the FM - RS_REFRESH_FROM_DYNAMICAL_SEL before FREE_SELECTIONS_RANGE_2_EX.
data: trange type rsds_trange,
g_repid type sy-repid.
g_repid = 'RPCADVQ0'.
call function 'RS_REFRESH_FROM_DYNAMICAL_SEL'
exporting
curr_report = g_repid
mode_write_or_move = 'M'
importing
p_trange = trange
exceptions
not_found = 1
wrong_type = 2
others = 3.
if sy-subrc eq 0.
" Do the changes to the trange
CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_EX'
EXPORTING
field_ranges = trange
IMPORTING
expressions = texpr.
submit RPCADVQ0
VIA SELECTION-SCREEN
WITH SELECTION-TABLE rspar_tab
WITH FREE SELECTIONS it_texpr
and returN.
endif.
Cheers,
Kothand -
How to schedule a report with dynamic parameters
We need to schedule a Webi report with dynamic parameters then email the different result to different email groups. Is it possible to do this in scheduler? Please advise. Thanks.
there are 2 schedulers
1st CMS
the reports which does not have any input parameters, only then t can be scheduled in CMS
2nd in Infoview
if report has input parameters and if you want to schedule it, then you may need to schedule the report from Infoview
To have a email notification
configure the SMTP server in report JOB Server
Thanks,
Ganesh -
Unable to save the Crystal Report with Dynamic paramters in Enterprise
Hello,
We are not able to save our Crystal Report with dynamic parameters in Enterprise, Error message as follows :
"Failed to read data from report file C:\DOCUME1\...\crw{...}.rpt. Reason : Failed to read parameter object"
CR Developer Version 12.0.0.683
help us in this regard..
thanks,
Narasimha MurtyHello,
The error message occurs because the user or group who created the LOV does not have the appropriate rights in Business View Manager.
Try this hope its helps
To resolve this issue follow the steps,
1.Log on to Business View Manager as administrator.
2.Click View > Repository Explorer.
3.Right-click Dynamic Cascading Prompts. Click Edit Rights.
4.Click the appropriate user or group receiving the error.
5.Click the Granted option for the right to View, Edit & Set Security rights.
6.Click OK. Close Business View Manager.
The user or group is now able to save a report with dynamic parameters to Enterprise.
Regards,
Vinay -
How to create user editable Crystal Report with dynamic dataset
What I would like to achieve:
A program loads a report in runtime updates list of database fields (possibly includes sample data), open report in "Crystal Reports 2011" (or 2008) where user customizes report and saves it. Later on the program loads the report, fills actualized data and displays it in .net report viewer.
What I do:
CrReport = New CrystalDecisions.CrystalReports.Engine.ReportDocument
CrReport.Load(TemplateFilename)
Dim Results As DataTable
DataTable is filled from a database
CrReport.SetDataSource(mResults)
CrReport.SaveAs(NewReportPath, True)
The NewReportPath is opened in the default program.
What are the problems
The report is open in preview mode (not in design).
When the field is added to the report the designer asks for XML datasource on preview.The short answer is that it is not possible. I broke the question to other two: How to save a report that it opens without preview? and How to create user editable Crystal Report with dynamic dataset, where it is possible to find details. Key answer is Re: How to create an editable previewable report?
-
I’m getting the below issue when I try to deploy a crystal report with Dynamic parameters in BI Launch Pad, when I deploy the same report with static parameters I can deploy and run it. I have Restarted the BI server, still the issue exitno use. kindly help me on this issue.
“This error occurred: Adding Crystal Report "CrystalReport1.rpt" failed. The server with kind rptappserver returned an error result. Failed to copy the report file to the report object. Refreshing the report object properties might have failed. Failed to read data from report file CrystalReport1. Reason: Failed to read parameter object”.BO does not run dynamic params through the report as would happen without BusinessObjects (BO) or Crystal Reports Server (CRS). When you publish a report with dynamic parameters to BO/CRS, the prompt is published to the repository so that it can be accessed through the Business View Manager (which can be installed as part of the client tools). In order for this to work a couple of things need to happen:
1. You need to be sure that you check the "Update Repository" box on the Save As screen the first time you publish the report.
2. Your BO/CRS user needs to have "view" access to the Crystal2013ReportApplicationServer in the Servers section in the CMC - in fact, the Everyone group should be given view access to the server in order for dynamic prompts to work correctly.
3. In the Business View Manager, the Administrator user needs to give your user, or, even better, a Crystal Developers group full control access to the "Dynamic Cascading Prompts" folder.
Best practice for dynamic prompts in a BO/CRS environment is to actually create the prompts in the Business View Manager. This will allow you to create a single data connection that can be reused and also create lists of values such that the same list or prompt can be reused by multiple reports. If you just create the prompts in Crystal, you will end up with multiple data connections to the same database, the prompts will use the whole query for the reports to get the dynamic values instead of just a focused query to the lookup table that contains the values, and there ends up being lots of duplication and chaos.
-Dell -
How to create a report with dynamic columns
Hi all,
I am using Apex 4.0 with Oracle 10g
I am creating a report and I need to display columns dynamically based on the item values.
example:
I have a table employee with columns name, designation, sal
In the report page i have a select list with designations and when I select a designation from the select list,
I need to display the names of the employees horizontally,
like each name as a new column in the report with that particular designation. and same has to continue when I select different designations.
Can some one help me how we can do that.
I appreciate your answer
Thanks,
RikEssentially you want to write a pl/sql function which returns a varchar2 string. The contents of the string must be a valid sql statement.
Once you have done this, you need to add a report region as type sql report and you will have the option of writing it as a query or as a function returning query. Choose function returning query and enter in the function call.
Note your function must be valid, and must be executable by your apex parsing schema.
example:
create or replace
function test_report( p1_tablename in varchar2)
return varchar2
is
v_query varchar2(4000);
begin
v_query :=
'SELECT * from '||p_tablename;
return v_query;
end test_report;Edited by: Keith Jamieson on Aug 15, 2011 4:50 PM -
Crystal Report Viewer Credential Prompt for Report with Dynamic Parameters
The .NET Crystal Report Viewer is prompting for database credentials when launching a report containing dynamic parameters. This only occurs for reports created with SAP Crystal Reports 2011 designer. Reports created with Crystal Reports XI designer (where dynamic parameters were first introduced) work correctly.
The credential prompt window contains the following fields:
- Server Name: <server name> (disabled)
- Database Name: <database name> (disabled)
- User Name: <empty> (enabled)
- Password: <empty> (enabled)
- Use Single Signon Key: false (disabled)
The values in the prompt window which are disabled are the database connection values used during the design of the report in the SAP Crystal Reports 2011 designer.
Expected Result:
- No prompt for database credentials.
- Values read from the database should be populated in a drop down for the dynamic parameters.
Environment:
- Visual Studio 2010 (C#)
- Windows 7 Enterprise
- SAP Crystal Reports runtime engine for .NET Framework 4
- SAP Crystal Reports, version for Visual Studio 2010
- SAP Crystal Reports 2011
The database connection is being set to use a DSN. It must be a DSN as the calling application is only aware of the DSN/Username/Password values. These values are being passed to the Crystal Report Viewer contained in a Windows form.
The database connection for the report is being set as follows:
foreach (InternalConnectionInfo internalConnectionInfo in this.report.DataSourceConnections)
// Must set the UseDSNProperties flag to True before setting the database connection otherwise the connection does not work
if (internalConnectionInfo.LogonProperties.ContainsKey("UseDSNProperties"))
internalConnectionInfo.LogonProperties.Set("UseDSNProperties", true);
// Supposed to set the database connection for all objects in the report (ie. main report, tables, sub reports)
internalConnectionInfo.SetConnection(this.DSN, string.Empty, this.LoginName, this.Password);
The SetConnection method's signature is as follows:
SetConnection(string server, string database, string name, string password)
As you can see from the code snippet above I am setting the DSN name as the server parameter, blank for the database parameter (a database connection using DSN should only require DSN name/Username/Password) and the database username and password respectively.
Is this a SAP bug?
Is this the correct way of setting the database connection to use a DSN?
Is there some other properties that need to be set somewhere else in the report through code?
Any help would be greatly appreciated.Thanks for the pointer to the database connection code generator. After taking a look at the output from the tool I was able to finally get the dynamic parameters to load and populate properly without prompting for credentials. I needed to tweak the outputted code a bit to match my requirements of using a DSN only connection.
Instead of updating the database connection properties contained within the Report.Database.Tables collection from the CrystalReports.Engine namespace, I changed it to replace the database connection properties in the Report.ReportClientDocument.DatabaseController.Database.Tables collection from the CrystalDecisions.ReportAppServer.DataDefModel namespace. For one reason or another, using the RAS namespace solved the problem.
Below is the updated code with the change made:
using RAPTable = CrystalDecisions.ReportAppServer.DataDefModel.Table;
foreach (InternalConnectionInfo internalConnectionInfo in this.report.DataSourceConnections)
// Must set the UseDSNProperties flag to True before setting the database connection
if (internalConnectionInfo.LogonProperties.ContainsKey("UseDSNProperties"))
internalConnectionInfo.LogonProperties.Set("UseDSNProperties", true);
// Sets the database connection for all objects in the report (ie. main report, tables, sub reports)
internalConnectionInfo.SetConnection(this.DSN, string.Empty, this.LoginName, this.Password);
// The attributes for the QE_LogonProperties which is part of the main property bag
PropertyBag innerPropertyBag = new PropertyBag();
innerPropertyBag.Add("DSN", this.DSN);
innerPropertyBag.Add("UserID", this.LoginName);
innerPropertyBag.Add("Password", this.Password);
innerPropertyBag.Add("UseDSNProperties", "true");
// The attributes collection of the tables ConnectionInfo object
PropertyBag mainPropertyBag = new PropertyBag();
mainPropertyBag.Add("Database DLL", "crdb_ado.dll");
mainPropertyBag.Add("QE_DatabaseType", "OLE DB (ADO)");
mainPropertyBag.Add("QE_LogonProperties", innerPropertyBag);
// Pass the database properties to a connection info object
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.Attributes = mainPropertyBag;
connectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
connectionInfo.UserName = this.LoginName;
connectionInfo.Password = this.Password;
// Replace the database connection properties of each table in the report
foreach (RAPTable oldTable in this.report.ReportClientDocument.DatabaseController.Database.Tables)
RAPTable table = new RAPTable();
table.ConnectionInfo = connectionInfo;
table.Name = oldTable.Name;
table.QualifiedName = oldTable.QualifiedName;
table.Alias = oldTable.Alias;
this.report.ReportClientDocument.DatabaseController.SetTableLocation(oldTable, table);
this.report.VerifyDatabase();
Thanks again Ludek for the help. -
Struggling to create reports with dynamic names.... need help
Hi everyone
The reports that I create need to be named with dynamic content from the database. I did try to find if such an option exists in oracle portal, but alas to no avail. My report templates are going to be the same , but as the report content changes so should the report title. Does anyone has a solution to my problem
Thanx in anticipationsorry ..it was silly of me ... i just found out the solution
-
ALV report with dynamic columns, and repeated structure rows
Hey Guys,
I've done some ALV programming, but most of the reports were straight forward. This one is a little interesting. So here go the questions...
Q1: Regarding Columns:
What is the best way to code a report with columns being dynamic. This is one of the parameters the user is going to enter in his input.
Q2: Regarding Rows:
I want to repeat a structure(say it contains f1, f2, f3) multiple time in rows. What is the best way to do it? The labels for these fields have to appear in the first column.
Below is the visual representation of the questions.
Jan 06 , Feb 06, Mar 06....(dynamic)
material 1
Current Stock
current required
$Value of stock
material 2
Current Stock
current required
$Value of stock
material 3
Current Stock
current required
$Value of stock
Thanks for your help.
Sumit.Hi Sumit,
Just check this sample from one of the SAP site
ABAP Code Sample for Dynamic Table for ALV with Cell Coloring
Applies To:
ABAP / ALV Grid
Article Summary
ABAP Code Sample that uses dynamic programming techniques to build a dynamic internal table for display in an ALV Grid with Cell Coloring.
Code Sample
REPORT zcdf_dynamic_table.
* Dynamic ALV Grid with Cell Coloring.
* Build a field catalog dynamically and provide the ability to color
* the cells.
* To test, copy this code to any program name and create screen 100
* as described in the comments. After the screen is displayed, hit
* enter to exit the screen.
* Tested in 4.6C and 6.20
* Charles Folwell - [email protected] - Feb 2, 2005
DATA:
r_dyn_table TYPE REF TO data,
r_wa_dyn_table TYPE REF TO data,
r_dock_ctnr TYPE REF TO cl_gui_docking_container,
r_alv_grid TYPE REF TO cl_gui_alv_grid,
t_fieldcat1 TYPE lvc_t_fcat, "with cell color
t_fieldcat2 TYPE lvc_t_fcat, "without cell color
wa_fieldcat LIKE LINE OF t_fieldcat1,
wa_cellcolors TYPE LINE OF lvc_t_scol,
wa_is_layout TYPE lvc_s_layo.
FIELD-SYMBOLS:
<t_dyn_table> TYPE STANDARD TABLE,
<wa_dyn_table> TYPE ANY,
<t_cellcolors> TYPE lvc_t_scol,
<w_field> TYPE ANY.
START-OF-SELECTION.
* Build field catalog based on your criteria.
wa_fieldcat-fieldname = 'FIELD1'.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-outputlen = '10'.
wa_fieldcat-coltext = 'My Field 1'.
wa_fieldcat-seltext = wa_fieldcat-coltext.
APPEND wa_fieldcat TO t_fieldcat1.
wa_fieldcat-fieldname = 'FIELD2'.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-outputlen = '10'.
wa_fieldcat-coltext = 'My Field 2'.
wa_fieldcat-seltext = wa_fieldcat-coltext.
APPEND wa_fieldcat TO t_fieldcat1.
* Before adding cell color table, save fieldcatalog to pass
* to ALV call. The ALV call needs a fieldcatalog without
* the internal table for cell coloring.
t_fieldcat2[] = t_fieldcat1[].
* Add cell color table.
* CALENDAR_TYPE is a structure in the dictionary with a
* field called COLTAB of type LVC_T_SCOL. You can use
* any structure and field that has the type LVC_T_SCOL.
wa_fieldcat-fieldname = 'T_CELLCOLORS'.
wa_fieldcat-ref_field = 'COLTAB'.
wa_fieldcat-ref_table = 'CALENDAR_TYPE'.
APPEND wa_fieldcat TO t_fieldcat1.
* Create dynamic table including the internal table
* for cell coloring.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fieldcat1
IMPORTING
ep_table = r_dyn_table
EXCEPTIONS
generate_subpool_dir_full = 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.
* Get access to new table using field symbol.
ASSIGN r_dyn_table->* TO <t_dyn_table>.
* Create work area for new table.
CREATE DATA r_wa_dyn_table LIKE LINE OF <t_dyn_table>.
* Get access to new work area using field symbol.
ASSIGN r_wa_dyn_table->* TO <wa_dyn_table>.
* Get data into table from somewhere. Field names are
* known at this point because field catalog is already
* built. Read field names from the field catalog or use
* COMPONENT <number> in a DO loop to access the fields. A
* simpler hard coded approach is used here.
ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table> TO <w_field>.
<w_field> = 'ABC'.
ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
<w_field> = 'XYZ'.
APPEND <wa_dyn_table> TO <t_dyn_table>.
ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table> TO <w_field>.
<w_field> = 'TUV'.
ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
<w_field> = 'DEF'.
APPEND <wa_dyn_table> TO <t_dyn_table>.
* Color cells based on your criteria. In this example, a test on
* FIELD2 is used to decide on color.
LOOP AT <t_dyn_table> INTO <wa_dyn_table>.
ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
* Get access to internal table used to color cells.
ASSIGN COMPONENT 'T_CELLCOLORS'
OF STRUCTURE <wa_dyn_table> TO <t_cellcolors>.
CLEAR wa_cellcolors.
wa_cellcolors-fname = 'FIELD2'.
IF <w_field> = 'DEF'.
wa_cellcolors-color-col = '7'.
ELSE.
wa_cellcolors-color-col = '5'.
ENDIF.
APPEND wa_cellcolors TO <t_cellcolors>.
MODIFY <t_dyn_table> FROM <wa_dyn_table>.
ENDLOOP.
* Display screen. Define screen 100 as empty, with next screen
* set to 0 and flow logic of:
* PROCESS BEFORE OUTPUT.
* MODULE initialization.
* PROCESS AFTER INPUT.
CALL SCREEN 100.
* MODULE initialization OUTPUT
MODULE initialization OUTPUT.
* Set up for ALV display.
IF r_dock_ctnr IS INITIAL.
CREATE OBJECT r_dock_ctnr
EXPORTING
side = cl_gui_docking_container=>dock_at_left
ratio = '90'.
CREATE OBJECT r_alv_grid
EXPORTING i_parent = r_dock_ctnr.
* Set ALV controls for cell coloring table.
wa_is_layout-ctab_fname = 'T_CELLCOLORS'.
* Display.
CALL METHOD r_alv_grid->set_table_for_first_display
EXPORTING
is_layout = wa_is_layout
CHANGING
it_outtab = <t_dyn_table>
it_fieldcatalog = t_fieldcat2.
ELSE. "grid already prepared
* Refresh display.
CALL METHOD r_alv_grid->refresh_table_display
EXPORTING
i_soft_refresh = ' '
EXCEPTIONS
finished = 1
OTHERS = 2.
ENDIF.
ENDMODULE. " initialization OUTPUT
Regards
vijay -
REPORT with dynamic WHERE CLAUSE (run RDF or REP) ?
Hi:
When running a REPORT (myreport.rep) with dynamic where clause using a lexical parameter, I got this error:
REP-1439: Cannot compile .REP or .PLX file as it does not have source
If i run the report specifiying RDF extension (myreport.rdf) the report run successfully! Is this normal ?
If I specify RDF extension will Report Server COMPILE the report everytime I execute it ?
When using dynamic WHERE CLAUSE I will have to run RDF files instead of REP ?
I'm running Reports 9i under Linux, with IDS under Windows.
Waiting Help
Joao OliveiraIt sounds like you are building the .rep files on one platform (windows) and running them on another (linux). The reason that the .rdf file continues to work is that Reports recompiles the PL/SQL within the report when you move from one platform to another or change schemas. .rep files can't be re-compiled in this way so you need to ensure they are compiled successfully when converting them.
You need to convert from .rdf to .rep on the platform that you are intending to run on. Try running rwconverter on the linux platform with "compile_all=yes" to produce the .rep file and running that .rep file. -
How to create a report with dynamic no of columns
Hi All,
we have a report with 6 columns.
and its been access by 10-20 people.
the user dont want to have a fix report with 6 columns rather they want to have a flexibility to select the columns from the report they want to see.
i.e. user one one time wasnt to see only one columns
another time he want to see only column 2 and 4 of the report.
its like there can be a multiple select option from where he can select the columns in the existing report and then see the same report with only that much column.
Please tell me how to implement it.Abhip i thin you didnt get the problem.
there is s exeiting report with 6 column
Currently when i logging to OBIEE and see that report
i will be getting report with 6 column
but now i want a flexibility of selecting only 2 or 3 or 1 or 4 or 5 as i wish columns from this report and see the result only for that
so is there by any chance i can have a check box for each column which i can check in dashborad to select that column
and show the result were as by default it will show the report with 6 column.
Thanks -
Creating a SSRS report with dynamic overlapping images
I have to create a report with the following requirement:
1: The first page has some hi-res images of 8 different geometric shapes with text in it. The location of the images on the page will be static, however the fill color of image can be either green or grey.E.g. one box can be green for one user , for other it
can be grey etc.
2: Export the report in excel,pdf and word
I am planning to use SSRS for this.
I am planning to create the report with superimposed images, e.g. green palette shape and grey palette shape superimposed on each other .Depending on the selection made by the user, I want to "Send to Back" or "Bring to Front." Can I change
the "Send to Back" or "Bring to Front" properties at runtime depending on parameters passed to the report?
Also, I want the image path to be configurable, so that when business wants to change the text or color of the image, I do not need to redeploy the code. I can just change the image.
how can I create the RDL such that the images are at the proper positions? DO I need to insert a tablix for proper positioning of the image?
Any suggestions?Hi RachanaD,
As far as I know, overlapping of item does not work in the soft-break renderers like HTML, Word and Excel. However, it is work in hard-break renderers like PDF or TIFF.
In your case, we can insert text box in rectangle to work around the issue. We can insert an image in rectangle and another image insert in a text box. Then, put the text box in the rectangle.
In SSRS, we cannot use parameter to control the location of image. However, we can use go to report action to work around the issue. Please refer to the steps below:
Create two similar report, the difference between two reports is the location of these image.
In the first report, add a text box fill with “Send to Back”.
Add action “go to report” of the text box go to the second report.
In the second report, add a text box fill with “Bring to Front”.
Add action “go to report” of the text box go to the first report.
Hope this helps.
Regards,
Alisa Tang
If you have any feedback on our support, please click
here.
Alisa Tang
TechNet Community Support -
Ho can I schedule a WEBI report with dynamic parameters???
Hello again!!
Here i am with another detail about scheduling, the thing this time is that ia need to schedule a report with one parameter every week but with a different value for the parameter every week.
This is i need this week to run the report SALES BY STORE filtered by week with this value 2011 - 45 (yyyy - num ofweek) but the next week the value for the same parameter must be 2011 - 46
is it possible??? i mean is possible to schedule a report with different value for the parameter each time that it runs???
I know that i can schedule a report with different values for a parameter to send it to severals users whith different data but the values for the parameter are the same every time that it runs and i dont need that.
Any help or clue will be very appreciatedHi Elio,
Do you have access to modify your universe?
Then you should try Dave Rathbun's idea. Here is the link:
http://www.dagira.com/2008/07/21/using-a-magic-date-value-in-prompts/
Note that you'll have to adapt it to what you need, in this case to the week number.
For example if you are using Sybase syntax you'd get 2011 - 46 with:
convert(varchar, year(getdate()))+' - '+convert(varchar, datepart(wk,getdate()))
So you'll new object in Universe would look like :
your_table.week = case when @prompt('Enter week','C',,mono,free) = 'This week' then convert(varchar, year(getdate()))+' - '+convert(varchar, datepart(wk,getdate())) else @prompt('Enter week','C',,mono,free) end
Adapt it to the syntax of the database you use. Then after creating this object in your universe you'll have to go back to your report and Edit the query and use this object in the filter area instead of a normal prompt.
When you have to schedule the report leave the prompt with the parameter 'This week'
Hope this helps
Regards
Erika
Edited by: PadawanGirl on Nov 8, 2011 3:35 PM
Maybe you are looking for
-
After upgrading to iO6 my apps will not install- they have been stuck with installing only status showing.
-
Old Captivate Files (*.cp)
I have some projects made in version 3 or 4 (in 2005) the new version 7 of Captivate does not recognise them. Any Idea on how I can update them to a level that Captivate 7 can open them. Thanks
-
Airport Express and Flashing Yellow - Please Help!
I just purchased an Airport Express and cannot get anything the status indicator to flash anything other than a yellow. I am working on a Win 7 64 bit platform and my router is Netgear N600 (model WNDR3700). The only changes I made to the router is v
-
Adobe Forms in ABAP Image upload from a local drive
Hello, Can anybody suggest me the procedure, how to upload the image field dynamically of an employee which is existing in PA30 to SAP interactive forms (SFP). I have gone through many forums but could not able to find any right solution on it.. and
-
After 10.4.11 Crash The Simplest Solution to Make an Apple Working again
Hey ppl, Yes!!! i have also faced the SAME HORRIFYING situation that all the ppl around the world are facing after updating to 10.4.11, it was like sudden death..... But thanks to this discussion and all the support... i have managed to overcome the