on 08-16-2006 1:30 PM
Hi All,
I need to do a File-JDBC scenario. Based on a particular field (say "Status") I have to perform an insert or an update.
Now multiple records are coming in through file. Now I will have to look in to the status field for every record and decide it is an update or insert.
How can I achieve this?
Thanks & Regards,
Jai Shankar.
hi,
why don't you use action: <b>UPDATE_INSERT</b>
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
it will either update or (if not update possible)
insert the data
do you think this could be suitable for your scenario?
Regards,
michal
-
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Michal,
Thanks. I have gone through the link it clearly states "The response document has the following format; one of the two values is always 0 because either an UPDATE or an INSERT action is always executed".
In my case I need updates for some records and inserts for some records. That is the problem.
Thanks & Regards,
Jai Shankar.
Hi Jai,
You can try this out:
In ur message mapping perform a 1:2 mapping.
Put a check for the status field. If it says update the map ur record to the update XML Format else map it to the Insert XML format.
Remember the input XML will be 1:n and the two output XMLs will be 0:n.
Hopefully this will help.
Regards
Neetu
Hi,
>>>In my case I need updates for some records and inserts for some records. That is the problem.
who said you have to do it like this?
as far as I remember you can adjust your jdbc structure
to put all calls in one xml
and you'll just have many responses all with:
"one of the two values is always 0 because either an UPDATE or an INSERT action is always executed"
but you need to check it
Regards,
michal
Hi All,
<?xml version="1.0" encoding="UTF-8"?>
<ns:MT_TARGET xmlns:ns="urn:http:jdbc">
<STATMENTNAME>
<TEST action="UPDATE_INSERT">
<TABLE>Employee</TABLE>
<access>
<Emp_Id />
<Emp_Name />
<Comments />
</access>
<key>
<Emp_Id></Emp_Id>
</key>
</TEST>
</STATMENTNAME>
</ns:MT_TARGET>
Here can I use multiple <STATMENTNAME> tags?
Thanks & Regards,
Jai Shankar.
<i>Here can I use multiple <STATMENTNAME> tags?
</i>
Yes.. Every TAG on the level of a STATEMENT tag is equivalent to a separate SQL statement / query. So , yopu can have multiple Statement Tags and also off different Names with different Structure so that simulataneosuly, different actions can happen.
Regards,
Bhavesh
Hi Jai,
Why do you wnt to use multiple Statement tags??
Your data is actually getting picked up from a file.
You can have multiple records in the file.
These records will get processed by the server one by one. U dont need to worry about that.
Only, as mentioned in my previous answer use 1:2 mapping.
Keep the cardinality of records in the Input XML as 1:unbounded and the ouput XMLs as 0:Unbounded.
And things will work.
Regards
Neetu
Hi Neetu,
Can you explain the 1:2 mapping with ref to my scenario.
My sample i/p file
1000,jai,XI,INSERT
1001,jai,karthik,UPDATE
1002,prabhu,XI,UPDATE
My o/p table will contain 3 fields Emp_Id,Emp_Name,Status.
Also it will contain some invalid entry for 1001,1002 emp_id.
Thanks & Regards,
Jai Shankar.
Hi Jai,
to do it easy:
Just select one record after another via JDBC!!!
select * from myTable where myKey= (select min(myKey) from myTable where "condition" = 0815.
This should help!!!
Regards Mario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If one record in your file is a single update or insert then you have to use a BPM and do N:1 mapping.
Then you have to put a swtich which will were you check it's a insert or update and then call the required adapter.
The other option is without BPM. In your mapping do i:N mapping (multi mapping) and then split the data for the INSERT and UPDATE into seperate messages and then call the respectiv JDBC adapter.
Read on multi mapping from here:
http://help.sap.com/saphelp_nw04/helpdata/en/21/6faf35c2d74295a3cb97f6f3ccf43c/content.htm
Regards
Vijaya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.