XML Messaging and JSP. Is it possible?
Here is my situation.
We are developing JSP with a backend interface to external/remote Java/C++ applications. We like to implment, if possible, XML messaging between JSP and remote programs.
First of all, is this possible? Can JAXM be used in JSP?
Thanks in advance.
Sure, but you might need to use polling for the JSP to get the response to show the user.
Similar Messages
-
How to loop through many XML messages and parse them ?
Hi All
I have been trying very hard to loop through many XML messages and process each of them. Let me first explain the problem -
Suppose I have the following String -
<xyz>
<abc>happy</abc>
</xyz>
<xyz>
<abc>new</abc>
<xyz>
<xyz>
<abc>year</abc>
</xyz>
I have to process each message within the <xyz></xyz> tag and find the falue of <abc> element (happy, new and year).
The extraction of <abc> value is very simple, I am using SAX parser's startElement() method to check every element's name and if the element's name is <abc> pick up the value. But I am not able to loop through the different messages within the <xyz></xyz> tag.
I am thinking of using another DOM parser -
DOMParser domParser = new DOMParser();
StringReader rdr = new StringReader(inputXML);
InputSource src = new InputSource(rdr);
domParser.parse(src);
Document doc = domParser.getDocument();
NodeList nodeList = doc.getElementsByTagName("xyz");
Now I can loop through this nodeList, but not able to. Is using the DOM parser and NodeList the preferable way of lopping through the messages, then how I can loop through ? Or is there any other way ?
I have been trying on this for quite a few days, but not able to. Can you please help me out ?
Thanking you in advance ....
Nirmalya SinhaHi,
Try using the SAX reader from the dom4j package. The document object that you receive contains methods for getting the root elements and with that you can traverse down to the sub elements of it.
Hope this was of some help. -
Sending an XML message and using proxy at receiver end
hi all,
please suggest me the steps to be followed in order to send a XML message and accepting this message using proxies.
please help me out with detailed procedure.
thanks+regards,
UjwalkumarHi UjwalKumar,
Follow this link:
/people/prateek.shah/blog/2005/06/14/file-to-r3-via-abap-proxy
This blog gives an excellent description of 'FILE to Proxy' scenario.
what you need is XML to proxy...i.e. your scenario is very similar to this one...only diffrence is that , you wont be using FCC .since your source msg is in XML format..
Hope this helps..
Regards ,
Sushil -
Testcase, how to split up an xml message and call a BPEL process.
Another question.
Considering the following XML message.
<?xml version="1.0" encoding="UTF-8"?>
<rows>
<row>
<id>10</id>
<naam>A</naam>
</row>
<row>
<id>20</id>
<naam>B</naam>
</row>
</rows>
An input message can consist of 1 to about 20000 <row></row> elements. I would like to split up this message into individual <row></row> and call a BPEL process for further processing.
I've tried to use the file adapters feature "Files contain Multiple Messages" Publish Messages in batches of.." This did not work. ( root element expected exceptions ).
I've also tried to invoke an extra async routing service with a mapping which removes the root element. This also doesn't work as it leaves the following ( incorrect ) xml message at the end.
<row>
<id>10</id>
<naam>A</naam>
</row>
<row>
<id>20</id>
<naam>B</naam>
</row>
Which is logical considering how an XSL transformation works.
Is there any way to achieve this?
Any help is appreciated!You shoul create a while loop, that loops through XML payload for each row. Than you can process each individual row. See also example:
C:\orabpel\samples\tutorials\112.Arrays\ArraySample.bpel -
Error in reading XML message and inserting data into another DB using DB link
Hi Experts,
I am getting error parsed XML message data while inserting into another DB table using DB link.
ORA-22804: remote operations not permitted on object tables or user-defined type columns.
Please help me.
Thanks.ORA-22804: remote operations not permitted on object tables or user-defined type columns.
Looking at the error message assuming you might be doing the alter table statement on remote table unit_labels which is throwing the ORA-22804 error which is not permitted on remote tables. -
I used this code to create an xml file through an xsl:
<%@page import="javax.xml.transform.*,javax.xml.transform.stream.*,java.io.File,java.util.Properties" %>
<%
File fXml = new File("C:\\file.xml");
File fXsl = new File("C:\\file.xsl");
File fRes = new File("C:\\res.xml");
StreamSource xml = new StreamSource(fXml);
StreamSource xsl = new StreamSource(fXsl);
StreamResult res = new StreamResult(fRes);
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(xsl);
transformer.transform(xml,res);
%>
but in the res.xml file i have:
<table> instead of <table>
what can i do to solve this problem?
thanksI'm near to solution
i use
StringWriter resultStringWriter = new StringWriter();
StreamResult res = new StreamResult(resultStringWriter);
and then
transformer.transform(xml,res);
String str = resultStringWriter.toString();
this is my xsl:
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="yes" encoding="ISO-8859-1"/>
<xsl:template match="XMLDATA">
<![CDATA[<tag1>]]><xsl:value-of select="CodiceAmministrazione"/><![CDATA[</tag1>]]>
</xsl:template>
</xsl:stylesheet>
but now the problem is the output:
\r\n<tag1>Test</tag1>\r\n
and not
<tag1>Test</tag1>
If I write the xsl on one line i have no problem
Can you help me please? -
EBP SUS NO PO RESPONSE and Invoice XML MESSAGE CREATED
Hi All,
We have configured EBP - SUS on SRM 7 server with extended classic scenario.PO's are transfering fine from EBP to SUS and are visible in SUS also expected follow on documents are PO response,Confirmation,Invoice.But wen we process the po and confirm all items no po response xml message is created and a local po response is created which is not transferred back to EBP.Later when we create a confirmation for the same po,it is transfered to EBP via serviceack xml message and is visible.
Finally wen v create a invoice it is also created locally and not tranferred to EBP,no xml message is created in this case too.
In XI we are using integration scenario which is based on SRM 5.5 contents.
Any kind of pointers will b appreciated.
Thanks.Hi
Proxies are fine,also i check for events in define transaction type.Here are the values for both response and invoice evrything seems fine.
Description SUS PO Purch.Ord.Rsp
Int. Number Range 01
Ext. Number Range 02
Status Profile
BTrans.Category BUS2232
Description SUS PO Confirmation
Partner Determ.Proc.
Text Schema PCOS
Event Schema
Description SUS Invoice
Int. Number Range 01
Ext. Number Range 02
Status Profile
BTrans.Category BUS2234
Description SUS Invoice
Partner Determ.Proc.
Text Schema SUIV
Event Schema
EVENT DEFINITION
BUS2234 SUS Invoice SUS Invoice
ERROR_OCURRED An Error has Occurred
Any settings tat we need to do to trigger this invoice to create a xml message.Also we regenerated the authorization profiles but had effect on xml creation.
Thanks -
Digitally Signing XML messages
My servlets receive XML messages and after processing and filling in some values, Digitally Sign the XMLs and send over secure connection to another server. How could possibly this be performed?
Please support your answer with code samples.
Awaiting ResponseHi,
You may need to sigm in, but try this (it's free)
http://207.68.162.250/cgi-bin/linkrd?_lang=EN&lah=7ffae4f4a6000dbf55d82280194c86c1&lat=1031873112&hm___action=http%3a%2f%2fwww%2einformit%2ecom%2fcontent%2findex%2easp%3fproduct_id%3d%7bC5920864%2d705B%2d45D3%2dBF71%2dC1E18270319A%7d%26amp%3b090102
yes, bit of a mouthful, isn't it?
best
kev
(probably a digital signature) -
Reading an XML file and write the contents to another xml file in java
Hi,
I am new to xml parsing.My requirement is that I am getting a message (xml) using ibm MQ in the ByteArrayInputStream format.I have to read this xml message and write to another file.
I am creating a POC for this.
First I used simple reading and writing concept but the output is "java.io.FileInputStream@3e25a5 "
Sample xml file
- <Client>
<ClientId>1234</ClientId>
<ClientName>STechnology</ClientName>
<DTU_ID>567</DTU_ID>
<ClientStatus>ACTIVE</ClientStatus>
- <LEAccount>
<ClientLE>678989</ClientLE>
<LEId>56743</LEId>
- <Account>
<AccountNumber>9876543678</AccountNumber>
</Account>
</LEAccount>
- <Service>
<Cindicator>Y2Y</Cindicator>
<PrefCode>980</PrefCode>
<BSCode>876</BSCode>
<MandatoryContent>MSP</MandatoryContent>
</Service>
</Client>
code:
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class ByteArrayInputStreamToXml {
public static void main(String srg[]) throws IOException{
InputStream inputStream= new FileInputStream("C:\\soft\\test2\\sample1.xml");
byte currentXMLBytes[] = inputStream.toString().getBytes();
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(currentXMLBytes);
OutputStream out = new FileOutputStream("C:\\soft\\test\\data.xml");
int read=0;
byte[] bytes = new byte[1024];
while((read = byteArrayInputStream.read(bytes))!= -1){
out.write(bytes, 0, read);
out.write( '\n' );
inputStream.close();
out.flush();
out.close();
System.out.println("New file created!");
Please suggest me how can I use DOM/SAX parser ,I can see several code on net for reading xml file using SAX/DOM parser but writing an xml file after reading it using ByteArrayInputStream I am not getting .A help through some example Link will also be helpful for me.
Thanks
Sumit
Edited by: user8687839 on Apr 30, 2012 2:37 AM
Edited by: user8687839 on Apr 30, 2012 2:43 AMThanks I got the result.
package com.sumit.collections;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class ByteArrayInputStreamToXml {
public static void main(String srg[]) throws IOException{
InputStream inputStream= new FileInputStream("C:\\soft\\test2\\sample1.xml");
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int nRead; byte[] data = new byte[1024];
while ((nRead = inputStream.read(data, 0, data.length)) != -1) {
buffer.write(data, 0, nRead); } buffer.flush();
byte currentXMLBytes[]= buffer.toByteArray();
/* byte currentXMLBytes[] = inputStream.toString().getBytes();*/
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(currentXMLBytes);
OutputStream out = new FileOutputStream("C:\\soft\\test\\data.xml");
int read=0;
byte[] bytes = new byte[1024];
while((read = byteArrayInputStream.read(bytes))!= -1){
out.write(bytes, 0, read);
out.write( '\n' );
inputStream.close();
out.flush();
out.close();
System.out.println("New file created!");
} -
How to trigger XML messages for FWO
Hello Experts,
I’d like to trigger a XML outbound message after creation of an air forwarding order (FWO) in my TM system. It could not be a confirmation. I need this XML to provide the results of charges calculation in a legacy system (B2B communication).
Could someone help me in this?
Regards,
Alberto.Dear Alberto,
You can follow below steps to achive the same.
1 You have to setup PPF framework.
A. You will be having output profile (which is for processing the actions in background) assigned to Air FWO document type.
B.Go to PPF customizing (Tcode - SPPFCADM) -> Select the Action profile -> Create Action definition ->choose the processing time as 'Processing when saving the document'-> processing type as 'Method call' -> Create the BADI implementation for definition EXEC_METHODCALL_PPF''. Here you can check if any filter before you trigger XML Message.
2.You have to create a custom Proxy and proxy class to generate the XML message and send to target system.
You will call this proxy class in BADI implementation EXEC_METHODCALL_PPF and build the XML message with required Charges data.
After all the setup is done, you can test and make sure you have XML message generated in SXI_MONITOR / SXMB_MONI t-code.
Let me know any challenges while doing it.
Thanks,
Bharath. -
XML Unnesting and In Memory issue
I have a source table in oracle that contains a column (Nclob) that have XML messages and my target is BW data souce
I build my job like that
Source Table------Quey1 (to convert to varchar)-------------Query2(Unnest XML using extract_xml)-----------------BW Target
I successfully running the job with small test data in source (About 100,000 records) takes about 30 minutes
But when I running with the actual table contains about 140000000 it takes so long time my be more than 12 hours and never ending and it is affect the job server so I decide to kill the job
I checked the log I found that the job running in im memory mode instead of peagable because it is nested schema
I need help to enhance this job and let running successfullyDo you mean that I need to remove Query transform that do extract_xml from the column and instead of it use XML_Pipeline?
I tried but I found XML_pipeline only accept files not database -
Table where XML Messages are stored..?
Dear SDNers,
I am trying to built an custom error monitor. I require access to the XML payload and parse it to retrieve data from it.
I need to know where the input XML messages and the XML with Error informations are stored in the database table.
I believe this informations would be stored in a raw format and an class/method will parse this raw data to XML content.
I require your help to find out the DB Table and the methods to parse the raw data to XML.
Thanks
~SaNv...Hi Guys,
Thanks for your help.
With the below code I was able to read the Maindocument of Inbound payload. I would also require to read the Error payload in the Soap header.
CALL METHOD persist->read_msg_all
EXPORTING
im_msgguid = p_mesg
im_pid = pid
im_version = vers
IMPORTING
ex_message = xms_msg.
xms_msg->deleteheaderbyname(
nsuri = if_xms_run_time_env=>co_nsuri
lcname = if_xms_run_time_env=>co_lcname ).
xmb_msg ?= xms_msg.
CALL METHOD xmb_msg->if_xms_message_xmb~get_main_payloads
RECEIVING
return = payload.
READ TABLE payload INTO wa_payload INDEX 1.
CALL METHOD wa_payload-mainpayload->getbinarycontent
RECEIVING
return = content.
Now i need to find a method to read the erro document.
Instead of CALL METHOD xmb_msg->if_xms_message_xmb~get_main_payloads I need to use a different method, but not to find it myself.
Pls share ur thoughts on this.
~SaNv... -
Please help me in inserting data into table from XML message.
Hi Experts,
Please provide a procedure to implement my below requirement.
Since I am new to queue concept.
[code]- <MESSAGES>
- <MESSAGE ID="3026900">
<MSG_ID>3026900</MSG_ID>
<DT_POSTED>6/20/2013 08:15:48</DT_POSTED>
<POSTED_BY>GPD_MSG_EXTRACTOR</POSTED_BY>
<DT_LAST_QUEUED />
- <MSG>
- <WORK_SET TRANSACTION_ID="@TRANS_ID" TRANSACTION_TYPE="Batch" IS_ACID="@IS_ACID">
- <WORK_UNIT GROUP="LEAD_TIME" ACTION="UPDATE" AFFECTED="LEAD_TIME">
- <RECORDSET TABLE_NAME="LEAD_TIME">
- <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
- <rs:data>
<z:row business_unit_id="3838" geo="AT" sku="A0814818" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
<z:row business_unit_id="202" geo="GB" sku="A0814819" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
<z:row business_unit_id="2828" geo="BE" sku="A0814820" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
</rs:data>
</xml>
</RECORDSET>
</WORK_UNIT>
- <WORK_UNIT GROUP="LEAD_TIME" ACTION="ADD" AFFECTED="LEAD_TIME">
- <RECORDSET TABLE_NAME="LEAD_TIME">
- <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
- <rs:data>
<z:row business_unit_id="202" geo="GB" sku="A0814821" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
<z:row business_unit_id="2828" geo="BE" sku="A0814822" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
</rs:data>
</xml>
</RECORDSET>
</WORK_UNIT>
- <WORK_UNIT GROUP="LEAD_TIME" ACTION="DELETE" AFFECTED="LEAD_TIME">
- <RECORDSET TABLE_NAME="LEAD_TIME">
- <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
- <rs:data>
<z:row business_unit_id="202" geo="GB" sku="A0814817" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
<z:row business_unit_id="2828" geo="BE" sku="A0814816" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
</rs:data>
</xml>
</RECORDSET>
</WORK_UNIT>
</WORK_SET>
</MSG>
</MESSAGE>
</MESSAGES>[/code]
The above XML message is receieved by our oracle queue.Once the message is receieved to our queue.
We have to process the message according to the action(UPDATE ADD DELETE).
From this message we have to process only 3 fields (geo sku lead_time).
These three feilds data should be processed into the SKU_LEAD_TIME table based on the action.
Req1:
IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
based on the below condition.
[code]UPDATE LEAD_TIME_TABLE SET lead_time= lead time from xml message
WHERE LEAD_TIME_TABLE.SKU=sku from xml message AND LEAD_TIME_TABLE.GEO=geo from xml message;[/code]
Req2:
IF the action is delete then the records should be deleted from the "LEAD_TIME_TABLE" table.
based on the below condition.
[code]DELETE FROM LEAD_TIME_TABLE
WHERE LEAD_TIME_TABLE.SKU=sku from xml message AND LEAD_TIME_TABLE.GEO=geo from xml message;[/code]
Req3:
IF the action is add then the records should be inserted in the "LEAD_TIME_TABLE" and "LEAD_TIME_TABLE_STAGING" table
based on the below conditions.
Req3.1:
If SKU from XML message is available in "SKU_TABLE" table
then the three parameter(GEO SKU LEAD_TIME) values from XML message should be inserted into "LEAD_TIME_TABLE" table.
Req3.2:
If SKU from XML message is not available in "SKU_TABLE" table
then the three parameter(GEO SKU LEAD_TIME) values from XML message should be inserted into "LEAD_TIME_TABLE_STAGING" table.
Req3.3:
Once the new SKU is avilable in "SKU_TABLE" table then the corresponding SKU record should be
inserted into "LEAD_TIME_TABLE" table and that record should be deleted from "LEAD_TIME_TABLE_STAGING" table.
I am posting required scripts and test cases.
[code]CREATE TABLE LEAD_TIME_TABLE(sku VARCHAR2(20),model VARCHAR2(20),class CHAR(1),geo VARCHAR2(6),lead_time NUMBER,created DATE);
CREATE TABLE LEAD_TIME_TABLE_STAGING(sku VARCHAR2(20),geo VARCHAR2(6),lead_time NUMBER);
CREATE TABLE SKU_TABLE(sku VARCHAR2(20),geo VARCHAR2(6),lead_time NUMBER);
INSERT INTO SKU_TABLE VALUES('A0814817','GB',30);
INSERT INTO SKU_TABLE VALUES('A0814818','AT',30);
INSERT INTO SKU_TABLE VALUES('A0814819','GB',30);
INSERT INTO SKU_TABLE VALUES('A0814820','BE',30);
INSERT INTO SKU_TABLE VALUES('A0814821','GB',30);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814817','GB',30);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814818','AT',20);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814819','GB',20);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814820','BE',20);
INSERT INTO LEAD_TIME_TABLE_STAGING VALUES('A0814822','BE',30);[/code]
From the above message.
Test case for req3.1:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814821" is available in SKU_TABLE table.
so the record should be inserted in the LEAD_TIME_TABLE.
[code]SELECT * FROM LEAD_TIME_TABLE;
SKU GEO LEAD_TIME
A0814817 GB 30
A0814818 AT 20
A0814819 GB 20
A0814820 BE 20
A0814821 GB 30[/code]
Test case for req3.2:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814822" is not available in SKU_TABLE table.
so the record should be inserted in the LEAD_TIME_TABLE_STAGING.
[code]SELECT * FROM LEAD_TIME_TABLE_STAGING;
SKU GEO LEAD_TIME
A0814822 BE 30[/code]
Test case for req3.3:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814822" is not available in SKU_TABLE table.
Once I insert SKU number "A0814822" in SKU_TABLE table.
The corresponding records automatically should be inserted in the LEAD_TIME_TABLE
and should be deleted from LEAD_TIME_TABLE_STAGING.
[code]SELECT * FROM LEAD_TIME_TABLE_STAGING; --- should return NULL.
SELECT * FROM LEAD_TIME_TABLE;
SKU GEO LEAD_TIME
A0814817 GB 30
A0814818 AT 20
A0814819 GB 20
A0814820 BE 20
A0814821 GB 30
A0814822 BE 30[/code]
Please help me.
Thanks in advance.Hi,
I have resolved this issue.
But I have stuck up in implementing some of the scenarios.
Req1:
IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
based on the below condition.
UPDATE LEAD_TIME_TABLE SET lead_time= lead time from xml message
WHERE LEAD_TIME_TABLE.SKU=sku from xml message AND LEAD_TIME_TABLE.GEO=geo from xml message;
Req3:
IF the action is add then the records should be inserted in the "LEAD_TIME_TABLE" and "LEAD_TIME_TABLE_STAGING" table
based on the below conditions.
Req3.1:
If SKU from XML message is available in "schema_name.SKU_TABLE" table.
The schema_name.SKU_TABLE table should be selected based on "business_unit_id" of XML message and "sid" of MAPPING table WHERE business_unit_id=sid.
then the three parameter(GEO SKU LEAD_TIME) values from XML message and two fields MODEL,CLASS from SKU_TABLE
should be inserted into "LEAD_TIME_TABLE" table.
Req3.2:
If SKU from XML message is not available in "schema_name.SKU_TABLE" table
The schema_name.SKU_TABLE table should be selected based on "business_unit_id" of XML message and "sid" of MAPPING table WHERE business_unit_id=sid.
then the four parameter(BUSINESS_UNIT_ID GEO SKU LEAD_TIME) values from XML message
should be inserted into "LEAD_TIME_TABLE_STAGING" table.
Req3.3:
Once the new SKU is avilable in "schema_name.SKU_TABLE" table then the corresponding SKU record should be
inserted into "LEAD_TIME_TABLE" table and that record should be deleted from "LEAD_TIME_TABLE_STAGING" table.
The schema_name.SKU_TABLE table should be selected based on "business_unit_id" of LEAD_TIME_TABLE_STAGING and "sid" of MAPPING table WHERE business_unit_id=sid.
I am posting required scripts and test cases.
[code]CREATE TABLE LEAD_TIME_TABLE(sku VARCHAR2(20),model VARCHAR2(20),class CHAR(1),geo VARCHAR2(6),lead_time NUMBER,created DATE);
CREATE TABLE LEAD_TIME_TABLE_STAGING(business_unit_id NUMBER,sku VARCHAR2(20),geo VARCHAR2(6),lead_time NUMBER);
CREATE TABLE SKU_TABLE(sku VARCHAR2(20),model VARCHAR2(20),class VARCHAR2(10));
CREATE TABLE mapping(sid NUMBER,schema_name VARCHAR2(20));
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814817','GB',30);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814818','AT',20);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814819','GB',20);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814820','BE',20);
INSERT INTO SKU_TABLE VALUES('A0814817','M125','C111');
INSERT INTO SKU_TABLE VALUES('A0814818','M127','A111');
INSERT INTO SKU_TABLE VALUES('A0814819','M126','A111');
INSERT INTO SKU_TABLE VALUES('A0814820','N100','B111');
INSERT INTO SKU_TABLE VALUES('A0814821','P123','B111');
INSERT INTO mapping VALUES(202,'WEDB');
INSERT INTO mapping VALUES(2828,'HR');
INSERT INTO mapping VALUES(3838,'BB');
[/code]
Test case for req3.1:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814821" is available in schema_name.SKU_TABLE table.
so the record should be inserted in the LEAD_TIME_TABLE.
[code]SELECT * FROM LEAD_TIME_TABLE;
SKU MODEL CLASS GEO LEAD_TIME
A0814817 M125 C111 GB 30
A0814818 M127 A111 AT 20
A0814819 M126 A111 GB 20
A0814820 N100 B111 BE 20
A0814821 P123 B111 GB 30
[/code]
Test case for req3.2:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814822" is not available in SKU_TABLE table.
so the record should be inserted in the LEAD_TIME_TABLE_STAGING.
[code]SELECT * FROM LEAD_TIME_TABLE_STAGING;
BUSINESS_UNIT_ID SKU GEO LEAD_TIME
2828 A0814822 BE 30[/code]
Test case3.3.3:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814822" is not available in SKU_TABLE table.
Once I insert SKU number "A0814822" in SKU_TABLE table.
The corresponding records automatically should be inserted in the LEAD_TIME_TABLE
and should be deleted from LEAD_TIME_TABLE_STAGING.
[code]INSERT INTO SKU_TABLE VALUES('A0814822','P123','B111');
SELECT * FROM LEAD_TIME_TABLE_STAGING; --- should return NULL.
SELECT * FROM LEAD_TIME_TABLE;
SKU MODEL CLASS GEO LEAD_TIME
A0814817 M125 C111 GB 30
A0814818 M127 A111 AT 20
A0814819 M126 A111 GB 20
A0814820 N100 B111 BE 20
A0814821 P123 B111 GB 30
A0814822 P123 B111 GB 30[/code]
I am able to implement Req1 and Req3.1 for action UPDATE and INSERT in single merge statement.
However my code is not taking care of all my requirements.
Please find my below code.
[code] CREATE OR REPLACE PACKAGE BODY messg_values_process
AS
procedure ProcessInboundLtimeMessage(p_xml_message XmlType)
is
begin
for work_unit in (
select message.MESSAGE_ID
, work_unit.ACTION
, work_unit.LEADTIME_NODES
from XmlTable(
'/MESSAGES/MESSAGE'
passing p_xml_message
columns
MESSAGE_NO for ordinality
, MESSAGE_ID number path '@ID'
, WORK_UNIT_NODES XmlType path 'MSG/WORK_SET/WORK_UNIT'
) message
, XmlTable(
XmlNamespaces(
'urn:schemas-microsoft-com:rowset' as "rs"
, '#RowsetSchema' as "z"
'/WORK_UNIT'
passing message.WORK_UNIT_NODES
columns
WORK_UNIT_NO for ordinality
, ACTION varchar2(10 char) path '@ACTION'
, LEADTIME_NODES XmlType path 'RECORDSET[@TABLE_NAME="LEAD_TIME"]/xml/rs:data/z:row'
) work_unit
LOOP
CASE work_unit.ACTION
WHEN 'ADD' THEN MergeData(work_unit.LEADTIME_NODES);
WHEN 'UPDATE' THEN MergeData(work_unit.LEADTIME_NODES);
WHEN 'DELETE' THEN RemoveData(work_unit.LEADTIME_NODES);
ELSE null;
END CASE;
END LOOP;
END ProcessInboundLtimeMessage;
procedure MergeData(p_leadtime_nodes XmlType)
is
begin
if (p_leadtime_nodes is not null) then
merge into LEAD_TIME_TABLE old
using(
select *
from XmlTable(
XmlNamespaces(
'urn:schemas-microsoft-com:rowset' as "rs"
, '#RowsetSchema' as "z"
'/z:row[not(@business_unit_id=following-sibling::z:row/@business_unit_id)]'
passing p_leadtime_nodes
columns
ITEM_NO for ordinality
, BUSINESS_UNIT_ID number path '@business_unit_id'
, GEO varchar2(20 char) path '@geo'
, SKU varchar2(20 char) path '@sku'
, LEAD_TIME number path '@lead_time'
) NEW
ON (old.VK_UNIT = new.SKU
AND old.GEO=new.GEO)
when matched then update
set old.LEAD_TIME = new.LEAD_TIME
when not matched then INSERT
( old.VK_UNIT
, old.MODEL
, old.CLASS
, old.GEO
, old.LEAD_TIME
, old.COUNTDOWN
, old.LAST_UPDATED_DATE
values
( new.SKU
,'A123'
,'A1234'
, new.GEO
, new.LEAD_TIME
, 'N'
, sysdate
end if;
exception
when others then
LogDataError(
'MergeData Procedure Failed #: '||chr(10)||sqlerrm
, null
, null
END MergeData;
END messg_values_process;
/[/code]
Please help me.
Thanks. -
Dynamic xml messages in alerts
Hi,
I have a ccBPM where I throw an alert on an application exception.
I want to include the entire xml message in the alert and email it to assigned users. I tried doing a document-to-string conversion of the xml message and putting the string in alert message as &messagestring& but the value gets stripped after first 80 characters or so.
Does anyone have experience in having dynamic xml messages in alerts? Is there any other way of doing it?Any insights are appreciated.
Thanks and Regards,
Suresh.The way we did is, before raising the alert we sent the whole message in an email (mail adapter) to the group email id.
Sudhir /Michal can answer this best.
regards
SKM -
XML message for material master records
Hello experts
We want to implement an interface with material master records to be sent to our customers. This interface is proposed to be in XML. Can you please provide me with links or documents that explain how to integrate XML within SAP regarding master data maintenance.
I need to know how we can trigger the XML message and where to include the logic of the attributes to be sent.
Thank you in advance,
AlejandraHi
You can do this scenario in BSP , better sit with ABAP and Portal(BSP) Consultant .
they can give much more idea about this. Using BSP you can evaluate this requirement.
Best regards
Ram
Maybe you are looking for
-
Unfair blocking of my Skype Account
Yesterday morning I received a fair usage policy violation warning from Skype. Firstly there is no explanation of why was there a policy violation. My usage of skype has been the same across the last 3 years. I have an unlimited subscription for ca
-
Iphone 4s wont power on, im just getting a blank screen with battery charging on front screen
iphone 4s wont power on, im just getting a blank screen with battery charging on front screen>>>>becouse it is after damage water
-
Exchanging data between interface mapping and message mapping possible?
Hi, please have a look at my interface mapping: source message - > mapping programs 1. Java mapping 2. XSL mapping 3. message mapping > target message in my scenario a Java Class (1) is called for the interface mapping. There, some information ist re
-
Loading hierarchies for 0GL_ACCOUNT InfoObject
Hi, I cannot load hierarchies into 0GL_ACCOUNT InfoObject. I have created InfoPackage and in Update Data options I can only choose 'Only PSA' option. I have loaded attributes and texts without any problems. What should I do? Regards, Maciek
-
Can one automatically remove exact duplicates?
Using Itunes 10.2.2.12 on Windows XP I have inadvertantly somewhere dupkicated most of the music in my library Over 7k items appear in the "displaying duplicates" Is there a way to get rid of them quickl;y without selecting each item individually?