Error in Reading data from a xml file in ESB
Hi,
i created a inbound file adapter service which reads data from a xml file and passes it to the routing service and from there updates to the database.....
(everything created in jdeveloper)
But i am getting error....it is not getting updated to the database...when i check the database(select * from table) its showing one row selected but i couldnt find the data....
Transformation mapping also i did...
i think may be some error in reading the data from the xml file but not so sure.....
please reply to this mail as soon as possible its very urgent
Michael R wrote:
The target table will be created when you execute the interface, if you set the option on the flow tab as instructed in step #6 of the "Setting up ODI Constraint on CLIENT Datastore" Section.
Option Value
CREATE_TARG_TABLE trueHi Michel,
This was not my required answer.I am sorry that I was unable to clarify my question.Actually
+This project executed successfully with some warning.Target Table is automatically created in database and also populated with data.But when I right-click Target Datastore(in >Mapping Tab of the Interface), and then select Data to View Data that needs to be inserted in the target table.I get some error like this:-...+This above line is the result of my project my problem is
when I right-click Target Datastore(in Mapping Tab of the Interface), and then select Data to View Data that already inserted in the target table.Is not shown by the view data operation.
I meant to say I am facing this error
At the10(1010 written) step of
Creating a New ODI Interface to Perform XML File to RDBMS Table Transformation
wehre it says
Open the Interface tab. Select Mapping tab, right-click Target Datastore - CLIENT, and then select Data. View Data inserted in the target table. Close Data Editor. Close the tabs...
In my case when I use my sqldeveloper I can see data successfully inserted in my target table and also in error table (data that can't satisfy the constraint) .But I was unable to check this by following the above mentioned 10 th step and got this error.
Thanks
Similar Messages
-
Reading data from a XML file.
Hi,
I am new user to webdynpro and has the task of reading data from XML file.The file is created using XML form Builder and is stored at a location.But my code gives me the path instead of the content in the data.
The code is :
try
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();
// create an ep5 user from the retrieved user
IUser ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser);
IResourceContext context = new ResourceContext(ep5User);
/Specify the path of ur document here./
RID pathRID = RID.getRID("/documents/70f51182-84c3-2710-ce91-8d5fbfde713d.xml");
//RID pathRID = RID.getRID("/documents/hol.txt");
wdContext.currentContextElement().setSetDisp(pathRID.toString());
IResource resource = ResourceFactory.getInstance().getResource(pathRID, context);
InputStream in = resource.getContent().getInputStream();
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buffer = new byte[4096];
int bytesread = 0;
while ((bytesread = in.read(buffer)) != -1)
out.write(buffer, 0, bytesread);
String myData = out.toString();
/*myFile will containS the content of the document./
wdContext.currentContextElement().setSetDisp(myData);
catch (Exception e)
// wdContext.currentContextElement().setTextdisp("IO Error:" + e.getMessage());
text data is read from the location but XML data is not read.
Please help me out.hi SriRam,
For some reasons you are not able to change the value of attribute SetDisp ahich you gave the default value as the path using the following statement
wdContext.currentContextElement().setSetDisp(myData);
Remove that line.First try to open the files using creating new window instance
IWDWindow window =
wdComponentAPI.getWindowManager().createExternalWindow(
"http://<server name>:<port no>/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs"
+ "/documents/Public Documents/...."
+ "/"
+<name>,
"from km repository",
false);
window.open();
Then we can be sure that the error is due to reading data using input stream
Regards
Rohit -
Error while export data from a xml file to an relational table
Hi,
I am Creating an ODI Project: Developing an ODI XML to Database Transformation Using Interface with ODI Constraint following this link
http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_11g/odi_project_xml-to-table/odi_project_xml-to-table.htm
This project executed successfully with some warning.*Target Table is automatically created in database and also populated with data*.But when I right-click Target Datastore(in Mapping Tab of the Interface), and then select Data to View Data that needs to be inserted in the target table. I get some error like this:-
Execution of Query Failed.
Details:-
See com.borland.dx.dataset.DataSetException error code: BASE+62
com.borland.dx.dataset.DataSetException: Execution of query failed.
at com.borland.dx.dataset.DataSetException.a(Unknown Source)
at com.borland.dx.dataset.DataSetException.queryFailed(Unknown Source)
at com.borland.dx.sql.dataset.QueryProvider.a(Unknown Source)
at com.borland.dx.sql.dataset.JdbcProvider.provideData(Unknown Source)
at com.borland.dx.dataset.StorageDataSet.refresh(Unknown Source)
at com.borland.dx.sql.dataset.QueryDataSet.refresh(Unknown Source)
at com.sunopsis.graphical.frame.DwgDataFrame.initialize(DwgDataFrame.java:368)
at com.sunopsis.graphical.frame.DwgDataFrame.<init>(DwgDataFrame.java:77)
at oracle.odi.ui.etlmodeler.diag.inspector.pane.popup.DiagramActionDispayDataTarget.actionPerformed(DiagramActionDispayDataTarget.java:91)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1223)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1264)
at java.awt.Component.processMouseEvent(Component.java:6263)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Chained exception:
java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:931)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:481)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:217)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:947)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1283)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1441)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3769)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3823)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1671)
at com.borland.dx.sql.dataset.o.f(Unknown Source)
at com.borland.dx.sql.dataset.QueryProvider.e(Unknown Source)
at com.borland.dx.sql.dataset.JdbcProvider.provideData(Unknown Source)
at com.borland.dx.dataset.StorageDataSet.refresh(Unknown Source)
at com.borland.dx.sql.dataset.QueryDataSet.refresh(Unknown Source)
at com.sunopsis.graphical.frame.DwgDataFrame.initialize(DwgDataFrame.java:368)
at com.sunopsis.graphical.frame.DwgDataFrame.<init>(DwgDataFrame.java:77)
at oracle.odi.ui.etlmodeler.diag.inspector.pane.popup.DiagramActionDispayDataTarget.actionPerformed(DiagramActionDispayDataTarget.java:91)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1223)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1264)
at java.awt.Component.processMouseEvent(Component.java:6263)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Please HelpMichael R wrote:
The target table will be created when you execute the interface, if you set the option on the flow tab as instructed in step #6 of the "Setting up ODI Constraint on CLIENT Datastore" Section.
Option Value
CREATE_TARG_TABLE trueHi Michel,
This was not my required answer.I am sorry that I was unable to clarify my question.Actually
+This project executed successfully with some warning.Target Table is automatically created in database and also populated with data.But when I right-click Target Datastore(in >Mapping Tab of the Interface), and then select Data to View Data that needs to be inserted in the target table.I get some error like this:-...+This above line is the result of my project my problem is
when I right-click Target Datastore(in Mapping Tab of the Interface), and then select Data to View Data that already inserted in the target table.Is not shown by the view data operation.
I meant to say I am facing this error
At the10(1010 written) step of
Creating a New ODI Interface to Perform XML File to RDBMS Table Transformation
wehre it says
Open the Interface tab. Select Mapping tab, right-click Target Datastore - CLIENT, and then select Data. View Data inserted in the target table. Close Data Editor. Close the tabs...
In my case when I use my sqldeveloper I can see data successfully inserted in my target table and also in error table (data that can't satisfy the constraint) .But I was unable to check this by following the above mentioned 10 th step and got this error.
Thanks -
EDGE SIMULATOR CAN'T READ DATA FROM SIMULATION.XML
HI,
i have installed the SES(10.1.3) and before that Application server 10.1.3 .
I have followed all the steps given at the following link
http://www.oracle.com/technology/obe/1013/fusion_middleware/integration/ses/configuringsimulator/configuresimulator.htm#t1
It works works well till step 16 and edge is restarted successfully , I exit from enterprise manager by logging out and then logging in again for edge
and then when i click on monitor events then it gives me nothing in the row( no data, no time , no id) just blank row...
Mean it does not read data from Simulation.xml file
my file (Simulation.xml) is residing in F:\oracleAS\10.1.3.1\OracleAS_1\j2ee\home\applications\edge\edge\config folder where 'edgerserver.xml' is residing.
edgeserver.xml contains all driver details i guess.
Can anyone help me to cope with the problem.
thanks :-)Atlast i have overcome my problem , in order to read data from simulatin.xml file one has to change the "log level" in general settings to monitor and it will work .
other options for log level are , error , warning, notify and debug etc .
so change it to log level , then login as enterprise manager, restart edge , log out from emanagaer and again login to edge and click on monitor tab , u r done :-) -
Hi,
I would read datas from a xml file, in example:
if the xml file is:
<FUNCTION>
<PARAM NAME="x"> 15 </PARAM>
<PARAM NAME="y"> 20 </PARAM>
</FUNCTION>
My program read the value between the xml tags (that is "15" and "20"), but I would read the value "x" and "y", how can I do?
My program is:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder =
factory.newDocumentBuilder();
Document document = builder.parse("xmlFile");
NodeList nl= document.getElementsByTagName("*");
for (int i=0; i<nl.getLength(); i++)
Node n=nl.item(i);
Node lc=n.getChild(...);
System.out.println(lc.getNodeValue());
Please help meYou want to get attribute nodes, which are technically not children of the node they appear in. The following method of Node looks helpful:
NamedNodeMap getAttributes()
A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise. -
Application to Read and Write the Configuration Data from a xml file
Hi,
I have to develop a Webdynpro application that will do the following:
Read the Configuration data from an xml file
If stored in a file , and the file is not found, prompt the user to provide the file location.
Pre-Populate the screen(table) with the configuration data
Allow the user to edit the data
Store the configuration data when the user hits the Save button
The config xml file details are as follows:
Regardless of the location of the configuration data, the following fields will be stored
Application (string) will always contain u201CSFA_EDOCSu201D
Key (string) eg LDAP_USER, DB_PREFIX, etc.
Type (character) u201CPu201D = Plain Text, u201CEu201D = Encrypted
Value (string)
Since I am new to WD, I would require help on this.
Please help.Its Urgent.
Regards,
Vaishali.
Edited by: vaishali dhayalan on Sep 19, 2008 8:29 AMHi,
I have to develop a Webdynpro application that will do the following:
Read the Configuration data from an xml file
If stored in a file , and the file is not found, prompt the user to provide the file location.
Pre-Populate the screen(table) with the configuration data
Allow the user to edit the data
Store the configuration data when the user hits the Save button
The config xml file details are as follows:
Regardless of the location of the configuration data, the following fields will be stored
Application (string) will always contain u201CSFA_EDOCSu201D
Key (string) eg LDAP_USER, DB_PREFIX, etc.
Type (character) u201CPu201D = Plain Text, u201CEu201D = Encrypted
Value (string)
Since I am new to WD, I would require help on this.
Please help.Its Urgent.
Regards,
Vaishali.
Edited by: vaishali dhayalan on Sep 19, 2008 8:29 AM -
Read data from a text file, one line at a time.
I need to read data from a text file, and display each line in a String Indicator on Front Panel. It displays each line, but I get Error 4, End Of Line, unless I enter an extra line of data in the file that I don't need. I tried Read From Text File.vi, made by Nat Instr, and it gave the same error.
The Read from Text File.vi reads data from a text file line by line until the user stops the VI manually with the Stop button on the front panel, or until an error (such as "Error 4, End of file") occurs. If an error occurs, the Simple Error Handler.vi pops up a dialog that tells you which error occurred.
The Read from Text File.vi uses a while loop, but if you knew how many lines you wanted to read, you could replace the while loop with a for loop set to read that many lines from the file.
If you need something more dynamic because the number of lines in your files vary, then you could change the code of the Read from Text File.vi to the expect "Error 4, End of file" and handle it appropriately. This would require unbundling the error cluster that comes fro
m the Read File function with the Unbundle By Name function, so that you can expose the individual error "status" and error "code" values stored in the cluster. If the value of the error "code" is 4, then you can change the error "status" from true to false, and you can rebundle the cluster with the Bundle by Name function. Setting the error "status" to false instructs the Simple Error Handler to ignore the error. Otherwise, pass the original error cluster to the Simple Error Handler.vi, so that you can see what the error is.
Of course, if you're not interested in what the errors are, you could just remove the Simple Error Handler.vi, but then you wouldn't see any error messages.
Best of Luck,
Dieter
Dieter Schweiss
Applications Engineer
National Instruments -
Reading data from an excel file
Hi,
I want to read data from the excel file and display it in
jsp page. Iam getting the following error:
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con =
DriverManager.getConnection("jdbc:odbc:mydsn","","");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from [holidays$]");
Here i have created the dsn with the name "mydsn". I have the
following data in the mydsn.dsn file:
[ODBC]
DRIVER=Microsoft Excel Driver (*.xls)
UID=admin
UserCommitSync=Yes
Threads=3
SafeTransactions=0
ReadOnly=1
PageTimeout=5
MaxScanRows=8
MaxBufferSize=2048
FIL=excel 8.0
DriverId=790
DefaultDir=D:\WorkSpace\Projects\VINET\devl\webroot\jsp
DBQ=D:\WorkSpace\Projects\VINET\devl\webroot\jsp\list_of_holidays_2003.xls
thanks in advance
phani.You might want to look at the POI project (an open source Jakarta sub-project) that allows you to create/modify/read excel files via Java code. That might be more flexible and easier than what you're currently trying to do.
Cheers -
Pooling data from an XML file to another XML file using File Adapter
Hi,
I am trying to Pool data from an XML file to another XML file using File Adapter. I have added "Target Namespace" in both the XML and XSD.The problem is "At the destination given in the FileAdapter" only a blank XML file is created and it doesnot have any data.
Kindly suggest me some methods
Thanks in Advance.Ok here is a solution with external tables.
SQL> CREATE DIRECTORY my_xml_dir AS 'E:\oracle\Log_files\UTL_AKIVATST'
2 /
Directory created.
SQL> DROP TABLE my_xml_et
2 /
Table dropped.
SQL> CREATE TABLE my_xml_et
2 ( EMPNO NUMBER,
3 EMPNAME VARCHAR2(10),
4 JOB VARCHAR2(10),
5 HIREDATE DATE,
6 SAL NUMBER
7 )
8 ORGANIZATION EXTERNAL
9 (
10 TYPE ORACLE_LOADER
11 DEFAULT DIRECTORY my_xml_dir
12 ACCESS PARAMETERS
13 (
14 records delimited by "</EMP>"
15 badfile my_xml_dir:'empxt%a_%p.bad'
16 logfile my_xml_dir:'empxt%a_%p.log'
17 FIELDS
18 (
19 filler char(2000) terminated by "<EMP>",
20 EMPNO char(2000) enclosed by "<EMPNO>" and "</EMPNO>",
21 EMPNAME char(2000) enclosed by "<ENAME>" and "</ENAME>",
22 JOB char(2000) enclosed by "<JOB>" and "</JOB>",
23 HIREDATE char(2000) enclosed by "<HIREDATE>" and "</HIREDATE>",
24 SAL char(2000) enclosed by "<SAL>" and "</SAL>"
25 )
26 )
27 LOCATION ('emp.xml')
28 )
29 PARALLEL
30 REJECT LIMIT UNLIMITED
31 /
Table created.
SQL> SELECT * FROM my_xml_et
2 /
EMPNO EMPNAME JOB HIREDATE SAL
7369 SMITH CLERK 17-DEC-80 800
7499 ALLEN SALESMAN 20-FEB-81 1600
This is the XML file i used emp.xml
<EMPLOYEES>
<EMP>
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<JOB>CLERK</JOB>
<HIREDATE>17-DEC-80</HIREDATE>
<SAL>800</SAL>
</EMP>
<EMP>
<EMPNO>7499</EMPNO>
<ENAME>ALLEN</ENAME>
<JOB>SALESMAN</JOB>
<HIREDATE>20-FEB-81</HIREDATE>
<SAL>1600</SAL>
<COMM>300</COMM>
</EMP>
</EMPLOYEES>
Use this external table to insert into your table.
Thanks,
Karthick. -
View Object to read data from a java file
Hi,
I am using JDeveloper 11.1.1.4 and ADF-BC in my application.
For one of my view objects , I want the data to be read from a java file which exposes some method to return a collection.
I cannot use a static view object in this case.
Please suggest the best way to implement this requirement.Basically build a view object that should read data from a java file.
Thanks,
PraveenDepending on your use case you can either use a programmatic VO or directly expose the JV class as a data control.
http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_36/jdtut_11r2_36.html -
GUI_UPLOAD to read data from an Excel File
Hi Folks,
I'm using FM GUI_UPLOAD to read data from an Excel File. But all I see in the table returned is 1 row with garbage values (special chacaters). Excel Workbook has proper data in the sheet, but its not getting uploaded properly. Sy-subrc is 0.
What could be the reason?
Thanksuse FM : ALSM_EXCEL_TO_INTERNAL_TABLE
See the example program to get from XLS file to Internal table
REPORT ZLWMI151_UPLOAD no standard page heading
line-size 100 line-count 60.
*tables : zbatch_cross_ref.
data : begin of t_text occurs 0,
werks(4) type c,
cmatnr(15) type c,
srlno(12) type n,
matnr(7) type n,
charg(10) type n,
end of t_text.
data: begin of t_zbatch occurs 0,
werks like zbatch_cross_ref-werks,
cmatnr like zbatch_cross_ref-cmatnr,
srlno like zbatch_cross_ref-srlno,
matnr like zbatch_cross_ref-matnr,
charg like zbatch_cross_ref-charg,
end of t_zbatch.
data : g_repid like sy-repid,
g_line like sy-index,
g_line1 like sy-index,
$v_start_col type i value '1',
$v_start_row type i value '2',
$v_end_col type i value '256',
$v_end_row type i value '65536',
gd_currentrow type i.
data: itab like alsmex_tabline occurs 0 with header line.
data : t_final like zbatch_cross_ref occurs 0 with header line.
selection-screen : begin of block blk with frame title text.
parameters : p_file like rlgrap-filename obligatory.
selection-screen : end of block blk.
initialization.
g_repid = sy-repid.
at selection-screen on value-request for p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = g_repid
IMPORTING
FILE_NAME = p_file.
start-of-selection.
Uploading the data into Internal Table
perform upload_data.
perform modify_table.
top-of-page.
CALL FUNCTION 'Z_HEADER'
EXPORTING
FLEX_TEXT1 =
FLEX_TEXT2 =
FLEX_TEXT3 =
*& Form upload_data
text
FORM upload_data.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_file
I_BEGIN_COL = $v_start_col
I_BEGIN_ROW = $v_start_row
I_END_COL = $v_end_col
I_END_ROW = $v_end_row
TABLES
INTERN = itab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
write:/10 'File '.
ENDIF.
if sy-subrc eq 0.
read table itab index 1.
gd_currentrow = itab-row.
loop at itab.
if itab-row ne gd_currentrow.
append t_text.
clear t_text.
gd_currentrow = itab-row.
endif.
case itab-col.
when '0001'.
t_text-werks = itab-value.
when '0002'.
t_text-cmatnr = itab-value.
when '0003'.
t_text-srlno = itab-value.
when '0004'.
t_text-matnr = itab-value.
when '0005'.
t_text-charg = itab-value.
endcase.
endloop.
endif.
append t_text.
ENDFORM. " upload_data
*& Form modify_table
Modify the table ZBATCH_CROSS_REF
FORM modify_table.
loop at t_text.
t_final-werks = t_text-werks.
t_final-cmatnr = t_text-cmatnr.
t_final-srlno = t_text-srlno.
t_final-matnr = t_text-matnr.
t_final-charg = t_text-charg.
t_final-erdat = sy-datum.
t_final-erzet = sy-uzeit.
t_final-ernam = sy-uname.
t_final-rstat = 'U'.
append t_final.
clear t_final.
endloop.
delete t_final where werks = ''.
describe table t_final lines g_line.
sort t_final by werks cmatnr srlno.
Deleting the Duplicate Records
perform select_data.
describe table t_final lines g_line1.
modify zbatch_cross_ref from table t_final.
if sy-subrc ne 0.
write:/ 'Updation failed'.
else.
Skip 1.
Write:/12 'Updation has been Completed Sucessfully'.
skip 1.
Write:/12 'Records in file ',42 g_line .
write:/12 'Updated records in Table',42 g_line1.
endif.
delete from zbatch_cross_ref where werks = ''.
ENDFORM. " modify_table
*& Form select_data
Deleting the duplicate records
FORM select_data.
select werks
cmatnr
srlno from zbatch_cross_ref
into table t_zbatch for all entries in t_final
where werks = t_final-werks
and cmatnr = t_final-cmatnr
and srlno = t_final-srlno.
sort t_zbatch by werks cmatnr srlno.
loop at t_zbatch.
read table t_final with key werks = t_zbatch-werks
cmatnr = t_zbatch-cmatnr
srlno = t_zbatch-srlno.
if sy-subrc eq 0.
delete table t_final .
endif.
clear: t_zbatch,
t_final.
endloop.
ENDFORM. " select_data -
Help! How to read data from an Excel file?
Hi,
I need to read data from an Excel file that may contain more then one table in a sheet. How can I read them?
I would be eternally grateful to anyone who can give me any information.Did you try POI from Apache?
http://jakarta.apache.org/poi/index.html -
Read data from a log file to flex textarea while deploying
Hi,
I am new to flex. I am able to read data from a log file that placed in C drive and able to write that data into flex textarea, but I am unable to read the same file while it is deployed into weblogic sever.
Could anyone please tell me how to solve this problem.
Thanks,
Sri.Do you have it trying to read that same file on your C drive or is the file actually deployed somewhere on the server?
-
Read data from a sequential file to fill an arrray
I am trying to read data from a sequential file to fill an array and then use the array for calculations. I believe my program is reading the file; however when I try to use the data for calculations the results show up as boxes rather than numbers. Can someone please take a look and give me some insight into where I am going wrong. The sequential file has the following data:
5.0
5.35
5.5
5.75
Here is my code from that portion of the program. I can send the entire program if necessary.
private void calcResults(TextArea loanResults, double amount, double interest, int term ) throws IOException {
DecimalFormat df = new DecimalFormat("$###,###.00");
NumberFormat formats = new DecimalFormat("#0.00");
StringBuffer buffer=new StringBuffer();
loanResults.append("Month No.\tMonthly Payment\t\tInterest\t\tBalance\n");
double monthlyPay = amount*Math.pow(1+interest,term)*interest/(Math.pow(1+interest,term)-1);
monthlyPayment.setText("" + (formats.format(monthlyPay)));
double principal= amount;
* Loop through each month of a given loan
int month;
for (int i=0; i<term; i++)
try {
int j = 0;
BufferedReader in = new BufferedReader(new FileReader("rates.txt"));
String temp = "";
while((temp = in.readLine()) != null) {
j++;
strRate[j] = temp;
RateValue1 = Double.parseDouble(loanAmountTxFld.getText());
in.close();
catch (FileNotFoundException e) {
System.out.println("Can't find file rate.txt!");
return;
month= i+1;
double rate =principal*interest;
double balance=principal+rate-monthlyPay;
loanResults.append((month) + "\t\t" + (formats.format(principal) + "\t\t" + (formats.format(rate) + "\t\t"
+ (formats.format(balance) + "\n"))));
principal=balance;
GraphArea.append(formats.format(balance) + "\n");
*Method for determining which loan option was chosen
private void calc() throws IOException{
String interestTerms = (String) cOption.getSelectedItem();
if (interestTerms.equalsIgnoreCase("5 yrs at 5.00"))
calcResults(loanResults, Double.parseDouble(loanAmountTxFld.getText()), 0.05/12, 60);
else if (interestTerms.equalsIgnoreCase("7 yrs at 5.35"))
calcResults(loanResults, Double.parseDouble(loanAmountTxFld.getText()), RateValue1/12, 84);
else if (interestTerms.equalsIgnoreCase("15 yrs at 5.50"))
calcResults(loanResults, Double.parseDouble(loanAmountTxFld.getText()), 0.0550/12, 180);
else if (interestTerms.equalsIgnoreCase("30 yrs at 5.75"))
calcResults(loanResults, Double.parseDouble(loanAmountTxFld.getText()), 0.0575/12, 360);
else if (interestTerms.equalsIgnoreCase(" "))
calcResults(loanResults, Double.parseDouble(loanAmountTxFld.getText()), Double.parseDouble(loanInterestTxFld.getText())/100/12,Integer.parseInt(loanTermTxFld.getText())*12);
}ok, I fixed my program per your suggestion and I still cannot get it to work. I get the same result where the ouput is just a bunch of boxes. I also tried to print to see what I am getting and all I see is the values of the array [5.0,5.35,5.5,5.75] but I cannot seem to pass that to the calculations. I wish I could figure this out. Does anybody have any suggestions as to what I am doing wrong. This is the portion of my code that I am having issues with:
private void calcResults(TextArea loanResults, double amount,double interest, int term ) throws IOException {
DecimalFormat df = new DecimalFormat("$###,###.00");
NumberFormat formats = new DecimalFormat("#0.00");
StringBuffer buffer=new StringBuffer();
loanResults.append("Month No.\tMonthly Payment\t\tInterest\t\tBalance\n");
double monthlyPay = amount*Math.pow(1+interest,term)*interest/(Math.pow(1+interest,term)-1);
monthlyPayment.setText("" + (formats.format(monthlyPay)));
double principal= amount;
* Loop through each month of a given loan
int month;
for (int i=0; i<term; i++)
month= i+1;
double rate =principal*interest;
double balance=principal+rate-monthlyPay;
loanResults.append((month) + "\t\t" + (formats.format(principal) + "\t\t" + (formats.format(rate) + "\t\t"
+ (formats.format(balance) + "\n"))));
principal=balance;
GraphArea.append(formats.format(balance) + "\n");
private void readFile() throws IOException
try {
int j = 0;
BufferedReader in = new BufferedReader(new FileReader("rates.txt"));
String temp = "";
while((temp = in.readLine()) != null) {
strRate[j] = temp;
j++;
RateValue1 = Double.valueOf(((String)(strRate[1]))
).doubleValue();
// RateValue1 = Double.parseDouble(loanAmountTxFld.getText());
in.close();
catch (FileNotFoundException e) {
System.out.println("Can't find file rates.txt!");
return;
*Method for determining which loan option was chosen
private void calc() throws IOException{
String interestTerms = (String) cOption.getSelectedItem();
if (interestTerms.equalsIgnoreCase("5 yrs at 5.00"))
calcResults(loanResults, Double.parseDouble(loanAmountTxFld.getText()), 0.05/12, 60);
else if (interestTerms.equalsIgnoreCase("7 yrs at 5.35"))
calcResults(loanResults, Double.parseDouble(loanAmountTxFld.getText()), RateValue1/12, 84);
else if (interestTerms.equalsIgnoreCase("15 yrs at 5.50"))
calcResults(loanResults, Double.parseDouble(loanAmountTxFld.getText()), 0.0550/12, 180);
else if (interestTerms.equalsIgnoreCase("30 yrs at 5.75"))
calcResults(loanResults, Double.parseDouble(loanAmountTxFld.getText()), 0.0575/12, 360);
else if (interestTerms.equalsIgnoreCase(" "))
calcResults(loanResults, Double.parseDouble(loanAmountTxFld.getText()), Double.parseDouble(loanInterestTxFld.getText())/100/12,Integer.parseInt(loanTermTxFld.getText())*12);
} -
Need to read data from a text file
I need to read data from a text file and create my own hash table out of it. I'm not allowed to use the built in Java class, so how would I go implementing my own reading method and hash table class?
It's not possible to read from a file without using classes from the core API*. You'll have to get clarification from your instructor as to which classes are and are not allowed.
[http://java.sun.com/docs/books/tutorial/essential/io/]
*Unless you write a bunch of JNI code to replicate what the java.io classes are doing.
Maybe you are looking for
-
At home we have a very very poor connection with BT Broadband as we are too far from the exchange - our internet connection has been off more than it has been on for the last 6 months or so - no amount of calling/emailling has got anyone in BT intere
-
HOW DO I ENABLE COOKIES SO I CAN ACCESS MY GMAIL?
My gmail account is not allowing me access because the computer is saying something about my cookie settings and I have NO EARTHLY IDEA WHAT IT IS ASKING ME TO DO! I've tried to follow your useless directions to change settings and am getting NOWHERE
-
IMac G5 2009 - should I update to Yosemite?
I have an early 2009 iMac G5 - 3.06 GHz Intel Core 2 Duo currently running 10.9.5 and I am terrified to update to Yosemite based on the reviews. Could someone who has a similar age iMac tell me that they updated and have no issues please? THANK YOU
-
Fix the position of the movieClip
Hello all, yesterday i got solution from murphy that to load the xml value in a duplocate movie clip. Thanks you murphy... now i have done a math class to make it xml value in best fit in my screen. 1. now i want o make my moviClip in fixed postion.
-
How can I get an american english option?
How can I get an american english option in the inspector? I get all kind of english: Australian English Canadian English British English and normal English. I would need the American English option. Thanks, Daniel