Creating reports using java
hello java fanatics! :D
im a vb programmer and created an ActiveX Printer Control. this ActiveX is downloaded on the client browsers (IE) and called by my vbscript for me to access its functions. but my problem is that... it only works on IE!
one of my friend told me that the only way i can resolve this issue is recode my ActiveX Printer Control in JAVA (applet). i've done some research about it but i cant find a specific tutorial on how can i print on the client side using JAVA applet.
i've done some CSS reports but my reports should be 8.5 X 5.5 inch. is it possible also to set some custom page layout in JAVA?
It seems that you already have the material to be printed in the final format and you just want to send them to the printer.
If you want to do printing yourself you can use java print api
its in java.awt.print and javax.print packages.
If you search for tutorials for java print api you'll get what you want.
But if you want just to get the job done the best way is to write a serverside program (a Servlet) to display the content that need to be printed on the browser. So the user can directly use File->Print command or you can even put a print button on the page which executes the javascript print command
or just execute it automatically by adding a javascript at the bottom of the page.
Similar Messages
-
How to save report in PersonalCategory after creating it using java panel?
Hi,
Anybody knows How to save report in PersonalCategory after creating it using java panel?
I dont want to save it in public folder. I want to save report (webi) in user's personal category.
can anybody send me source code?
It will help me a lot.
Thanks in advance
Amol MaliHi teda,
i'm assuming that you have seen my post that i did successfuly save report in user's personal category.
Actually the report is created in webi java panel using RE SDK and is saved in Report Sample Folder then i'm saving it in user's personal category by following code
string query = "Select SI_PERSONAL_CATEGORIES From CI_INFOOBJECTS Where "
+ "SI_INSTANCE=0 And SI_ID=" + reportID;
InfoObjects infoObjects = infoStore.Query(query);
InfoObject infoObject = infoObjects[1];
Webi wreport = (Webi)infoObject;
ObjectRelativeIDs personalIDs = wreport.PersonalCategories;
/personalIDs.Add(Convert.ToInt32(categoryID));
infoStore.Commit(infoObjects);
But the report is presents in the Folder also and in user's personal category also.
I dont want the report to be in the folder (Report Sample) if i saved it in user's personal category.
How can i do that?
any idea.
Please help me.
Thanks in advance
Amol Mali
Edited by: amol mali on Jan 9, 2009 7:55 PM -
Creating a sample report using JAVA SDK
Hi,
I am trying to create a sample report using JAVA SDK.
I slelect 4 "free cells" and pass 4 different strings to it.
I even slelect the font colour and size. When i run the class and try to view the report in Infoview, I only seeblank blocks without any data. Now if I edit the report from infoview, and save the changes, I am able to see the data.
My issue is, Why am I not able to see the data when I run the java code.
Please find teh code below.
package com;
import java.awt.Color;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.businessobjects.rebean.wi.BinaryView;
import com.businessobjects.rebean.wi.DataProvider;
import com.businessobjects.rebean.wi.DataProviders;
import com.businessobjects.rebean.wi.DataSource;
import com.businessobjects.rebean.wi.DataSourceObject;
import com.businessobjects.rebean.wi.DocumentInstance;
import com.businessobjects.rebean.wi.DocumentLocaleType;
import com.businessobjects.rebean.wi.FontImpl;
import com.businessobjects.rebean.wi.FreeCell;
import com.businessobjects.rebean.wi.HTMLView;
import com.businessobjects.rebean.wi.OutputFormatType;
import com.businessobjects.rebean.wi.PageHeaderFooter;
import com.businessobjects.rebean.wi.Query;
import com.businessobjects.rebean.wi.Recordset;
import com.businessobjects.rebean.wi.Report;
import com.businessobjects.rebean.wi.ReportBody;
import com.businessobjects.rebean.wi.ReportCell;
import com.businessobjects.rebean.wi.ReportContainer;
import com.businessobjects.rebean.wi.ReportElement;
import com.businessobjects.rebean.wi.ReportEngine;
import com.crystaldecisions.sdk.framework.CrystalEnterprise;
import com.crystaldecisions.sdk.framework.IEnterpriseSession;
import com.crystaldecisions.sdk.framework.ISessionMgr;
import com.crystaldecisions.sdk.occa.infostore.IInfoObject;
import com.crystaldecisions.sdk.occa.infostore.IInfoObjects;
import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
import com.crystaldecisions.sdk.plugin.CeKind;
public class Aug7th {
* @param args
public static void main(String[] args) {
// TODO Auto-generated method stub
String CMS = "pundl8136:6400";
String userID = "srivas";
String password = "morcom123";
String auth = "secEnterprise";
List<String> entire =new ArrayList<String>();
List<String> country =new ArrayList<String>();
List<String> resort =new ArrayList<String>();
IEnterpriseSession enterpriseSession;
try
ISessionMgr mySessionMgr = CrystalEnterprise.getSessionMgr();
enterpriseSession = mySessionMgr.logon(userID, password, CMS,auth);
if (enterpriseSession != null)
{//Create and store useful objects for the session.
IInfoStore iStore = (IInfoStore)enterpriseSession.getService("InfoStore");
ReportEngine reportEngine = (ReportEngine)enterpriseSession.getService("WebiReportEngine");
IInfoObject infoView = null;
String str = "SELECT SI_ID, SI_NAME, SI_PARENTID FROM CI_INFOOBJECTS WHERE (SI_KIND = '"+CeKind.WEBI+"' OR SI_KIND='FullClient') " +
"AND SI_INSTANCE = 'false' AND SI_NAME='Structure Test_001_Java' ORDER BY SI_NAME ASC ";
//String str = "SELECT SI_ID, SI_NAME, SI_PARENTID FROM CI_INFOOBJECTS ORDER BY SI_NAME ASC ";
IInfoObjects objInfoObjectsWIDs = (IInfoObjects) iStore.query(str);
System.out.println(objInfoObjectsWIDs.size());
IInfoObject objInfoObjectWID = (IInfoObject) objInfoObjectsWIDs.get(0);
DocumentInstance doc = reportEngine.openDocument(objInfoObjectWID.getID());
DataProviders dps = doc.getDataProviders();
// Retrieve the 1st data provider
DataProvider dp = dps.getItem(0);
// Retrieve the universe objects
DataSource ds = dp.getDataSource ();
Query q = dp.getQuery();
Recordset rs = dp.getResult(0);
// 0: assume query has one flow
rs.first();
// Print the column types. They can be Integer, String,
// or Date.
for (int i = 0; i < rs.getColumnCount(); i++) {
Class c = rs.getColumnType(i);
StringBuffer sbt = new StringBuffer();
if ( c.equals(Integer.class) )
sbt.append("Integer");
if ( c.equals(String.class) )
sbt.append("String");
if ( c.equals(Date.class) )
sbt.append("Date");
sbt.append(";");
System.out.println(sbt.toString());
System.out.println(rs.getColumnCount());
while (!rs.isLast()) {
// column names
StringBuffer sbn = new StringBuffer();
StringBuffer sbd = new StringBuffer();
for (int j = 0; j < rs.getColumnCount(); j++) {
sbn.append( rs.getColumnName(j).toString() );
sbn.append(";");
System.out.println("sbn "+sbn.toString());
// data
for (int k= 0; k< rs.getColumnCount(); k++) {
sbd.append( rs.getCellObject(k).toString() );
sbd.append(";");
entire.add(rs.getCellObject(k).toString());
System.out.println("sbd "+sbd.toString());
rs.next();
System.out.println(entire.size());
for(int i=0;i<entire.size();i++){
country.add(entire.get(i));
i++;
System.out.println("entireList "+entire.get(i));
resort.add(entire.get(i));
DataSourceObject city = ds.getClasses().getChildByName("Country");
DataSourceObject resorts = ds.getClasses().getChildAt(1);
dp.runQuery();
ReportContainer report = doc.createReport("Resort");
PageHeaderFooter header = report.getPageHeader();
FreeCell headerCell = header.createFreeCell("Resort Report");
PageHeaderFooter footer = report.getPageFooter();
FreeCell footerCell = footer.createFreeCell("Report Ends");
ReportBody body = report.createReportBody();
for(int k=0;k<resort.size();k++){
FreeCell res=body.createFreeCell(resort.get(k));
res.getAttachTo();
res.setHeight(15d);
res.setWidth(30d);
Color c = new Color(255,255,255);
Color c1 = new Color(255,0,0);
FontImpl fnt = (FontImpl)res.getFont();
fnt.getDecoration().setTextColor(c1);
res.setFont(fnt);
//res.deleteAttachment();
//res.setAttachTo(body,VAnchorType.BOTTOM,HAnchorType.NONE);
doc.applyFormat();
doc.refresh();
final String l_docToken = doc.getStorageToken();
final DocumentInstance l_docToSave = reportEngine.getDocumentFromStorageToken(l_docToken);
doc.saveAs("mor31",835,null,null);
doc.closeDocument();
str = "SELECT SI_ID, SI_NAME, SI_PARENTID FROM CI_INFOOBJECTS WHERE (SI_KIND = '"+CeKind.WEBI+"' OR SI_KIND='FullClient') " +
"AND SI_INSTANCE = 'false' AND SI_NAME='mor31' ORDER BY SI_NAME ASC ";
//String str = "SELECT SI_ID, SI_NAME, SI_PARENTID FROM CI_INFOOBJECTS ORDER BY SI_NAME ASC ";
objInfoObjectsWIDs = (IInfoObjects) iStore.query(str);
System.out.println(objInfoObjectsWIDs.size());
objInfoObjectWID = (IInfoObject) objInfoObjectsWIDs.get(0);
DocumentInstance doc1 = reportEngine.openDocument(objInfoObjectWID.getID());
String token = doc1.getStorageToken();
DocumentInstance doc2 = reportEngine.getDocumentFromStorageToken(token);
doc2.saveAs("123123", 835, null, null);
// doc.refresh();
//doc.save();
enterpriseSession.logoff();
catch(Exception e)
e.printStackTrace();duplicate post:
Sample report using JAVA SDK -
How to create report using Procedure.
Hi All,
I want to create report in apex.But i do not have sql code.I have one procedure.Is it possible to create report using this procedure in apex.
CREATE OR REPLACE PROCEDURE headcsv_prc2
AS
CURSOR cr_header
IS
SELECT ood.organization_code, fm.formula_no AS "FORMULA_NAME",
fm.formula_vers AS "FORMULA_VERSION",
fm.formula_desc1 AS "FORMULA_DESC",
DECODE (fm.formula_status,
100, 'New',
400, 'Approve for Laboratory Use',
700, 'Approve for General',
800, 'On Hold',
900, 'Frozen',
1000, 'Obsolete/Archived'
) AS "FORMULA_STATUS",
DECODE (fd.line_type, '1', msib.segment1) product,
DECODE (fd.line_type, '-1', msib.segment1) ingrediant,
DECODE (fd.line_type, '2', msib.segment1) AS "BY_PRODUCT",
DECODE (by_product_type,
'W', 'Waste',
'R', 'Rework',
'Y', 'Yield',
'S', 'Sample',
NULL
) AS "BY_PRODUCT_TYPE"
FROM org_organization_definitions ood,
fm_form_mst fm,
fm_matl_dtl fd,
mtl_system_items_b msib
WHERE ood.organization_id = fm.owner_organization_id
AND fm.owner_organization_id = msib.organization_id
AND msib.organization_id = fd.organization_id
AND fd.organization_id = ood.organization_id
AND fm.formula_id = fd.formula_id
AND msib.inventory_item_id = fd.inventory_item_id
-- and fm.FORMULA_NO like'%TEA%'
AND fd.line_type IN ('1', '2', '-1')
GROUP BY ood.organization_code,
fm.formula_no,
fm.formula_vers,
fm.formula_desc1,
fm.formula_status,
fd.line_type,
msib.segment1,
by_product_type
ORDER BY fm.formula_no, fm.formula_vers;
BEGIN
DBMS_OUTPUT.put_line ( INITCAP ('ORGANIZATION CODE')
|| ','
|| INITCAP ('FORMULA NAME')
|| ','
|| INITCAP ('FORMULA VERSION')
|| ','
|| INITCAP ('FORMULA DESC')
|| ','
|| INITCAP ('FORMULA STATUS')
|| ','
|| INITCAP ('PRODUCT')
|| ','
|| INITCAP ('INGREDIANT')
|| ','
|| INITCAP ('BY PRODUCT')
|| ','
|| INITCAP ('BY PRODUCT TYPE')
FOR ch IN cr_header
LOOP
DBMS_OUTPUT.put_line ( ch.organization_code
|| ','
|| ch.formula_name
|| ','
|| ch.formula_version
|| ','
|| '"'
|| ch.formula_desc
|| '"'
|| ','
|| ch.formula_status
|| ','
|| ch.product
|| ','
|| ch.ingrediant
|| ','
|| ch.by_product
|| ','
|| ch.by_product_type
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Error No: ' || SQLCODE || 'Error Msg: '
|| SQLERRM
END;
EXEC HeadCSV_Prc2
Thanks,
RaghuRaghuVarma wrote:
I created one report using sql code.(Ex: select * from emp).
But my higher authorities want that for security purpose They will change the code into java.
What "higher authorities"? What "security purpose"?
In this process they changed my code as a procedure.Finally they give that java code.they tell to me please fix in apex.
Do these "higher authorities" know anything about APEX? What does the Java code actually do? Have you asked them how their approach is to be integrated into APEX?
There is no reason why a properly written Java stored program cannot be used in APEX, provided that whatever it is doing makes sense in an APEX/web context, and isn't some nonsense like using DBMS_OUTPUT to generate a CSV.
I tried so many ways.But it is not fixed.Different Different errors will occurs.
Tried what? Demonstrate what you have tried, preferably using examples on apex.oracle.com.
How to solve this.
How to solve what? No clearly defined problem or requirement has been identified.
Describe the the problem/requirement (not your attempted solutions) in detail.
How to ask questions
Re: 2. How do I ask a question on the forums?
Include as much relevant information with your question as possible, starting with:
APEX version
DB version, edition and host OS
Web server architecture (EPG, OHS or APEX listener), platform, and host OS
Browser(s)/version(s) used
Theme
Templates
Region type(s) -
How to create reports in java or j2ee???
I want to know how can we create reports in java or j2ee like we use crystal report in vb or .net.do we use jsp or servlet to generate the reports or is there any other tool to do the same?Members,please,do help me.
Well, you can use JasperResports (http://www.jasperforge.org/) and Eclipse Birt (http://www.eclipse.org/birt/phoenix/)
-
How to create reports for java programs?
Hi,
I have planned to do a project using java,that will help to create reports for java programs. To create reports for java programs i used two options.
1)Crystal reports
2)Write the code to produce reports for each java programs
The second one little cumbersome.SO i planned to develop a software that is compatible for creating java reports.
I would like to know how i will do the project?Can you help me to made it a successful project.Hope you can help me.
Expecting your reply
PreethiRenjithUggg... Crystal reports...
I would personally write a generic report generator, It would probably be easier than fighting w/
crystal reports (CR is popular, but painful :) )
Anyhow, I've written report generators for many different applications. It is one of the simplest projects you
can take on, and the results make you feel special --
If your need nicely formated, portable, printable reports, you could have your report generator make PDF files (the format is open, and VERY simple, plus people like pdf files) you can get the pdf spec from adobe or from wotsit.org (the famous wotsit file format archive).
enjoy! -
Call Unix Command From Reports Using Java
Hi,
Could somebody please show me a sample coding to call Unix command from 10g report using java?
In metalink doc id 361857.1 does not show much.
Thanks,
neeminHi,
I have a problem with synchronization of the java commands.
In the Before Parammeter Form trigger, I have:
function BeforePForm return boolean is
rt ORA_JAVA.JOBJECT;
proc ORA_JAVA.JOBJECT;
v_txt varchar2(32000);
i integer := 0;
v_cd_modulo int;
v_arqlog text_io.file_type;
cursor c_evento is
select codigo,
nome
from
(select e.cd_evento || e.cd_edicao codigo
,nm_evento nome
from grh_ev_evento e
where e.CD_GRUPO in (select cd_grupo
from grh_ev_adm
where cd_usuario = (select cd_usuario
from usuario
where login_usuario = :AUTHID)))
order by substr(nome, 11);
begin
-- Create the context for logged user
if instr(upper(nvl(:AUTHID,'RWCLIENT')),'RWCLIENT') > 0 then
:AUTHID := :SSO_USUARIO;
end if ;
TCEENV.SET_TCEENV(:AUTHID);
if PK_SCA.SCA_GET_USER_RIGHTS(:sca_module_name, :AUTHID) IS NULL then
srw.message(100, 'Access denided!');
return (FALSE);
end if;
-- Create file in Report Server (UNIX)
v_txt := '<BR>' || htf.formSelectOpen('P_EV_EDICAO', 'Evento: ');
:p_file := '/u03/SCAWEB/repout/' || :sca_module_name || '_' ||
pk_sca.sca_encrypt(:AUTHID || to_char(systimestamp, 'ss.ff'));
v_arqlog := text_io.fopen (:p_file, 'A');
text_io.put_line (v_arqlog, v_txt);
for reg in c_evento loop
i := i + 1;
if i = 1 then
v_txt := '<OPTION SELECTED VALUE="' || reg.codigo || '">' || reg.nome;
else
v_txt := '<OPTION VALUE="' || reg.codigo || '">' || reg.nome;
end if;
text_io.put_line (v_arqlog, v_txt);
end loop;
v_txt := '</SELECT></CENTER></form></BODY> </HTML>';
text_io.put_line (v_arqlog, v_txt);
text_io.fclose (v_arqlog);
SRW.SET_AFTER_FORM_HTML(SRW.FILE_ESCAPE, :p_file);
rt := RUNTIME.GetRuntime();
proc := RUNTIME.exec(rt,'rm ' || :p_file);
return (TRUE);
end;
The problem is that there isn't a "synchronize" command, and the
RUNTIME.exec(rt,'rm ' || :p_file) don't works (it does nothing) because
the SRW.SET_AFTER_FORM_HTML has a large delay and the following
command is ignored.
How can I solve it?
thanks,
lmprestes -
Creating Report using EPM Functions with Dynamic Filters
Hi All,
I am new to BPC, In BPC 7.5 i seen like we can generate EPM report using EVDRE function very quickly and easy too. Is the same feature is existing in BPC 10.0 ? if no how can we create EPM reports using EPM Functions with Dynamic Filters on the Members of the dimension like in BPC 7.5.
And i searched in SDN, there is no suitable blogs or documents which are related to generation of Reports using EPM Functions. All are described just in simple syntax way. It is not going to be understand for the beginners.
Would you please specify in detail step by step.
Thanks in Advance.
Siva NagarajuSiva,
These functions are not used to create reports per se but rather assist in building reports. For ex, you want to make use of certain property to derive any of the dimension members in one of your axes, you will use EPMMemberProperty. Similary, if you want to override members in any axis, you will make use of EPMDimensionOverride.
Also, EvDRE is not replacement of EPM functions. Rather, you simply create reports using report editor (drag and drop) and then make use of EPM functions to build your report. Forget EvDRE for now.
You can protect your report to not allow users to have that Edit Report enabled for them.
As Vadim rightly pointed out, start building some reports and then ask specific questions.
Hope it clears your doubts. -
How do you reference a Formular Object on a Crystal Report using Java
Hi all,
I am trying to reference an object on my report which contains a Formula field.
I have read the following 2 threads, but they refer to textObjects:
[How do you reference a textObject on a Crystal report using Java|Re: How do you reference a textObject on a Crystal report using Java?]
[Changing the text of ITextObject programatically|Re: Changing the text of ITextObject programatically]
But I cannot even get those to work. I can reference a object which refers to a database field but as soon as I try
reference a textObject or reportObject I just get a NULL variable.
Below is the code I am useing
IReportObject dbField = reportClientDocument.getReportDefController().findObjectByName("BOB1");
IReportObject textBob = reportClientDocument.getReportDefController().findObjectByName("BOB2");
"BOB1" is the name of my DB field Object, and "BOB2" can be a Text box or a Formula item and I just get nothing.
I have just tested it with a FieldHeadingObject and that returns a valid object, so clearly I am going about this the wrong way
for objects I place on the reports which are not driven by the database items.
Ultimately what I want to do is reference an object in the Report Footer which will contain the RecordCount of the number of
records contained in the report, which I am them going to use to determine if the report holds data,
if it does I will print it, else ignore it and move on the the next report. I am doing this so that I can at an extra filter to split
a report up into groups and produce a sinlge PDF for each group instead of one massive PDF containing all the groups.
So if someone has a solution to any of my problems I would be very greatful, and I dont mind being told Im an idiot and should
rather do it another way, as long as you supply that other way
Thanks for the help
Darren
Edited by: Darren Jackson on Dec 16, 2009 7:29 PM
Forgot to add am using CR4Ev2 SP3Right I have made some headway.
Firstly, Im an idiot. I was making changes and setting up test fields on my report, but then when running the app, I had it looking at
the backup report, which would explain why all the new textbox fields were not being found.
The stupiditity did force me to delve deep and work out a fair bit of how the reports work, so cant complain too much. BUT, I am still
not able to return values of Formula fields and formulas extra. Could someone tell me if this is even possible. I get retrieve the formula field
name, and properties but not its value once the report has been populated. Am I wasting my time?
Well I will continue dismantling my reports till I find the answer, or someone points me in the right direction.
If any one is interested this is the code I used to drill down to my text boxes:
IReportObject recCount = reportClientDocument.getReportDefController().findObjectByName("TB1");
ITextObject obj_RecCount = (ITextObject) recCount;
System.out.println(obj_RecCount.getName());
Paragraphs objP = obj_RecCount.getParagraphs();
for (int i = 0; i < objP.size(); i++){
ParagraphElements pE = objP.getParagraph(i).getParagraphElements();
for (int j = 0;j < pE.size(); j++){
IParagraphTextElement pEE = (ParagraphTextElement) pE.getParagraphElement(j);
System.out.println(pEE.getText());
Cheers -
Need code for sales order create report using bapi's
need code for sales order create report using bapi's
Hi,
Go through below link
http://www.saptechies.com/bapi_salesorder_createfromdat2/
<b>Reward points if it helps,</b>
Satish -
Update database logon in reports using java
Please review the code below and let me know where did I go wrong! I am able to login to CMS and able to retrieve the list of reports. Now, I am trying to update the database credentials for a single report using java (My requirement is to update all 200 reports though!).
This is the 100th time I go this error message: Failed to open the connection.report.lib.ReportSDKServerException: Failed to open the connection.
I also wrote a sample java program which tries to connect to the sql server database with same login credentials - this works perfectly fine. But, if I use the same connection url, driver name and login credentials, this report fails to update for whatever reason. Please help me ASAP..Thanks!
import com.crystaldecisions.sdk.exception.*;
import com.crystaldecisions.sdk.framework.*;
import com.crystaldecisions.sdk.occa.infostore.*;
import com.crystaldecisions.sdk.occa.managedreports.*;
import com.crystaldecisions.sdk.occa.report.application.*;
import com.crystaldecisions.sdk.occa.report.data.*;
import com.crystaldecisions.sdk.occa.report.lib.*;
import java.util.Iterator;
class ChangeDataSource {
public static void main(String args[]){
String cms = "134.X.X.X:6400";
String username = "Administrator";
String password = "";
String auth = "secEnterprise";
IEnterpriseSession enterpriseSession = null;
ISessionMgr sessionMgr = null;//CrystalEnterprise.getSessionMgr();
Exception failure = null;
boolean loggedIn = true;
ReportClientDocument clientDoc = null;
if (enterpriseSession == null)
try
sessionMgr = CrystalEnterprise.getSessionMgr();
enterpriseSession = sessionMgr.logon(username, password, cms, auth);
System.out.println("\nLOGIN SUCCESSFUL\n");
catch (Exception error)
loggedIn = false;
failure = error;
if (!loggedIn)
System.out.println("\nLOGIN FAILED\n");
else
// Query for the sample report from the Enterprise CMS.
try {
IInfoStore iStore = (IInfoStore) enterpriseSession.getService("InfoStore");
IInfoObjects infoObjects = iStore.query("Select SI_ID From CI_INFOOBJECTS Where SI_INSTANCE=0 AND SI_PARENT_FOLDER=771");
System.out.println("\ninfoObjects size = "+infoObjects.getResultSize());
IReportAppFactory reportAppFactory = (IReportAppFactory)enterpriseSession.getService("RASReportFactory");
IInfoObject infoObject = (IInfoObject)infoObjects.get(0);
clientDoc = new ReportClientDocument();
clientDoc = reportAppFactory.openDocument(infoObject,0, java.util.Locale.US);
System.out.println("Report "+ infoObject.getTitle() +" Opened");
switch_tables(clientDoc.getDatabaseController());
}catch(ReportSDKException re){
re.printStackTrace();
}catch(SDKException re){
re.printStackTrace();
private static void switch_tables(DatabaseController databaseController) throws ReportSDKException {
//Declare the new connection properties that report's datasource will be switched to.
//NOTE: These are specific to using JDBC against a particular MS SQL Server database. Be sure to use the
//DisplayConnectionInfo sample to determine what your own connection properties need to be set to.
final String TABLE_NAME_QUALIFIER = "dbname.dbo.";
final String DATABASE_NAME = "dbname";
final String DBUSERNAME = "userid";
final String DBPASSWORD = "pword";
final String SERVERNAME = "134.X.X.X";
final String CONNECTION_URL = "jdbc:sqlserver://134.X.X.X:1433;DatabaseName=dbname";
final String DATABASE_CLASS_NAME = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
final String DATABASE_DLL = "crdb_jdbc.dll";
//Obtain collection of tables from this database controller.
Tables tables = databaseController.getDatabase().getTables();
System.out.println("\nTables size = "+tables.size());
//Set the datasource for all main report tables.
for (int i = 0; i < tables.size(); i++) {
//ITable currTable = tables.getTable(i);
ITable table = tables.getTable(i);
//Keep existing name and alias.
table.setName(table.getName());
table.setAlias(table.getAlias());
//System.out.println("Table Name = "+table.getName()+" Alias "+table.getAlias());
//Change properties that are different from the original datasource.
table.setQualifiedName(TABLE_NAME_QUALIFIER + table.getName());
System.out.println(table.getQualifiedName());
//Change connection information properties.
IConnectionInfo connectionInfo = null;
try{
connectionInfo = table.getConnectionInfo();
//System.out.println("conn info: "+connectionInfo);
}catch(Exception re) {
re.printStackTrace();
//Set new table connection property attributes.
PropertyBag propertyBag = new PropertyBag();
//Overwrite any existing properties with updated values.
propertyBag.put("Trusted_Connection", "false");
propertyBag.put("Connection URL", CONNECTION_URL);
propertyBag.put("Database Class Name", DATABASE_CLASS_NAME);
propertyBag.put("Server", SERVERNAME);
//propertyBag.put("Database Name", DATABASE_NAME);
propertyBag.put("Server Type", "JDBC (JNDI)");
//propertyBag.put("URI", null);
propertyBag.put("Use JDBC", "true");
propertyBag.put("Database DLL", DATABASE_DLL);
connectionInfo.setAttributes(propertyBag);
System.out.println("\n Properties SET\n");
//Set database username and password.
//NOTE: Even if these the username and password properties don't change when switching databases, the
//database password is *not* saved in the report and must be set at runtime if the database is secured.
connectionInfo.setUserName(DBUSERNAME);
connectionInfo.setPassword(DBPASSWORD);
connectionInfo.setKind(ConnectionInfoKind.SQL);
table.setConnectionInfo(connectionInfo);
//Update old table in the report with the new table.
try {
databaseController.setTableLocation(table, tables.getTable(i));
}catch(ReportSDKException re) {
re.printStackTrace();
System.out.println("\n All tables updated\n");I have exactly same error. I can confirm that CRJavaHelper.changeDataSourceReportClientDocument clientDoc,
String reportName, String tableName,
String username, String password, String connectionURL,
String driverName,String jndiName)
has very slow performance.
Obviously the line:
clientDoc.getDatabaseController().setTableLocation(origTable, newTable);
works very slow. I also have JDBC defined in report and also stored procedure, that returns recordset (cursor) in 0.48 sec.
I am using CR Reports Server XI R2 and custom JAVA client program that renders report to pdf.
Lines from java program:
rpt = new ReportClientDocument();
String report = "C:
temp
CrystalReport1.rpt";
rpt.open(report, com.crystaldecisions.sdk.occa.report.application.OpenReportOptions._openAsReadOnly);
CRJavaHelper.changeDataSource(rpt, "The specified item was not found.", "", "jdbc:oracle:thin:@oratest:1521:oratest","oracle.jdbc.driver.OracleDriver", "");
CRJavaHelper.addDiscreteParameterValue(rpt, "", "P_INET_ID", id);
rpt.refreshReportDocument();
PDFExportFormatOptions pdfOptions = new PDFExportFormatOptions();
ExportOptions exportOptions = new ExportOptions();
exportOptions.setExportFormatType(ReportExportFormat.PDF);
exportOptions.setFormatOptions(pdfOptions);
InputStream is = rpt.getPrintOutputController().export(exportOptions); -
Can you create report using report painter with Tcodes:FAGLL03,FCHN
Hi Experts,
1.I want to create report using report painter by using tcodes FAGLL03,FCHN.Can i create with report painter?
2.i never used report painter can anyone provide report painter pdf for ecc6.0
3.can any oneguide me how to develop report in report painter by using this tcodes.
4.If not possible can i do with report writer?
Regards,
naresh.
Moderator: Don't mix report painter with the TCodes wyou mentioned; there is no link between them. Regarding Report Painter - search SDN. Respect the rules and don't cross-post: you asked the same unclear question in several forums!cross posted
Edited by: nareshvarma on Jul 19, 2010 9:11 AM -
Steps for Creating Report using LDB
hellow sirs
can u please tell Step by Step method for creating Reports using LDB method...
if possible with screen Shots..
thanking You
RahulHi,
Please refer the code below:
Use the PNP LDB for this program,
*: Report: ZP_POSTCODE :
*: Date : 2004 :
*: Description: Displays report of employees by postcode area, :
*: includes current travelling allowances (i.e. parking :
*: permit or transport card etc..) :
*: Use: Help encourage the use of car sharing and public :
*: transport where appropriate. :
REPORT zp_postcode.
type-pools: slis. "ALV Declarations
NODES: pernr.
INFOTYPES: 0000, 0001, 0002, 0006, 0008, 0014, 0105, 0121.
SELECTION-SCREEN BEGIN OF BLOCK pcode WITH FRAME TITLE text-s01.
SELECT-OPTIONS: so_pcode FOR p0006-pstlz.
SELECTION-SCREEN END OF BLOCK pcode.
TYPES: BEGIN OF t_output,
pernr TYPE p0001-pernr, "personnel name
anredtxt TYPE t522t-atext, "title (based on p0002-anred)
fname TYPE p0002-vorna, "first name
lname TYPE p0002-nachn, "last name
orgtx TYPE t527x-orgtx, "dept
fte TYPE p0008-bsgrd, "fte
parking(20) TYPE c,
payslip TYPE t526-sachn, "payslip address
telno TYPE p0105-usrid_long, "tel number(p0105-usrty = 0020)
email TYPE p0105-usrid_long, "email (p0105-usrty = MAIL)
postcode type p0006-pstlz,
END OF t_output.
DATA: it_output TYPE STANDARD TABLE OF t_output INITIAL SIZE 0,
wa_output TYPE t_output.
*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,
gt_events type slis_t_event,
gd_prntparams type slis_print_alv,
gd_count(6) type n,
gd_outtext(70) type c,
gd_lines type i.
*START-OF-SELECTION.
START-OF-SELECTION.
clear: gd_count.
GET pernr.
* Infotype 0121 is used to store multiple contracts for personnel.
* Field p0121-hpern contains the personnel number for the main contract.
PROVIDE * from p0121 between pn-begda and pn-endda.
* Check if main contract
if p0121-pernr ne p0121-hpern.
reject.
endif.
ENDPROVIDE.
add 1 to gd_count.
concatenate 'Processing personnel data'(m10) gd_count into gd_outtext
separated by ' '.
* Display indicator for employee count
perform progress_indicator using gd_outtext.
* Retrieve datd from infotypes
rp_provide_from_last p0000 space pn-begda pn-endda.
rp_provide_from_last p0001 space pn-begda pn-endda.
rp_provide_from_last p0002 space pn-begda pn-endda.
rp_provide_from_last p0006 space pn-begda pn-endda.
rp_provide_from_last p0008 space pn-begda pn-endda.
rp_provide_from_last p0014 space pn-begda pn-endda.
* Check post code
CHECK p0006-pstlz IN so_pcode. "cp
* Post code
wa_output-postcode = p0006-pstlz.
* Personnel number
wa_output-pernr = pernr-pernr.
* Personnel title
SELECT SINGLE atext
FROM t522t
INTO wa_output-anredtxt
WHERE sprsl EQ sy-langu AND
anred EQ p0002-anred.
* First name
wa_output-fname = p0002-vorna.
* Last name
wa_output-lname = p0002-nachn.
* Organizational Unit text (dept)
SELECT SINGLE orgtx
FROM t527x
INTO wa_output-orgtx
WHERE sprsl EQ sy-langu AND
orgeh EQ p0001-orgeh AND
endda GE sy-datum.
* FTE
wa_output-fte = p0008-bsgrd.
* Parking / travel deducted?
CASE p0014-lgart.
WHEN '7180' OR '7181' OR '7182'.
wa_output-parking = text-002.
WHEN '7183'.
wa_output-parking = text-001.
WHEN '7171' OR '7172' or '7173' or '7174' or
'7175' or '7176' or '7177' or '7178'.
wa_output-parking = text-003.
ENDCASE.
* Payslip Address
SELECT SINGLE sachn
FROM t526
INTO wa_output-payslip
WHERE werks EQ p0001-werks AND
sachx EQ p0001-sacha.
PROVIDE * from p0105 between pn-begda and pn-endda.
* Telephone numbers
if p0105-usrty = '0020'.
wa_output-telno = p0105-usrid_long.
endif.
* Email address
if p0105-usrty = 'MAIL'.
wa_output-email = p0105-usrid_long.
endif.
ENDPROVIDE.
append wa_output to it_output.
clear: wa_output.
*END-OF-SELECTION.
END-OF-SELECTION.
describe table it_output lines gd_lines.
if gd_lines gt 0.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.
else.
message i003(zp) with 'No records found'.
endif.
*& Form PROGRESS_INDICATOR
* Displays progress indicator on SAP screen
form progress_indicator using p_text.
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
* PERCENTAGE = 0
text = p_text.
endform. " PROGRESS_INDICATOR
*& Form BUILD_FIELDCATALOG
* Build Fieldcatalog for ALV Report
form build_fieldcatalog.
fieldcatalog-fieldname = 'PERNR'.
fieldcatalog-seltext_m = 'Personnel No.'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
* fieldcatalog-emphasize = 'X'.
* fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'ANREDTXT'.
fieldcatalog-seltext_m = 'Title'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'FNAME'.
fieldcatalog-seltext_m = 'First Name'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'LNAME'.
fieldcatalog-seltext_m = 'Last Name'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'ORGTX'.
fieldcatalog-seltext_m = 'Department'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'FTE'.
fieldcatalog-seltext_m = 'FTE'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PARKING'.
fieldcatalog-seltext_m = 'Parking/Metrocard'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PAYSLIP'.
fieldcatalog-seltext_m = 'Payslip Add.'.
fieldcatalog-col_pos = 7.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'TELNO'.
fieldcatalog-seltext_m = 'Telephone'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EMAIL'.
fieldcatalog-seltext_m = 'E-mail'.
fieldcatalog-col_pos = 9.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'POSTCODE'.
fieldcatalog-seltext_m = 'Post code'.
fieldcatalog-col_pos = 10.
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).
gd_layout-zebra = 'X'.
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_output
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 -
How to create reports using jDeveloper
what procedure to follow in order to creating
reports drawn from mysql or Oracle 8.5.0 database.I have created 'reports' using BC4J and the JSP Web Application wizard (I use the RowsetBrowser bean).
On the BC4J side, I use read only View Objects based on SQL queries (not based on Entity Objects).
On the JSP side, I create a HTML form where the user can enter their query criteria, pass that criteria as parameters to the ViewObject query, then use a RowSetBrowser bean to display the results.
You can also write your own custom beans to format the output of the report as you like. -
Can i create report using more than one Business Area ?
Hi Gurus,
Can i create report using more than one Business Area?.Could anybody tell me that report will work?.
VikramYou should have no problem creating a report using more than one Business Area, we share folders across BAs all the time for ease of management. As long as your joins exist its not a problem.
Matt Topper
TUSC, The Oracle Experts
[email protected]
Maybe you are looking for
-
Hi, I have just had the message - download itunes again as you cannot burns cds etc - this sometimes happens said the message. So I removed itunes and downloaded it again and now when I click to open it says 'itunes library .it' cannot be read as it
-
Importing MS Project files into P6v7
As a new user to P6v7, I was attempting to import MS project 2007 files into P6. The file types I have are .MPP type files (converted from 2003 version). The P6 import function dropdown only lists .MPX file types to import from MS Project. I am unabl
-
I am running Aperture 3.1.2 and trying to install updates, but the installer cannot "see" my application and won't proceed with the installation.
-
Iphone 5s update to ios 7.1 touch id cant scan at all? help!
iphone 5s update to ios 7.1 touch id cant scan at all? help!
-
Can't update apps after location replacing..
Hello guys. I've recently replaced my iTunes ID account location. Since then, everytime iTunes tells me that there are new updates for my iPhone apps, iTunes refers me to a page that tells me that there are no updates (just after clicking "Check for