Question - Comparing data from 2 databases
I'm new to Oracle - I'm trying to compare data from 2 separate databases.
I'm trying to get data from both databases based on a common TRACKING_NUMBER. The issue is that in one database there are additional 0s in front of the Tracking_Number.
So I'm trying to find out what I can put in my query to remove those zero's in front of the tracking number. I have the query below - it's very long.
SELECT DISTINCT cm.TRACKING_NUMBER_TYPE AS HType,
TRUNC(cm.CREATED_DATE) as CodeMoveDate,
SUBSTR(cm.CODE_MOVE_DESC, 1, 50) AS Description,
cm.TRACKING_NUMBER AS TrackingNumber,
rq.Plant_Name as Location,
jr_eur.Assignee as Tracker,
TRUNC(MAX(jr_spec.Journal_Date)) as Date_Spec,
TRUNC(MAX(jr_app.Journal_Date)) as Date_Approved,
TRUNC(MAX(jr_ut.Journal_Date)) as Date_Unit,
TRUNC(MAX(jr_qa.Journal_Date)) as Date_Assurance,
TRUNC(MAX(jr_eur.Journal_Date)) as Date_Enduser,
TRUNC(MAX(jr_gv.Journal_Date)) as Date_Gatekeeper,
TRUNC(MAX(jr_prod.Journal_Date)) as Date_Move,
TRUNC(MAX(jr_eun.Journal_Date)) as Date_Notification,
TRUNC(MAX(jr_pver.Journal_Date)) as Date_Production,
TRUNC(MAX(jr_udoc.Journal_Date)) as Date_Documentation
FROM PROJMAN.PM_CODE_MOVES_V cm,
PROJMAN.PM_Requests_V rq,
PROJMAN.PM_Journals_V jr_spec,
PROJMAN.PM_Journals_V jr_app,
PROJMAN.PM_Journals_V jr_ut,
PROJMAN.PM_Journals_V jr_qa,
PROJMAN.PM_Journals_V jr_eur,
PROJMAN.PM_Journals_V jr_gv,
PROJMAN.PM_Journals_V jr_prod,
PROJMAN.PM_Journals_V jr_eun,
PROJMAN.PM_Journals_V jr_pver,
PROJMAN.PM_Journals_V jr_udoc
WHERE cm.TRACKING_NUMBER = LTRIM(rq.Request_ID(+))
AND cm.TRACKING_NUMBER = jr_spec.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_app.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_ut.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_qa.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_eur.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_gv.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_prod.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_eun.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_pver.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_udoc.Request_ID(+)
AND jr_spec.Journal_Status(+) = 'Spec Doc'
AND jr_app.Journal_Status(+) = 'Approved'
AND jr_ut.Journal_Status(+) = 'Unit Test'
AND jr_qa.Journal_Status(+) = 'Quality Assurance'
AND jr_eur.Journal_Status(+) = 'End User Review'
AND jr_gv.Journal_Status(+) = 'Gatekeeper Verificat'
AND jr_prod.Journal_Status(+) = 'Move to Production'
AND jr_eun.Journal_Status(+) = 'End User Notificatio'
AND jr_pver.Journal_Status(+) = 'Production Verificat'
AND jr_udoc.Journal_Status(+) = 'User Documentation'
AND cm.TRACKING_NUMBER_TYPE = 'H'
and cm.CREATED_DATE >{d '2006-12-31'}
GROUP BY
cm.TRACKING_NUMBER_TYPE,
TRUNC(cm.CREATED_DATE),
cm.CODE_MOVE_DESC,
cm.TRACKING_NUMBER,
rq.Plant_Name,
jr_eur.Assignee
ORDER BY TRUNC(cm.CREATED_DATE)
I recommend using a product.
I used to write scripts and procedures, but no more!
Reason is: you save time. A lot of time. You pay few hunderes $ once for the product.
If you do it yourself, you waste half-days doing it properly.
A good tool for database compare is Comparenicus (www.compareniucs.com).
I'm using it for 6 months now and it saves me a lot of time.
Similar Messages
-
Question regarding Polling data from database using DB Adapters in BPEL
Hi,
I have the following question regarding Polling data from database using DB Adapters in BPEL -
If I am selecting data from multiple tables/view to ultimately generate hierarchical xml document, is there a way that I specify polling all of these tables/views. Is polling limited only to one table/view?
Thanks
RaviHi Ravi,
your question seems to have been answered for the question of polling a set of tables with one as the root, and getting back a hierarchical xml representing multiple related tables.
However you can also poll for changes to both the root table and its related tables. Not sure if this was your question or the one already answered. If the former please check out the sample
bpel/samples/tutorials/122.DBAdapter/advanced/polling/PollingForChildUpdates
Thanks
Steve -
Question on pulling data from database
I have a question. I have one form in designer and i need to extract data from database. database is in sequel. any help on how do i do this or how can i do this?
If you use a process to interact with the database, this recent thread is very related and would be helpful:
http://www.adobeforums.com/webx/.59b639e7/0
scott -
Problem in printing the data from database when i print inside servlet
hi to all!
the objective of the code below is getting the data from database table and has to send that data to the web browser using out.println .note: out - PrintWriter object
In a getQuestion method, i am getting the data from database table and store it in String q and when i print the q within this method it is getting printed, but i got the null value when i printed the String q inside service method doPost. why..? its puzzling me.
package servlet;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class test extends HttpServlet {
Connection con;
ResultSet rs;
Statement s;
StringBuffer q;
StringBuffer o1;
StringBuffer o2;
StringBuffer o3;
public void getQuestion() throws Exception
if(rs.next())
q=new StringBuffer(rs.getString("question"));
o1=new StringBuffer(rs.getString("option1"));
o2=new StringBuffer(rs.getString("option2"));
o3=new StringBuffer(rs.getString("option3"));
System.out.println(q);
System.out.println(o1);
System.out.println(o2);
System.out.println(o3);
public void connect(){
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:ds","sa","server");
s=con.createStatement();
rs=s.executeQuery("select * from qa order by newid()");
getQuestion();
catch(Exception e)
System.out.println("erroe");
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws IOException,ServletException
response.setContentType("text/html");
new test().connect();
PrintWriter out=response.getWriter();
request.setAttribute("question", q);
request.setAttribute("option1", o1);
request.setAttribute("option2", o2);
request.setAttribute("option3", o3);
//RequestDispatcher rd=getServletContext().getRequestDispatcher("/show.jsp");
//rd.forward(request, response);
out.println("<html>");
out.println("<head>");
out.println("<title>" + "shock!!!" + "</title>");
out.println("</head>");
out.println("<body>");
out.println("<h2>"+"Read twice before u answer"+"<h2>");
out.println("<p></p>");
//why the value of q is not getting printed, instead i get null
out.println("<h2>"+ q +"<h2>");
out.println("how is it");
out.println("</body>");
out.println("</html>");
Edited by: Mahesh_yeswecan on Nov 29, 2008 10:42 AMAs u said , i have done a silly mistake earlier. though i have corrected the code still i am getting the same null value
package servlet;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class test extends HttpServlet {
Connection con;
ResultSet rs;
Statement s;
StringBuffer q;
StringBuffer o1;
StringBuffer o2;
StringBuffer o3;
public void getQuestion() throws Exception
if(rs.next())
q=new StringBuffer(rs.getString("question"));
o1=new StringBuffer(rs.getString("option1"));
o2=new StringBuffer(rs.getString("option2"));
o3=new StringBuffer(rs.getString("option3"));
System.out.println(q);
System.out.println(o1);
System.out.println(o2);
System.out.println(o3);
public void connect(){
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:ds","sa","server");
s=con.createStatement();
rs=s.executeQuery("select * from qa order by newid()");
getQuestion();
catch(Exception e)
System.out.println("erroe");
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws IOException,ServletException
response.setContentType("text/html");
connect();
PrintWriter out=response.getWriter();
request.setAttribute("question", q);
request.setAttribute("option1", o1);
request.setAttribute("option2", o2);
request.setAttribute("option3", o3);
//RequestDispatcher rd=getServletContext().getRequestDispatcher("/show.jsp");
//rd.forward(request, response);
out.println("<html>");
out.println("<head>");
out.println("<title>" + "shock!!!" + "</title>");
out.println("</head>");
out.println("<body>");
out.println("<h2>"+"Read twice before u answer"+"<h2>");
out.println("<p></p>");
//why the value of q is not getting printed, instead i get null
out.println("<h2>"+ q +"<h2>");
out.println("how is it");
out.println("</body>");
out.println("</html>");
} -
How to compare data from 2 different time periods
Hi folks,
I have a question on approach to a problem. I want to be able to compare data from a common db, but for 2 different time periods. For example I want to see the number of occurences of an instance in my data for today and compare it against occurences a week ago today. What's the best approach for this kind of problem? Is this done with 2 separate queries from 2 sub reports and then compared some how? Any comments on this approach or an other are appreciated.
TIA bvdFollow these steps:
1) Bring your first time period in your main report. This will be your first query.
2) Bring your second time period in a subreport. This will be your second query.
3) Bring the values from your subreport into your main report using shared variables.
4) Lastly, compare the results using formulas in your main report.
I hope this information proves useful.
Regards,
Zack H. -
Internationalized Object data from database
Hi...
I like to know which concepts you use in web application in case you need dynamic object data internationalized. For static web pages I can use ResourceBoundles to get the data but I'm still searching for the ideal way to do this with Object data.
Let�s say you have a Product object which has a name and description in many different languages.
Preferably I like to do something like this
<c:out value="${product.name}"/>
to display the users preferred (session) language, and for the special case to force a language I might use something like this
<c:out value="${product.name}" locale="en_US"/>
Now my big question is how should I implement something like this. Should the product.getName() method include the logic to determine the users session to call something like product.getName(Locale)? Or should I implement a custom tag to handle cases like this?
What is your preferred way of doing this?
Thanks,
GregorHow can use hashtable or Vector to create Jtree ?
the Hashtable's Data or Vector's Data from Database. -
Pull the data from database.
Hi EveryBody,
I have a requirement in universe if the end user will select the date from (1/8/14 to 10/8/14) then pull the data from the database. but when the end user select the data more than 10 days(e.g 1/8/14 to 15/8/14 etc...) then no need to pull the data from database.
how will write the filter in the universe?
how will achieve this? please help me.
Thank you.Hi ,
I am assuming you are giving prompt for start date and end date respectively start_date and end_date.
please see the below work around. (below is pseudo code)
1. create one dummy objects as
case when @prompt(end_date) - @prompt(start_date) <= 10 then = 1 end
Remember text used in dummy object should be same as you use it for you date prompts
2. pull this objects in where clause along with your date prompts as
dummy_object = 1
It will work as below :=
your report will be prompted for start_date and end_date .
Same values will be passed to dummy objects.
When dummy object will be executed , it will check for end_date-start_date <=10 or not.
If it is less then 10 then query will executed else it will come out as where clause is not satisfied.
Hope this answers your question :-).
Regards
Jeevan -
Try to retrieve data from database got error message
Try to retrieve data from database got error message *"java.lang.ArrayIndexOutOfBoundsException: 2*
* sun.jdbc.odbc.JdbcOdbcPreparedStatement.clearParameter(JdbcOdbcPreparedStatement.java:1023)*
* sun.jdbc.odbc.JdbcOdbcPreparedStatement.setDate(JdbcOdbcPreparedStatement.java:811)*
* guestbk.doGet(guestbk.java:32)*
* guestbk.doPost(guestbk.java:73)*
* javax.servlet.http.HttpServlet.service(HttpServlet.java:710)*
* javax.servlet.http.HttpServlet.service(HttpServlet.java:803)"*
I have used prepared statment
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd/MM/yy");
java.util.Date dt = sdf.parse(str3);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:gbook");
//Statement stmt=con.createStatement();
PreparedStatement ps = con.prepareStatement("SELECT * from gbook where emailid =? AND date =?");
ps.setString(1,str1);
ps.setString(2,str2);
ps.setDate(3,new java.sql.Date(dt.getTime()));
//ps.executeQuery();
//ResultSet rs=stmt.executeQuery("select * from gbook where emailid = str1");
ResultSet rs = ps.executeQuery();
out.println("<Html>");
out.println("<Head>");
out.println("<Title>GuestBook</Title>");
out.println("</Head>");
out.println("<Table border=1 align=center >");
out.println("<H4><B><center>Teacher's Lesson Plan</center></B></H4><BR>");
out.println("<TR><TD><b>Teacher Name</b></TD><TD><b>Class</b></TD></TR>");
while(rs.next())
ctr++;
String email=rs.getString("emailid");
String cmt=rs.getString("comment");
out.println("<TR><TD>"+email+"</TD><TD>"+cmt+"</TD></TR>");
}Please anybody help .PreparedStatement ps = con.prepareStatement("SELECT * from gbook where emailid =? AND date =?");
ps.setString(1,str1);
ps.setString(2,str2);
ps.setDate(3,new java.sql.Date(dt.getTime()));Your SQL query has 2 placeholders but you try to set 3 values.
And didn't you read the stack trace?
guestbk.doGet(guestbk.java:32)You could've tracked down line 32 and seen what was there at that line.
People on the forum help others voluntarily, it's not their job.
Help them help you.
Learn how to ask questions first: http://www.catb.org/~esr/faqs/smart-questions.html
---------------------------------------------------------------- -
How do i add data from database to JTable ! Urgent
How do i add data from database to the columns of JTable?.
hi,
Thanks for ur link. but this is just a part of my application which i am developing user interface in swing package for which i want to know how to show data to user in the table format where by table input data will be from the database. say something like todays activity is shown to the user in table format... So u have any idea of how to do this... -
[webdynpro] How to get the data from database and store in Excel sheet
Hi All-
I am developing an application in Webdynpro and I need to provide a URL ( link ) which if clicked , need to collect the data from Database ( SQL Server ) and puts in an Excel Sheet corresponding fields and opens the sheet.....
Please look into this issue and help me out......
Regards,
CrisHi Cris,
Add-on to wat santosh has pointed to:
Exporting table data to MS-Excel Sheet(enhanced Web Dynpro Binary Cache)
(Or) If you have implemented your logic to get Database records below Blog should guide you in opening an excel with ur records.
Exporting table data to MS-Excel Sheet(enhanced Web Dynpro Binary Cache)
Regards,
N. -
Hello, I am trying to compare data from one and the same table. In short I have:
NAME DTM CHARGE
Atanas 8/18/2012 9:33:23 AM 100
Atanas 8/18/2012 9:33:23 AM 101
Niki 8/18/2012 9:33:43 AM 200
Niki 8/17/2012 9:34:10 AM 100
Niki 8/18/2012 9:33:43 AM 201
Niki 8/17/2012 9:34:10 AM 101
Atanas 8/17/2012 9:34:29 AM 50
Atanas 8/17/2012 9:34:29 AM 51
Joro 8/18/2012 12:10:12 PM 400
Joro 8/17/2012 12:10:21 PM 300
Joro 8/18/2012 12:10:12 PM 401
Joro 8/17/2012 12:10:21 PM 301
And I want to sum CHARGE for each DTM for each NAME and present the difference in an additional column, the output should be like that:
NAME DTM CHARGE DTM CHARGE DIFFERENCE
Atanas 8/17/2012 9:33:23 AM 101 8/18/2012 9:33:23 AM 201 - 100
Niki 8/17/2012 9:33:23 AM 201 8/18/2012 9:33:23 AM 401 - 200
Joro 8/17/2012 9:33:23 AM 601 8/18/2012 9:33:23 AM 801 200
the DTM will be always /sysdate - 2/ and /sysdate - 1/,
Thanks in advance!It is not clear what you are trying to do, but it looks like:
with sample_table as (
select 'Atanas' name,to_date('8/18/2012 9:33:23 AM','mm/dd/yyyy hh:mi:ss am') dtm,100 charge from dual union all
select 'Atanas',to_date('8/18/2012 9:33:23 AM','mm/dd/yyyy hh:mi:ss am'),101 from dual union all
select 'Niki',to_date('8/18/2012 9:33:43 AM','mm/dd/yyyy hh:mi:ss am'),200 from dual union all
select 'Niki',to_date('8/17/2012 9:34:10 AM','mm/dd/yyyy hh:mi:ss am'),100 from dual union all
select 'Niki',to_date('8/18/2012 9:33:43 AM','mm/dd/yyyy hh:mi:ss am'),201 from dual union all
select 'Niki',to_date('8/17/2012 9:34:10 AM','mm/dd/yyyy hh:mi:ss am'),101 from dual union all
select 'Atanas',to_date('8/17/2012 9:34:29 AM','mm/dd/yyyy hh:mi:ss am'),50 from dual union all
select 'Atanas',to_date('8/17/2012 9:34:29 AM','mm/dd/yyyy hh:mi:ss am'),51 from dual union all
select 'Joro',to_date('8/18/2012 12:10:12 PM','mm/dd/yyyy hh:mi:ss am'),400 from dual union all
select 'Joro',to_date('8/17/2012 12:10:21 PM','mm/dd/yyyy hh:mi:ss am'),300 from dual union all
select 'Joro',to_date('8/18/2012 12:10:12 PM','mm/dd/yyyy hh:mi:ss am'),401 from dual union all
select 'Joro',to_date('8/17/2012 12:10:21 PM','mm/dd/yyyy hh:mi:ss am'),301 from dual
select nvl(s1.name,s2.name) name,
s1.dtm,
s1.charge,
s2.dtm,
s2.charge,
s2.charge - s1.charge diff
from (
select name,
dtm,
sum(charge) charge
from sample_table
where dtm >= trunc(sysdate) - 1
and dtm < trunc(sysdate)
group by name,
dtm
) s1
full join
select name,
dtm,
sum(charge) charge
from sample_table
where dtm >= trunc(sysdate)
and dtm < trunc(sysdate) + 1
group by name,
dtm
) s2
on s1.name = s2.name
NAME DTM CHARGE DTM CHARGE DIFF
Atanas 17-AUG-12 101 18-AUG-12 201 100
Niki 17-AUG-12 201 18-AUG-12 401 200
Joro 17-AUG-12 601 18-AUG-12 801 200
SQL> SY. -
Oracle form: how to retrieve data from database to pop list
I have problem in retrieving data from database to item list in
oracle forms.
Can anyone help me.
thanks.The next is an example but you can find this information in
Forms Help:
DECLARE
G_DESCS RECORDGROUP;
ERRCODE NUMBER;
rg_id RECORDGROUP;
rg_name VARCHAR2(40) := 'Descripciones';
BEGIN
rg_id := FIND_GROUP(rg_name);
IF Id_Null(rg_id) THEN
G_DESCS := Create_Group_From_Query (rg_name, 'SELECT
DESCRIPCION DESCRIPCION, DESCRIPCION DESC2 FROM FORMAS_PAGO);
ERRCODE := POPULATE_GROUP(G_DESCS);
POPULATE_LIST('FORMAS_PAGO.CMBDESCRIPCION',G_DESCS);
END IF;
END;
Saludos.
Mauricio. -
Issue to load data from database to XML file. error: ODI-40768
Hi,
While I am trying to load data from database to XML following error is appearing.
ODI-1228: Task TEST_XML_DATA (Integration) fails on the target XML connection MyLOCALXSD.
Caused By: java.sql.SQLException: ODI-40768: Could not save the file <default>:C:\DATA_FILE\www.xml because a class java.io.IOException occurred and said: The filename, directory name, or volume label syntax is incorrect
at com.sunopsis.jdbc.driver.xml.SnpsXmlFile.writeToFile(SnpsXmlFile.java:751)
at com.sunopsis.jdbc.driver.xml.SnpsXmlConnection.internalExecute(SnpsXmlConnection.java:769)
at com.sunopsis.jdbc.driver.xml.SnpsXmlPreparedStatement.execute(SnpsXmlPreparedStatement.java:46)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.execute(SQLCommand.java:166)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:102)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:1)
at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:540)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:338)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:272)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:263)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:822)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:83)
at java.lang.Thread.run(Thread.java:662)
jdbc url: jdbc:snps:xml?d=C:\test_xsd.xsd&s=TESTSQL&re=employeesX&ro=true
physical schema: TESTSQL
Knowledge modules are:
LKM: LKM SQL to SQL
IKM: IKM XML Control Append
CKM: CKM SQL
Parameters set are:
CREATE_XML_FILE: true
XML_PATH:<default>:C:\DATA_FILE\www.xml
I have tried to change the directory path but error is still there.
Could some one please help me to resolve the issue?
Regards,
user1672911Hi,
The trouble in "<default>:" - if you set XML_PATH as C:\DATA_FILE\www.xml instead <default>:C:\DATA_FILE\www.xml- it will work correctly.
Greetings,
Eugene -
TRANSFER OF DATA FROM DATABASE TO APPLICATION SERVER
I have to upload /transfer data from database to application server .
I am not able to get it.
If anyone have any solution to it,
post it to me.
thanks*& Report <name>
REPORT name.
DATA:
BEGIN OF FS_SPFLI,
CARRID TYPE SPFLI-CARRID,
CONNID TYPE SPFLI-CONNID,
COUNTRYFR TYPE SPFLI-COUNTRYFR,
CITYFROM TYPE SPFLI-CITYFROM,
AIRPFROM TYPE SPFLI-AIRPFROM,
COUNTRYTO TYPE SPFLI-COUNTRYTO,
CITYTO TYPE SPFLI-CITYTO,
AIRPTO TYPE SPFLI-AIRPTO,
FLTIME TYPE SPFLI-FLTIME,
DEPTIME TYPE SPFLI-DEPTIME,
ARRTIME TYPE SPFLI-ARRTIME,
DISTANCE TYPE SPFLI-DISTANCE,
DISTID TYPE SPFLI-DISTID,
FLTYPE TYPE SPFLI-FLTYPE,
PERIOD TYPE SPFLI-PERIOD,
END OF FS_SPFLI.
DATA:
T_SPFLI LIKE
STANDARD TABLE
OF FS_SPFLI.
DATA:
BEGIN OF FS_TABLE,
CHAR(100) TYPE C,
END OF FS_TABLE.
DATA:
T_TABLE LIKE
STANDARD TABLE
OF FS_TABLE.
DATA:
BEGIN OF FS_TABLE1,
CHAR(100) TYPE C,
END OF FS_TABLE1.
DATA:
T_TABLE1 LIKE
STANDARD TABLE
OF FS_TABLE1.
SELECT CARRID
CONNID
COUNTRYFR
CITYFROM
AIRPFROM
COUNTRYTO
CITYTO
AIRPTO
FLTIME
DEPTIME
ARRTIME
DISTANCE
DISTID
FLTYPE
PERIOD
FROM SPFLI
INTO TABLE T_SPFLI.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'd:\files\p_spfli04'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = T_SPFLI
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'd:\files\p_spfli04'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = T_TABLE
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*LOOP AT T_TABLE INTO FS_TABLE.
WRITE:
/ FS_TABLE-CHAR.
*ENDLOOP.
OPEN DATASET 'p_spfli04' FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC EQ 0.
MESSAGE 'File Already Exists' TYPE 'I'.
STOP.
ELSE.
CLOSE DATASET 'p_spfli04'.
ENDIF.
OPEN DATASET 'P_SPFLI02' FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT T_TABLE INTO FS_TABLE.
TRANSFER FS_TABLE TO 'p_spfli04'.
ENDLOOP.
CLOSE DATASET 'p_spfli04'.
*ENDIF.
OPEN DATASET 'p_spfli04' FOR INPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT T_TABLE INTO FS_TABLE.
READ DATASET 'p_spfli04' INTO FS_TABLE.
APPEND FS_TABLE-CHAR TO T_TABLE1.
ENDLOOP.
Here is the sample code to download and upload the file onto presentation server and then using OPEN DATASET you'll be able to transfer the data to APPLICATION SERVER....
Regards,
Pavan P. -
How to download Data from Database directly into excel
I have a requirement to download very large quantity of data from database into Excel file.
But condition is excel file should have only 65,536 rows in a single spread sheet(that's the limit i suppose),if i have more data points(rows) than it should be stored into different spreadsheet.......this continues so there can be many spread sheets in a single excel file.
Data size can be 1 GB or more.
Also specific naming conventions need to be followed for giving name to excel as well as different spread sheets in it.
Please see if someone could help me out.Thanks for ur reply,
But my requirement is to call "download to excel" method,in a java program on click by user for downloading an excel sheet on his machine.
This is be done as part of a web application which is to be made (so can't open the excel first)
Maybe you are looking for
-
Hi I have a problem when i parse a folder. I use xerces parser and i have a problen with the apostrophe. I use this encoding in my code: of.setEncoding ("ISO-8859-1"); Anybody knows another version of encoding ? Thanks !
-
Converting Catalog from Photoshop Album 2 to P. Elements 4 or 9
When converting the catalog from Photoshop Album 2.0 PE Versions 4.0 or 9.0, I get 43% through the conversion and then an error message pops up saying the file is corrupt and to repir first in the original version. I have looked up other forums whic
-
Can i transfer my music from my iphone to my macbook
isthere a way to transfer my music from my iphone to my macbook?
-
Creating a Data DVD as a Device
I recently came across a DVD that showed up in iTunes as a device (such as an iPod does). I was able to figure out how to burn a Data DVD or CD within iTunes so that it will show up as a device but, also on that DVD, when I looked at the actual infor
-
Is it working? (Backups confusing)
I have some suspicions that Time Machine may not be working correctly on my MacBook Pro. First, I bought an external hard drive and partitioned it. My hard drive is about 100 GB, so I created a 100 GB partition formatted Mac OS Extended (Journaled) a