How to search xml file data based on the given keyword from html form
hi,
i'm new to XML. I have this problem regarding searching within a XML file.
the
idea is that my search will be based on the keyword entered
in
by the user from a HTML form. the keyword is then used to search all
the
question nodes and the choice nodes within a XML file. once the match
is
found, i will have to display the results.
But i don't know how to do so - especially the part of searching xml file.
Can
anyone help me in this? Your help is much appreciated.
Edited by: Moti_Lal.D on Apr 4, 2008 7:28 AM
yeah.. what i was trying to do is
i have one xml fine. then i have to read all the tag values say
<book>
<title>Java</title>
<author>agarwal</author>
<price>200</price>
</book>
<book>
<title>Xml</title>
<author>saxmann</author>
<price>300</price>
</book>
i can read the tag values like this
File file = new File("dom.xml");
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(file);
NodeList nodes = doc.getElementsByTagName"book");
for (int i = 0; i < nodes.getLength(); i++) {
Element element = (Element) nodes.item(i);
NodeList title = element.getElementsByTagName("title");
Element line = (Element) title.item(0);
what i want is i may give any xml file
like File file = new File("xxx.xml");
(it may be one level/two level/3level tagged one)
then the i should read all the tag values and store them in some array. Then when i enter some character from keyboard (say "a") then it has to show all the tag values starts with "a" and display them.
i guess u understand my problem.
Similar Messages
-
hi ,
I know how to load data from csv file...
Anyone can guide me for how to load data from xml file
i need step by step guidence
from
namanhi naman shah,
you can used XML DOM in SAP in order to read data from xml file
first step to do that, you need to read the xml file using OPEN DATASET
after that you convert the content of the file to XML DOM class in SAP using function modul SDIXML_XML_TO_DOM
after that you can read / manipulate the data from xml.
for the XML DOM class documentation in SAP, please refer to http://help.sap.com/saphelp_crm50/helpdata/en/bb/576637dca511d4990b00508b6b8b11/frameset.htm
hopes it helps
regards
eddhie -
How to calculate Goods issue date based on the time of delivery
Hi SAP Gurus,
I seek your help/suggestion for the given scenario.
The user requires calculating the GI date based on time of delivery.
Based on the delivery priority (like Priority 1= Day 1, Priority 2= Day 2) maintained in customer master, the need is something like below-
1st case= If Retail Customeru2019s delivery orders received before midday (Noon cut off) require to be dispatched on same working day (Day 1)
Wholesaler customer delivery orders received before midday require to be dispatched by the next
Working day (Day 2 Including day of receipt)
2nd case= Retail customeru2019s delivery orders received after midday require to be dispatched by the next working day
Wholesaler customer delivery orders received after midday require to be dispatched by on day 3
Kindly suggest , how to proceed in this. I am new to SAP world so need ur help to tackle this.
Thanks a lot in advance for the valuable inputs.What I proposed to do was,
a. Create routes like 0 day route, 1 Day route, 2 day route etc.
b. Route determination is based on the Shipping condition of the customer. Put in the shipping condition for the customer as 00 - immediate delivery. 01 - By Truck, 02 - By Rail, 03 - Ship etc
c. Now, put in your route determination in such a way that routes change in the sales order with shipping condition (SC). Like, if the shipping condition is set to 00, then 0 day route comes up. Meaning immediate delivery, if SC is 01, then your normal route by truck picks up. etc.
When the sales order is manually created, you know the time of creation. As route is one of the criteria, the material confirmation happens based on number of days you put in the route to reach the destination. Now that you have the material available for today's delivery, the delivery program can be run to create it, or it can be manually created.
Now, when you configure the route you have to specify 'Transit duration in calendar days'.
When you have the sales order created electronically (say thru EDI), then, you may have to ask them to send in shipping condition. Else, you have to modify the function module Idoc_input_orders in such a way that if the sales order creation time is < 12 PM, then put shipping condition as 00, else copy what ever is there in the customer.
If you do not want to check the time manually when the user creates the sales order, then you may have to use the user exit MV45AFZZ (and I think you can use Save_order_prepare) to check the time and change the shipping condition. By this you will avoid extra coding in Idoc_input_orders and also need not bother if the user changed the route or not.
Hope my explanation helps.
Regards,
Mukund S -
Issue with fetching data based on the given criteria.....
Dear All,
I am a bit new to oracle, Please can some help me.
I need to design a report out of the below data:
1. bprf_no will be my primary field
2. report parameters will be the bill_month & no_of_months
Based on above 2 parameters I need to scan through the data for BILL_MONTH <= '30-Jun-2012' and NO_OF_MONTHS >= 3 the other criteria being the AVG_IND in (1,2).
In brief the criteria will be to pick all BPRF_NO having AVG_ID in (1, 2) consecutively till a break (AVG_IND not in (1, 2) starting from the given BILL_MONTH and going below this period, that is BILL_MONTH <= '30-Jun-2012'.
For the below data, if my parameters are: BILL_MONTH <= '30-Jun-2012' and NO_OF_MONTHS >= 3, only the underlined data should be picked (as they fulfill the criteria) and the report output will be like the one posted below the sample data:
Here the NO_OF_TIMES is the count, that is no of times the BPRF_NO falls into the above mentioned criteria consecutively starting from the provided BILL_MONTH.
BPRF_NO BILL_MONTH VOID_STATUS AVG_IND
BP01 30-Jun-12 0 0
BP02 30-Jun-12 0 0
BP03 30-Jun-12 0 1
BP04 30-Jun-12 0 1
BP05 30-Jun-12 0 1
BP06 30-Jun-12 0 2
BP07 30-Jun-12 0 2
BP08 30-Jun-12 0 2
BP09 30-Jun-12 0 0
BP10 30-Jun-12 0 0
BP10 30-Jun-12 0 0
BP01 31-May-12 0 0
BP02 31-May-12 0 0
BP03 31-May-12 0 1
BP04 31-May-12 0 1
BP05 31-May-12 0 1
BP06 31-May-12 0 2
BP07 31-May-12 0 2
BP08 31-May-12 0 2
BP09 31-May-12 0 0
BP10 31-May-12 0 0
BP01 30-Apr-12 0 0
BP02 30-Apr-12 0 0
BP03 30-Apr-12 0 0
BP04 30-Apr-12 0 0
BP05 30-Apr-12 0 1
BP06 30-Apr-12 0 2
BP07 30-Apr-12 0 2
BP08 30-Apr-12 0 2
BP09 30-Apr-12 0 0
BP10 30-Apr-12 0 0
BP01 31-Mar-12 0 0
BP02 31-Mar-12 0 0
BP03 31-Mar-12 0 1
BP04 31-Mar-12 0 1
BP05 31-Mar-12 0 1
BP06 31-Mar-12 0 2
BP07 31-Mar-12 0 2
BP08 31-Mar-12 0 2
BP09 31-Mar-12 0 0
BP10 31-Mar-12 0 0
BP01 29-Feb-12 0 0
BP02 29-Feb-12 0 0
BP03 29-Feb-12 0 1
BP04 29-Feb-12 0 1
BP05 29-Feb-12 0 1
BP06 29-Feb-12 0 2
BP07 29-Feb-12 0 2
BP08 29-Feb-12 0 2
BP09 29-Feb-12 0 0
BP10 29-Feb-12 0 0
BP01 31-Jan-12 0 0
BP02 31-Jan-12 0 0
BP03 31-Jan-12 0 0
BP04 31-Jan-12 0 0
BP05 31-Jan-12 0 1
BP06 31-Jan-12 0 2
BP07 31-Jan-12 0 2
BP08 31-Jan-12 0 2
BP09 31-Jan-12 0 0
BP10 31-Jan-12 0 0
Below is the correct output that I am supposed to get.
BPRF_NO BILL_MONTH NO_OF_TIMES
BP05 30-Jun-2012 6
BP06 30-Jun-2012 6
BP07 30-Jun-2012 6
BP08 30-Jun-2012 6
My below query is fetching me wrong data:
Here BP03 & BP04 should not come into the listing itself.
select bprf_no, last_avg_bill_month, no_of_month
from
( select a.bprf_no, max(a.bill_month) last_avg_bill_month, count(*) no_of_month
from
( select
bill_month, avg_ind, bprf_no
from ibsoifc.vw_ibs_bill
where bill_month <= '30-Jun-2012'
and void_status = 0
and avg_ind in (1, 2)
order by bprf_no desc, bill_month desc ) a, ibsoifc.vw_ibs_bill b
where a.bprf_no = b.bpref_no
and a.bill_month = b.bill_month
group by a.bprf_no
having count(a.bprf_no) >= '&no_of_month' )
group by bprf_no,last_avg_bill_month, no_of_month
BPRF_NO LAST_AVG_BILL_MONTH NO_OF_TIMES
BP03 30-Jun-2012 4
BP04 30-Jun-2012 4
BP05 30-Jun-2012 6
BP06 30-Jun-2012 6
BP07 30-Jun-2012 6
BP08 30-Jun-2012 6Based on my understanding..
select *
from t
order by bill_month desc,bprf_no;
BPRF_NO BILL_MONTH VOID_STATUS AVG_IND
BP01 30-JUN-12 0 0
BP02 30-JUN-12 0 0
BP03 30-JUN-12 0 1
BP04 30-JUN-12 0 1
BP05 30-JUN-12 0 1
BP06 30-JUN-12 0 2
BP07 30-JUN-12 0 2
BP08 30-JUN-12 0 2
BP09 30-JUN-12 0 0
BP10 30-JUN-12 0 0
BP10 30-JUN-12 0 0
BP01 31-MAY-12 0 0
BP02 31-MAY-12 0 0
BP03 31-MAY-12 0 1
BP04 31-MAY-12 0 1
BP05 31-MAY-12 0 1
BP06 31-MAY-12 0 2
BP07 31-MAY-12 0 2
BP08 31-MAY-12 0 2
BP09 31-MAY-12 0 0
BP10 31-MAY-12 0 0
BP01 30-APR-12 0 0
BP02 30-APR-12 0 0
BP03 30-APR-12 0 0
BP04 30-APR-12 0 0
BP05 30-APR-12 0 1
BP06 30-APR-12 0 2
BP07 30-APR-12 0 2
BP08 30-APR-12 0 2
BP09 30-APR-12 0 0
BP10 30-APR-12 0 0
BP01 31-MAR-12 0 0
BP02 31-MAR-12 0 0
BP03 31-MAR-12 0 1
BP04 31-MAR-12 0 1
BP05 31-MAR-12 0 1
BP06 31-MAR-12 0 2
BP07 31-MAR-12 0 2
BP08 31-MAR-12 0 2
BP09 31-MAR-12 0 0
BP10 31-MAR-12 0 0
BP01 29-FEB-12 0 0
BP02 29-FEB-12 0 0
BP03 29-FEB-12 0 1
BP04 29-FEB-12 0 1
BP05 29-FEB-12 0 1
BP06 29-FEB-12 0 2
BP07 29-FEB-12 0 2
BP08 29-FEB-12 0 2
BP09 29-FEB-12 0 0
BP10 29-FEB-12 0 0
BP01 31-JAN-12 0 0
BP02 31-JAN-12 0 0
BP03 31-JAN-12 0 0
BP04 31-JAN-12 0 0
BP05 31-JAN-12 0 1
BP06 31-JAN-12 0 2
BP07 31-JAN-12 0 2
BP08 31-JAN-12 0 2
BP09 31-JAN-12 0 0
BP10 31-JAN-12 0 0
61 rows selected
with t1 as
(select BPRF_NO,BILL_MONTH,VOID_STATUS,AVG_IND,sm,
case when sm >= 3 then
nvl(sm - lag(sm) over(partition by bill_month order by bprf_no),sm)
else 0 end d
from(
select BPRF_NO,BILL_MONTH,VOID_STATUS,AVG_IND,
sum(decode(avg_ind,1,1,2,1,0)) over(partition by bill_month order by bprf_no) sm
from t
where bill_month = to_date('30-Jun-12','dd-Mon-yy')
order by bill_month desc,bprf_no)
select t1.bprf_no,count(t.bprf_no)+1 no_of_times -- "The '1' stands for the count in t"
from t1, t
where t1.bprf_no = t.bprf_no -- "This can be an outer join based on your requirement and data.."
and t1.d = 1
and t.bill_month < to_date('30-Jun-12','dd-Mon-yy')
group by t1.bprf_no
order by 1;
BPRF_NO NO_OF_TIMES
BP05 6
BP06 6
BP07 6
BP08 6 -
I'm using Adobe Air 3 for IOS offline app, and I want to implement a download updates (html files + js,css) feature from within the application. The files would be displayed in a StageWebView component.
Since Apple doesn't allow saving files inside the installation directory, I must use ApplicationStorageDirectory instead to download files into.
I want those download html files to link to .js / .css files already installed within the main application directory (e.g. at myApp.app).
The reason for that is I want to minimize the number of the downloaded (shared) files as much as possible. Is this possible?
Thank you.I think this doesn't work in StageWebView:
http://help.adobe.com/en_US/air/build/WSfffb011ac560372f7e64a7f12cd2dd1867-8000.html#WS901 d38e593cd1bac354f4f7b12e260e3e67-8000
"Note: Links in a StageWebView instance cannot open URLs that use a custom URI scheme."
So I can't for example do this:
<link rel="stylesheet" href="app:/CSS/Templates.css" type="text/css" media="screen, mobile" title="main" charset="utf-8">
What I need is something like the following:
Inside ApplicationStoarageDirectory (/Library/Application Support/):
test.html
I need it to link to a css file located inside ApplicationDirectory (installation directory), something like:
<link rel="stylesheet" href="../../MyApp.app/CSS/Templates.css" type="text/css" media="screen, mobile" title="main" charset="utf-8"> -
How to search XML file for specific attributes ...
Hi, Im trying to design a XML driven billboard. Is there an easy way to seach attributes of all elements using DOM parser and return the element with attribute that matched search criteria?
Yes. Are you using jsdk1.4? If true then look at the XPathAPI.
I wrote a package for working with XML vocabularies. If you are interested on it, here is an example that uses amic-util.jar to find nodes with the id-user attribute:
XmlReader xr = new XmlReader("vocabulary.xml");
NodeSet ns = new XPathFinder(xr).findNodes("*[@id-user]");
while(ns.hasNextNode()) {
XmlReader node = ns.nextNode();
}Send me an e-mail and I will send you back the amic-util.jar and the javadocs. -
XML File not Found for the Container BC4J.cpx
Hi,
Have following error when I start a BC4J-JSP/Struts application (with Embedded and standalone OC4J) :
500 Internal Server Error
oracle.jbo.NoXMLFileException: JBO-26001: XML File not found for the Container BC4J.cpx
oracle.jbo.mom.ContainerDefImpl oracle.jbo.mom.DefinitionManager.loadProjectDefinition(java.lang.String)
DefinitionManager.java:751
oracle.jbo.mom.ContainerDefImpl oracle.jbo.mom.DefinitionManager.loadProjectDefinition()
DefinitionManager.java:793
void oracle.jbo.mom.DefinitionManager.initManager()
DefinitionManager.java:137
void oracle.jbo.uicli.mom.JUMetaObjectManager.<init>()
JUMetaObjectManager.java:57
oracle.jbo.uicli.mom.JUMetaObjectManager oracle.jbo.uicli.mom.JUMetaObjectManager.getJUMom()
JUMetaObjectManager.java:131
oracle.jbo.common.ampool.SessionCookie oracle.jbo.http.HttpContainer.findSessionCookie(javax.servlet.http.HttpSession, java.lang.String, java.lang.String, java.util.Properties)
HttpContainer.java:541
boolean oracle.jbo.html.struts11.BC4JRequestProcessor.initPageFromPath(oracle.jbo.html.struts11.BC4JActionMapping, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
BC4JRequestProcessor.java:222
org.apache.struts.action.ActionMapping oracle.jbo.html.struts11.BC4JRequestProcessor.processMapping(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String)
BC4JRequestProcessor.java:124
void org.apache.struts.action.RequestProcessor.process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
RequestProcessor.java:234
void org.apache.struts.action.ActionServlet.process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
ActionServlet.java:1292
void org.apache.struts.action.ActionServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
ActionServlet.java:492
void javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
HttpServlet.java:740
void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
HttpServlet.java:853
void com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
ServletRequestDispatcher.java:721
void com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
ServletRequestDispatcher.java:306
boolean com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.processRequest(com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.ApplicationServerThread, com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.EvermindHttpServletRequest, com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
HttpRequestHandler.java:767
void com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.run(java.lang.Thread)
HttpRequestHandler.java:259
void com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.run()
HttpRequestHandler.java:106
void EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run()
PooledExecutor.java:803
void java.lang.Thread.run()
Thread.java:484
Then I make a Reload and it's ok.
I have a Workspace with two Projects :
BC4J.jpr for Businnes Components
Web.jpr for JSP Struts
In /classes I have the file Web.cpx, but no BC4J.cpx.
From which does this name come ? Can I change this name ?
Thanks
YvesI found this on Metalink...
JBO-26001: NoXMLFileException
Cause: Could not open the named XML file for read.
The following is from Note 137429.1. Hope this helps.
Raja.
JBO-26001: NoXMLFileException
Cause: Could not open the named XML file for read.
Action: 1. Make sure that the file is present. In particular, if the file is to be found in a zip/jar file, make sure that the Zip/JAR file is included in the CLASSPATH.
2. This error is also reported if the name of the XML file does not match the object Name specified in the XML file. If the file system support case insensitive file names (e.g., Windows NT), make sure that the file name matches the object Name in the XML file in case-sensitive fashion.
3. For a .JPX file, this error is reported if the JPX file is missing the JboProject XML tag. Check the JPX file to make sure that the valid tag is in there.
4. One XML file may be extending another XML file (specified by the Extends element in this XML file). This error is reported if the base XML file is not found.
5. When loading the XML file for a package (JboPackage tag), this error is reported if some unexpected error occurs while loading a containee.
In all of the above cases, a more descriptive message may be printed on Diagnostic. If you are not seeing Diagnostic messages, you can run your application with Diagnostic turned on, as in "java -Djbo.debugoutput=console ...", to see Diagnostic messages. -
How to read XML file and update the data in MS CRM 2011?
Hi Folks,
Can anyone please help me finding some references to read XML files and push the data to MS CRM 2011 preferably by using a console application.
Please let me know if any ways of handling it in simple ways.
Thanks,
SriHI,
How to read XML file:
https://social.msdn.microsoft.com/Forums/en-US/5dd7261b-86c4-4ca8-ba87-95196ef3ba50/need-to-display-xml-file-in-textboxes-edit-the-data-and-save-the-new-xml-file?forum=csharpgeneral
How to work with CRM:
ClientCredentials credentials = new ClientCredentials();
credentials.Windows.ClientCredential = new System.Net.NetworkCredential("USER", "Password", "Domain");
Uri uri = new Uri("http://server/Organization/XRMServices/2011/Organization.svc");
OrganizationServiceProxy proxy = new OrganizationServiceProxy(uri, null, credentials, null);
proxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
IOrganizationService service = (IOrganizationService)proxy;
//using "service" you can create, update and retrieve entities.
More information here about service functions:
https://msdn.microsoft.com/en-us/library/gg328198.aspx -
How to generate XML file based on XSD in SSIS
please provide step by step process to create xml based on XSD in SSIS
Hi hemasankar,
In SQL Server Integrated Services, we can generate XML Schema (XSD) file based on a XML file with XML Source Editor. If we want to generate XML file based on a XSD file, we can use Generate Sample XML feature in Visual Studio. For more details, please refer
to the following steps:
Click on "XML Schema Explorer" or 'Use the XML Schema Explorer...' to open XML Schema Explorer in Visual Studio.
If your Schema file is valid and you are having elements, right-click on element and click on "Generate Sample XML", this functionality generates XML file in temp folder and open ups in the XML Editor.
The following two document about how to generate XML file based on a XSD file are for your reference:
http://msdn.microsoft.com/en-us/library/dd489258.aspx
http://www.codeproject.com/Articles/400016/Generate-Sample-XML-from-XSD
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
How to update XML file using XSLT
Hi there,
I have a "small" issue with exporting data to an XML file using XSLT.
A two steps process is needed to import data from a non-hierarchical XML file into ABAP, change the data, and then update the XML file with new values. The problem is not trivial, since the format of the XML file is a complex one: there are many interdependent elements on the same level, pointing to each other by using id and ref attributes. Based on these values the data can be read and written into an internal table. I use XSLT and XPath for that. So the inbound process is done and seems to work correctly. I have to mention that the file contains much more data than I need. I am working only with a small part of it.
Now the changed data must be exported back into the XML file, meaning that the content of certain elements must be updated. How can this be done with XSLT? I can pass only the internal table to the transformation, so how do I access the XML file in order to update it? I have tried to use the <B>xsl:document()</B> function to access the content of the file store locally on my PC, but it fails each time by throwing and URI exception. I have tried the absolute path without any addition and the path with the file:/// addition. Same result. Please advise.
Many thanks,
Ferenc
P.S. Please provide me with links only if they are relevant for this very matter. I will not give points for irrelevant postings...Now the changed data must be exported back into the XML file, meaning that the content of certain elements must be updated. How can this be done with XSLT?
XSLT approach: check these online tutorial
http://www.xml.com/pub/a/2000/08/02/xslt/index.html
http://www.xml.com/pub/a/2000/06/07/transforming/index.html
ABAP approach:
for example you have the xml (original) in a string called say xml_out .
data: l_xml type ref to cl_xml_document ,
node type ref to if_ixml_node .
create object l_xml.
call method l_xml->parse_string
exporting
stream = xml_out.
node = l_xml->find_node(
name = 'IDENTITY'
ROOT = ROOT
l_xml->set_attribute(
name = 'Name'
value = 'Charles'
node = node
(the above example reads the element IDENTITY and sets attribute name/value to the same)
like wise you can add new elements starting from IDENTITY using various methods available in class CL_XML_DOCUMENT
so how do I access the XML file in order to update it?
you have already read this XML into a ABAP variable right?
Sorry couldnt understand your whole process, why do you need to read local XML file?
Raja -
How to convert XML file to an internal table ?
Hi All,
I want to do a batch input program. The source data would be given as an excel file . I would like to know how to convert XML file to internal table properly. Please help me out..
Thanking you in advance ..
Shankara Narayanan T.VHi Shankar,
use 'ALSM_EXCEL_TO_INTERNAL_TABLE' FM.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file1
i_begin_col = '1'
i_begin_row = '5'
i_end_col = '40'
i_end_row = '16'
TABLES
intern = it_intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
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 it_intern.
AT NEW row.
CLEAR it_intern.
ENDAT.
CASE lv_flag.
Production Version
WHEN 1.
it_master-matnr = it_intern-value.
WHEN 2.
it_master-werks = it_intern-value.
WHEN 3.
it_master-verid = it_intern-value.
WHEN 4.
it_master-text1 = it_intern-value.
WHEN 5.
it_master-fdate = it_intern-value.
AT END OF row.
APPEND it_master.
ENDAT.
ENDLOOP.
-Anu
Message was edited by:
Anupama Reddy -
Reading XML file using BAPI and then uploading that xml file data into SAP
I am getting a xml file from Java server. I need to take
data from this file using BAPI and need to upload into SAP using SAP.
Please tell me how to read XML files using BAPI's.<b>SDIXML_DATA_TO_DOM</b> Convert SAP data (elementary/structured/table types) into DOM (XML
<b>SDIXML_DOM_TO_XML</b> Convert DOM (XML) into string of bytes that can be downloaded to PC or application server
<b>SDIXML_DOM_TO_SCREEN</b> Display DOM (XML)
<b>SDIXML_DOM_TO_DATA</b>
data: it_table like t001 occurs 0.
data: l_dom TYPE REF TO IF_IXML_ELEMENT,
m_document TYPE REF TO IF_IXML_DOCUMENT,
g_ixml TYPE REF TO IF_IXML,
w_string TYPE XSTRING,
w_size TYPE I,
w_result TYPE I,
w_line TYPE STRING,
it_xml TYPE DCXMLLINES,
s_xml like line of it_xml,
w_rc like sy-subrc.
start-of-selection.
select * from t001 into table it_table.
end-of-selection.
initialize iXML-Framework ****
write: / 'initialiazing iXML:'.
class cl_ixml definition load.
g_ixml = cl_ixml=>create( ).
check not g_ixml is initial.
write: 'ok'.
create DOM from SAP data ****
write: / 'creating iXML doc:'.
m_document = g_ixml->create_document( ).
check not m_document is initial.
write: 'ok'.
write: / 'converting DATA TO DOM 1:'.
CALL FUNCTION 'SDIXML_DATA_TO_DOM'
EXPORTING
NAME = 'IT_TABLE'
DATAOBJECT = it_table[]
IMPORTING
DATA_AS_DOM = l_dom
CHANGING
DOCUMENT = m_document
EXCEPTIONS
ILLEGAL_NAME = 1
OTHERS = 2.
if sy-subrc = 0. write 'ok'.
else. write: 'Err =', sy-subrc.
endif.
check not l_dom is initial.
write: / 'appending DOM to iXML doc:'.
w_rc = m_document->append_child( new_child = l_dom ).
if w_rc is initial. write 'ok'.
else. write: 'Err =', w_rc.
endif.
visualize iXML (DOM) ****
write: / 'displaying DOM:'.
CALL FUNCTION 'SDIXML_DOM_TO_SCREEN'
EXPORTING
DOCUMENT = m_document
EXCEPTIONS
NO_DOCUMENT = 1
OTHERS = 2.
if sy-subrc = 0. write 'ok'.
else. write: 'Err =', sy-subrc.
endif.
convert DOM to XML doc (table) ****
write: / 'converting DOM TO XML:'.
CALL FUNCTION 'SDIXML_DOM_TO_XML'
EXPORTING
DOCUMENT = m_document
PRETTY_PRINT = ' '
IMPORTING
XML_AS_STRING = w_string
SIZE = w_size
TABLES
XML_AS_TABLE = it_xml
EXCEPTIONS
NO_DOCUMENT = 1
OTHERS = 2.
if sy-subrc = 0. write 'ok'.
else. write: 'Err =', sy-subrc.
endif.
write: / 'XML as string of size:', w_size, / w_string.
describe table it_xml lines w_result.
write: / 'XML as table of', w_result, 'lines:'..
loop at it_xml into s_xml.
write s_xml.
endloop.
write: / 'end of processing'.
end of code
Hope this will be useful.
regards
vinod -
How to update XML file from the program
i am new in abap , and i have the following issue,so plz anyone who knows how to do it
Background :
An XML file is used as the datasource for a Flex Application. From time to time this requires updating with new staff details.
i have already saved the xml file in the c drive with the name C:\AdvAC\AC1\bin-debug\assets\staff
Requirement : Write a Dialog transaction with the following text input fields.
Reference Indicator. (Char10)
Staff No (NUMC, Length 5)
Name (Char50)
Room (Numc, length 3)
Phone (Numc Length 7)
Mail (char30)
in screen 100
The transaction should also have an u201CUpdate Fileu201D button, which when pressed :
1) Loads the file C:\AdvAC\AC1\bin-debug\assets \ into an ITAB.
2) Inserts the data into the ITAB using the following XML format.
<staff>
<ref_ind> Reference Indicator.</ref_ind>
<staff_no> Staff No </staff_no>
<name> Name </name>
<room> Room </room>
<phone> Phone </phone>
<mail> Mail </mail>
</staff>
all should be inside <allstaff> </allstaff> tagsu2026.
Writes the ITAB back to the file.
thanx allthis is what i have done but i dont know how to do the rest. i will apprecite any help from u.
Edited by: man700s on Feb 16, 2010 6:58 AM
REPORT Z_XML_FILE_UPDATE.
TYPES: BEGIN OF ts_staff,
REF_IND(10) TYPE c,
Staff_No(5) TYPE c,
Name(50) TYPE c,
Room(3) Type n,
Phone(7) Type n,
Mail(30) Type c,
END OF ts_staff.
DATA: t_staff TYPE TABLE OF ts_staff WITH HEADER LINE.
DATA: w_staff Type ts_staff.
DATA T_STRING TYPE TABLE OF STRING.
DATA W_STRING TYPE STRING.
call SCREEN 100.
PERFORM upload_xml_file.
PERFORM update_xml_tab.
*PERFORM download_xml_file.
MODULE USER_COMMAND_0100 INPUT.
W_STRING = '<allstaff>'.
APPEND w_string to t_string.
loop at t_staff into w_staff.
w_string ='<staff>'.
APPEND w_string to t_string.
if T_staff-Ref_Ind = 'X'.
CONCATENATE '<Ref_Ind>' w_staff-Ref_Ind '</Ref_Ind>' into w_string.
APPEND w_string to t_string.
ENDIF.
if T_staff-staff_no = 'X'.
CONCATENATE '<staff_no>' w_staff-staff_no '</staff_no>' into w_string.
APPEND w_string to t_string.
ENDIF.
if T_staff-name = 'X'.
CONCATENATE '<name>' w_staff-name '</name>' into w_string.
APPEND w_string to t_string.
ENDIF.
if T_staff-room = 'X'.
CONCATENATE '<room>' w_staff-room '</room>' into w_string.
APPEND w_string to t_string.
ENDIF.
if T_staff-phone = 'X'.
CONCATENATE '<phone>' w_staff-phone '</phone>' into w_string.
APPEND w_string to t_string.
ENDIF.
if T_staff-mail = 'X'.
CONCATENATE '<mail>' w_staff-mail '</mail>' into w_string.
APPEND w_string to t_string.
ENDIF.
w_string = '</staff>'.
append w_string to t_string.
ENDLOOP.
W_STRING = '</allstaff>'.
APPEND w_string to t_string.
ENDMODULE.
Edited by: man700s on Feb 16, 2010 7:01 AM -
How to use XML file as a source in BODS?
How to use XML file as a source in BODS?
Could anyone please help me out for this?exmpale XML file :
<?xml version="1.0" encoding="utf-8"?>
<MM_RECON_REPORT>
<RPT_DATE>str1234</RPT_DATE>
<RPT_ROW>
<SRC_EXT_REC_COUNT>123.45</SRC_EXT_REC_COUNT>
<PRE_TRANS_REC_COUNT>123.45</PRE_TRANS_REC_COUNT>
<POST_TRANS_REC_COUNT>123.45</POST_TRANS_REC_COUNT>
<PASS_BAPI_REC_COUNT>123.45</PASS_BAPI_REC_COUNT>
<TOT_SAP_RETURN>123.45</TOT_SAP_RETURN>
<TOT_SAP_SUCC_REC_COUNT>123.45</TOT_SAP_SUCC_REC_COUNT>
<PARTIAL_SUCC_REC_COUNT>123.45</PARTIAL_SUCC_REC_COUNT>
<TOT_SAP_ERR_REC_COUNT>123.45</TOT_SAP_ERR_REC_COUNT>
<MM_SUCC_REC_COUNT>123.45</MM_SUCC_REC_COUNT>
<MM_ERR_REC_COUNT>123.45</MM_ERR_REC_COUNT>
<CLS_SUCC_REC_COUNT>123.45</CLS_SUCC_REC_COUNT>
<CLS_ERR_REC_COUNT>123.45</CLS_ERR_REC_COUNT>
<CP_SUCC_REC_COUNT>123.45</CP_SUCC_REC_COUNT>
<CP_ERR_REC_COUNT>123.45</CP_ERR_REC_COUNT>
<VMS_SUCC_REC_COUNT>123.45</VMS_SUCC_REC_COUNT>
<VMS_ERR_REC_COUNT>123.45</VMS_ERR_REC_COUNT>
<SOURCE_TYPE>str1234</SOURCE_TYPE>
<RUN_ID>123.45</RUN_ID>
<RUN_SEQ>123.45</RUN_SEQ>
<RUN_DATE>2012-12-13</RUN_DATE>
</RPT_ROW>
</MM_RECON_REPORT>
example XSD file :
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:documentation xml:lang="en">
XML Schema generated by Data Services
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType name="DIType-decimal-28-0">
<xsd:restriction base="xsd:decimal">
<xsd:totalDigits value="28"/>
<xsd:fractionDigits value="0"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DIType-varchar-200">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="200"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DIType-varchar-10">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DATE">
<xsd:restriction base="xsd:date">
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="MM_RECON_REPORT" >
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="RPT_DATE" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="RPT_ROW" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="RPT_DATE" type = "DIType-varchar-200"/>
<xsd:element name="RPT_ROW" >
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="SRC_EXT_REC_COUNT" />
<xsd:element ref="PRE_TRANS_REC_COUNT" />
<xsd:element ref="POST_TRANS_REC_COUNT" />
<xsd:element ref="PASS_BAPI_REC_COUNT" />
<xsd:element ref="TOT_SAP_RETURN" />
<xsd:element ref="TOT_SAP_SUCC_REC_COUNT" />
<xsd:element ref="PARTIAL_SUCC_REC_COUNT" />
<xsd:element ref="TOT_SAP_ERR_REC_COUNT" />
<xsd:element ref="MM_SUCC_REC_COUNT" />
<xsd:element ref="MM_ERR_REC_COUNT" />
<xsd:element ref="CLS_SUCC_REC_COUNT" />
<xsd:element ref="CLS_ERR_REC_COUNT" />
<xsd:element ref="CP_SUCC_REC_COUNT" />
<xsd:element ref="CP_ERR_REC_COUNT" />
<xsd:element ref="VMS_SUCC_REC_COUNT" />
<xsd:element ref="VMS_ERR_REC_COUNT" />
<xsd:element ref="SOURCE_TYPE" />
<xsd:element ref="RUN_ID" />
<xsd:element ref="RUN_SEQ" />
<xsd:element ref="RUN_DATE" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="SRC_EXT_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="PRE_TRANS_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="POST_TRANS_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="PASS_BAPI_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="TOT_SAP_RETURN" type = "DIType-decimal-28-0"/>
<xsd:element name="TOT_SAP_SUCC_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="PARTIAL_SUCC_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="TOT_SAP_ERR_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="MM_SUCC_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="MM_ERR_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="CLS_SUCC_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="CLS_ERR_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="CP_SUCC_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="CP_ERR_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="VMS_SUCC_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="VMS_ERR_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="SOURCE_TYPE" type = "DIType-varchar-10"/>
<xsd:element name="RUN_ID" type = "DIType-decimal-28-0"/>
<xsd:element name="RUN_SEQ" type = "DIType-decimal-28-0"/>
<xsd:element name="RUN_DATE" type = "xsd:date"/>
</xsd:schema>
compare the xml vs xsd for better understanding -
How to parse xml file to read the tags
Hi All,
I am having a requirement to read the tags from the xml file(xml parsing).
The main issue is *xml file is stored in the table with xml type column* (not placed directly in the server) and we have to read the tags from that xml file.
Please help me to achieve it.
Regards,
Akshata
Edited by: Akshata on Mar 21, 2013 3:44 AMHi,
Akshata wrote:
The main issue is xml file is stored in the table clob/blob type column (not placed directly in the server) and we have to read the tags from that xml file.How is that an issue? On the contrary, it's better when the data already resides in the database, though it should be in an XMLType column to leverage the full capacity of the Oracle parser.
What's the datatype of the column exactly? CLOB or BLOB?
Either way you'll have to convert in to XMLType datatype using the XMLType constructor.
Did you go through the countless examples on this forum? Examples with XMLTable should be helpful.
Post some sample data and database version if you need additional guidance.
Thanks.
Maybe you are looking for
-
Is there a way of getting a list of your i tunes
Anyone know how to get a list of all the albums / tracks you have in your i tunes collection ? Which you can save as a document and print off etc. This would be an invaluable inventory , any way this can be done ?
-
Hi, I have a requirement where I need to display a list of employees, performance rating and manager id. I want to display the emplyees first whos manager is as manager_id as input parameter. So lets say a manager logs in, he should see his reportees
-
Strange error on stored procedure after update to version 7.6.06.10
Hi, in past version MaxDB 7.6.03 i created a stored procedure with follow SQL statement inside: TRY SELECT SUM(QTDE) QTDE_SAIDA FROM VENDOR_CONCES.MVIEW_MOVPRODUTOS mviewS WHERE mviewS.MY_EMPRESA = :OID_EMPRE
-
Connecting with Orange broadband wireless
I have been trying to connect with orange broadband to my apple mac 10.4.6 version, and found that i cannot use the speedtouch modem, and need wireless to be able to connect. I was wondering if anyone knows where i could get an adaptor suitable for m
-
Gift card won't redeem says need to be part of USA...
Hello got a gift card today when I go to redeem it. It says I have to be linked with the is itunes :( I'm uk tho and idea why? And what I can do to sort this out Many thanks