IDOC to JDBC - Multiple Inserts
Hi ,
I have an idoc to JDBC scenario.
Here is idoc structure.
E1MASTL 1...1
|--> E1STOKL 0....9999
|--->E1STOPL 0....9999
my table struture expects data from 2 segments in the E1MASTL and 4 segments from E1STOKL and 3 segments from E1STOPL.
when i trigger the idoc which has 5 line items in E1STOPL and 5 line items in E1STOKL but only one from E1MASTL.
Now, when this idoc is triggered, the table is updated with all the first line items from each segment, instead i want all the 10 lines to be updated in the table.
I have tried mapping the Statemetn and access tags to the all the possible nodes on the Idoc side but could not succed in inserting multiple lines in the table though i had multiple line items in the idoc.
Please help me how do i do it.
Thanks in advance.
Regards,
Kalpana.
Edited by: Kalpana Timmapuram on Nov 27, 2009 9:58 PM
Now, when this idoc is triggered, the table is updated with all the first line items from each segment, instead i want all the
10 lines to be updated in the table.
The Statement node should be repeating.....now only first instance is getting mapped because the Context is not handled properly.
If you test the mapping in Message Mapping/ Interface Mapping Test tab then too the same thing will happen...only first line item is considered.
You either need to raise the Context of the respective Source nodes to a higher node (right-click on the source node in mapping editor--> Context --> raise it to higher node)
OR
You need to make use of the standfard functions Collapse Context & Remove Context in the mapping logic.
Regards,
Abhishek.
Similar Messages
-
IDOC to JDBC scenario: Does INSERT command expect a result value?
Hello,
we have an IDoc-to-JDBC-scenario configured on our XI 3.0, which uses the INSERT command to put a dataset coming from R/3 into a SQL database. This works fine.
Now a trigger has been activated on the database, which sets a flag to each dataset after inserting.
Because of this a system error occurs in the Adapter Engine and I found in the AuditLog (logSQLStatement=true), that the INSERT command is processed correcty, but in the next step an error is shown up: 'SQLServerException. A result set was generated for update.'
Could it be, that the trigger returns a result value, which can't be handled on the XI ?
If yes, how can I solve this issue? I have read something about the different methods execute(), executeUpdate() and executeQuery(), but I don't know how and where this has to be configured...
Thanks in advance,
JuergenHi Upendra,
I got some more information from the database adminstrator:
He used the following command 'exec xp_cmdshell @ExportCmd , no_output'
whereas @ExportCmd contains the command.
With the no_output option, the xp_cmdshell does not return a recordset.
I hope this will be helpful to you.
Grtz,
Juergen -
IDOC to JDBC receiver adapter: SQLServerException after INSERT
Hello,
we are using SAP XI 3.0 and I have to set up an asynchronous IDOC to JDBC scenario.
Informations coming via IDOC have to be inserted into an MS SQL database. The ID for each dataset will be set automatically when inserting, so there is no update. I have used the following structure:
When sending an IDOC, the data will be inserted into the database, but in the Runtime Workbench the following Exception occurs:
' SQLServerException. A result set was generated for update. '
It seems to me, that the result information of the database can't be handled in the JDBC adapter.
Anybody an idea if this is a issue on the XI or maybe of the database itself?
Thanks in advance.
Jürgen
Edited by: Juergen Grallert on May 11, 2009 11:17 AMhi,
try setting logSQLStatement as described in OSS note 801367
to see what get executed in the statement and you will know
what to change in XI then - this is the proper way to debug jdbc issues
Regards,
Michal Krawczyk -
IDOC to JDBC scenario in case of Cost Element Group IDOC.
This is an IDOC to JDBC scenario.
The Cost Element Group IDOC is having different segments. The main segment E1COGH (1...unbound) is consisting of different subsegment like E1OGS (0...unbound) & E1COGV (0...unbound). The main segment (E1COGH) along with subsegments E1OGS & E1COGV) is occuring more that 1 times. I have to insert data into the table, which we can do in single rows (no hierarchy is possible in tables). I have used "use one as many" in message mapping. Now if E1OGS or E1COGV is repeating in a single E1COGH segment then we dont get any error. But if I duplicate the main segment then I am getting runtime exception.
Please suggest about how to map in this case.In my scenario:
E1COGH
|
-> E1COGS
E1COGV
where E1CGH -> Main segment
E1COGS & E1COGV -> sub segment
E1COGH -> 1..unbound
E1COGS -> 1..unbound
E1COGV -> 1..unbound
At the target side I have created two Statement Structure (ie.Statement & Statement_1) . One for E1COGS (ie. Statement) & the other for E1COGV (ie. Statement_1).
Case 1 -> If E1COGS is present in the main segment E1COGH then it is mapped AS IS.
Case 2 -> If E1COGS is not present in the main segment E1COGH then it is mapped as blank.
This will be mapped with Statement & in the absence of E1COGS this Statement structure is SUPPRESSED.
Similarly,
Case 1 -> If E1COGV is present in the main segment E1COGH then it is mapped AS IS.
Case 2 -> If E1COGV is not present in the main segment E1COGH then it is mapped as blank.
This will be mapped with Statement_1 & in the absence of E1COGV this Statement_1 structure is SUPPRESSED.
All the elements of the segment E1COGH, E1COGHT & E1COGHR are replicated in all the rows for X (no. of occurance of E1COGS) + Y (no. of occurance of E1COGV).
While testing in Message Mapping, I am able to get the output as for multiple occurence of E1COGS & E1COGV in a single E1COGH.
But if I increse the occurence of E1COGH the it is giving the following error :
Runtime exception during processing target field mapping /ns0:MT_Cost_Element_Group_Response/Statement/DBtablename/access/GROUPNAME. The message is: Exception:[com.sap.aii.mappingtool.tf3.IllegalInstanceException: Too few values in first queue in function useOneAsMany. It must have the same number of contexts as second queue.] in class com.sap.aii.mappingtool.flib3.NodeFunctions method useOneAsMany[com.sap.aii.mappingtool.flib3.CollapseContexts@51197231, , ]
Please suggest how to map the occurence of E1COGH simultaneously with the occurence of E1COGS & E1COGV. -
IDOC to JDBC - mapping test versus actual run
Hi
When I test the message mapping for the idoc-to-jdbc sender scneario, where one sales order idoc has multiple line items in segment E1EDP01, the statement => access structures repeat properly for 2 line items. Here I am giving the idoc xml file (data file) in the payload in the test tab of message mapping)
However in the communication channel log (with sql statement log = true), when I try to process an actual idoc from ECC, in the sql log of the processed message, I can see an insert statement only for the first line item of the sales order.
Please can somebody guide me as to what must be the problem?
Statement occ is 1.
tablename occ is 1.
Access structure occ is 0...unbounded.
The segment E1EDP01 is currently mapped to acess node.
The sales order number is repeated over the 2 line items using below mapping -:
E1EDP01 (with context as root) => "useasmany" => split by value => Item no.
Please advise.Hello Gary,
Make the statement 0..unbounded or 1..unbounded then make the access 0..1. One statement is needed per action
http://help.sap.com/saphelp_nwpi711/helpdata/en/44/7c24a75cf83672e10000000a114a6b/frameset.htm
If the statements are so complex, you can also opt to use SQL_QUERY instead.
http://help.sap.com/saphelp_nwpi711/helpdata/en/44/7c24a75cf83672e10000000a114a6b/frameset.htm
Hope this helps,
Mark -
PI : Idoc to JDBC scenario : repeating segments mapping issue
Experts
Please help.
Question reg. mapping for ECC idoc to JDBC scenario.
I am using the ORDRSP idoc which has multiple segments as below.
IDOC -> multiple E1EDK14 segments with 2 fields (QUALF and ORGID)
Depending on the value of the QUALF field i need to populate the column in my target structure.
QUALF 001 => Colmn a
QUALF 002 => Colmn b
For now my graphical mapping is very simple - QUALF => column a (done just to find out how PI mapping works)
What happens in my case, is the PI Payload shows all the E1EDK14 segments however only the value 006 present in the first occurence goes into the target column.
How do I repeat a mapping between QUALF and target col. for multiple occurences of the same segment?
Please can you guide me reg. use of context, loop over segment, UDF = which will be the best solution to achieve this?Hi
My mapping is as below. I will take an example of a sales order that has 2 line items 00010, 00020. The payload is as follows
I see this payload in the SXMB_MONI transaction => Receiver grouping => Payloads
- <ZORDRES>
- <IDOC BEGIN="1">
+ <EDI_DC40 SEGMENT="1">
+ <E1EDK01 SEGMENT="1">
+ <E1EDK14 SEGMENT="1">
<QUALF>006</QUALF>
<ORGID>01</ORGID>
</E1EDK14>
+ <E1EDK14 SEGMENT="1">
<QUALF>007</QUALF>
<ORGID>01</ORGID>
</E1EDK14>+ <E1EDK03 SEGMENT="1">
+ <E1EDK03 SEGMENT="1">
+ <E1EDK03 SEGMENT="1">
+ <E1EDK03 SEGMENT="1">
+ <E1EDKA1 SEGMENT="1">
+ <E1EDKA1 SEGMENT="1">
+ <E1EDKA1 SEGMENT="1">
+ <E1EDKA1 SEGMENT="1">
+ <E1EDKA1 SEGMENT="1">
+ <E1EDK02 SEGMENT="1">
+ <E1EDK02 SEGMENT="1">
+ <E1EDK17 SEGMENT="1">
+ <E1EDK18 SEGMENT="1">
+ <E1EDK18 SEGMENT="1">
+ <E1EDP01 SEGMENT="1">
<POSEX>000010</POSEX>
+ <E1EDP01 SEGMENT="1">
<POSEX>000020</POSEX>
</E1EDP01>+ <E1EDS01 SEGMENT="1">
<SUMID>001</SUMID>
<SUMME>2</SUMME>
</E1EDS01>
+ <E1EDS01 SEGMENT="1">
<SUMID>002</SUMID>
<SUMME>1100.00</SUMME>
<SUNIT>GBP</SUNIT>
</E1EDS01>
</IDOC>
</ZORDRES>
There are 2 problems. First one which I discovered after posting the query. I can see only the line item 10 in the query that gets contructed in PI to insert the data into the target jdbc table. Please see jdbc receiver communication channel log below
If you see above there are 2 E1EDP01 segments for line 00010, 00020.
INSERT INTO tblOItem (IDocDate, IDocTime, SalesOrderNo, ItemNo, Plant, ItemCategory, UnitSellPrice, QuantityOrdered, QuantityAllocated, ScheduledDeliveryDate) VALUES (20111206, 135530, 0015002085, 000010, 0086, ZTAN, 0.00, 1.000, 1.000, 20111201)
My source and target mappings are as below.
ZSALORD
IDOC
BEGIN
E1EDK01
E1EDP01
POSEX =============> SalOrdItm table column itemno
My target side structure (idoc to jdbc scenario is as follows)
I have mapped the E1EDP01 to Statement - I thought this will build one query per line item (per occurence of E1EDP01) but this is not working.
MT_OITEM
Statement
dbtablename ============> SalOrdItm
action =================> Insert
table
access
Itemno (this is one of the columns from the table)
The occurence of E1EDP01 is 0..9999999 while the occurence of Statement node is 1...unbounded.
Please is there any email address where I can send you screen shots if the above is not clear.
I need to get this interface delivered as soon as possible but am STUCK.
Edited by: gary jojo on Dec 6, 2011 3:06 PM -
Stored procedure design(IDoc to JDBC)
I need design inputs from you people,
My requirement as follows, we are creating orders(IDoc) in SAP and want to insert data in to Data base table, one IDoc data to be inserted in to multiple tables(min 4).I developed interfaces it is working fine, sometimes we expect 50k orders from SAP per day,i.e 50K IDocu2019s , it min 2lac insert operations performing on data base ,so planning to change my design.
How can I reduce number of insert statements to process 50k IDocu2019s per day.
Using stored procedure one option but stored procedure structure bit different. Like if I want to insert data 10 times in to data base table, then I written logic to repeat access tag multiples times.
But how can I do it stored procedure.
Any pointers?You can seek help from JDBC guys to create a Stored Procedure which accept the structure once and distribute it to 4 tables. So you need to push data only once.
Like if I want to insert data 10 times in to data base table, then I written logic to repeat access tag multiples times.
This part can also be handled in SP.
Regards
Raj -
IDOC TO JDBC , mappinng source segment to target segment
Hi Experts,
I need your guidance on the following scenario
IDOC to JDBC (DB2)
Source side has one header and multiple line items to be map to DB2 tables (one for header and one for line item)
I have searched through web and forum for some step by step guide on this but to no avail.
I have followed the guide from help.sap
but problem is when I send one header and four line items , header is inserted to the header table but only first line item is inserted into the line item table. I have defined Statement 1 for the header while Statement 2 for the line item
There are a few things that i am in doubt.
1. Do i need to change the access to 1 to unbounded fir tge statement2 for the line item table. I did changed access to unbounded but still inserted one first line item
2. If one of the field in the header is required to map to the line item structure, since header is 1 to 1 and lines come in multiple times, do i need to user onetomany function ?
3. The complicated part is within the source line item, there is multinested segment with (1 to 9999 occurence). I have changed the context to the top node of the source line item, but problem persist.
Does anyone has experience in such mapping that can share or having similar scenario with one header and multiple line items to JDBC DB table ?
Regards
FNGHi Freddy,
1) You can create such a structure for JDBC receiver:
<StatementName>
<dbTableName1 action=u201DINSERTu201D>
<table>realDbTableName</table>
<access> 0...1
</access>
</dbTableName1>
<dbTableName2 action=u201DINSERTu201D>
<table>realDbTableName</table>
<access> 0...unbounded
</access>
</dbTableName>
</StatementName>
Since we are using single Statement whole payload will be treated as single message. If any record faces problem while insertion, whole message will be rolled back.
2. You can set logSqlStatement - true in Receiver Adapter. Then you can check the SQL query in adapter log. You can check this query for any error. -
IDOC to JDBC:System Acknowledgment
Hi,
We have a scenario IDOC-PI-JDBC. We are using PI7.31 single stack.
We need to get the System acknowledgement, and we want to update the status of the IDOC accordingly(error/successful) once its processed.
-Is it possible in IDOC to JDBC flow?
-As per my understanding in IDoc sender channel we should check the acknowledgement option. Other than this do we need to do any other setting to get the system acknowledgement?
-Does JDBC receiver adapter by default sends the system acknowledgement ?
- Can we get the acknowledgement if we have multiple receivers?
Please help with info.
Thanks,
TinaHi,
JDBC by default is synchronous. Just create the inbound service interface as synchronous and test, you will find the response. you build the response ICO based on the structure. Even if it insert/delete/update statements, JDBC will return the number of success records. Check the help documentation on JDBC.
As IDOC is asynchronous, you can not do it directly. but you can achieve this using request response bean.
--Naresh -
IDOC-XI-JDBC scenario, jdbc sent too slow
i have a IDOC-XI-JDBC scenario,
the problem is that near 5 Lac IDOC is sent to XI, each IDOC is processes by an instance of the scenario, and the sent to the Database is too clow...means 4000 records per hour,
can i configure the JDBC receiver adapter in a way, so that it becomes faster/more concurrent,Hey,
First raise the issue to the DBA he might help resolve the ISSUE more efficently.
Secondly check in the JDBC adapter -> Adavance mode -> Disconnect from the data base after processing each message shouldn't be set.
Even check with Database Transaction Isolation Level -> default is value of the connected database.
<b>The isolation level determines how transactions running in parallel can influence each other</b>
http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/content.htm
Why not the other way around > Collect multiple idocs in a file restrict maxium number of idocs to required value then send the file ?
Stefan Grube Example:
/people/stefan.grube/blog/2006/09/18/collecting-idocs-without-using-bpm
if it is with bpm then collect multiple idoc with occurance change and send them.
<b>Cheers,
*RAJ*
**REWARD POINTS IF FOUND USEFULL <b> -
Hi,
Hope you all are doing well. I have an IDoc to JDBC scenario. The IDoc structure is as follows:
<IDOC BEGIN="1">
<Structure 1>
<DEFINITION>xxxx</DEFINITION>
<CREATE_DATE>20070706</CREATE_DATE>
</Structure 1 SEGMENT="1">
<Structure 2>
<ELEMENT>xxx1</ELEMENT>
<CREATE_DATE>20070719</CREATE_DATE>
</Structure 2>
<Structure 2>
<ELEMENT>xxx2</ELEMENT>
<CREATE_DATE>20070719</CREATE_DATE>
</Structure 2>
<Structure 3>
<ELEMENT>xxx1</ELEMENT>
<PROJECT>yyyy1</DEFINITION>
</Structure 3>
<Structure 3>
<ELEMENT>xxx1</ELEMENT>
<PROJECT>yyyy2</PROJECT>
</Structure 3>
<Structure 3>
<ELEMENT>xxx2</ELEMENT>
<PROJECT>yyyy3</DEFINITION>
</Structure 3>
<Structure 3>
<ELEMENT>xxx2</ELEMENT>
<PROJECT>yyyy4</PROJECT>
</Structure 3>
</IDOC>
Structures 1, 2 and 3 are at the same level/hierarchy in the IDoc. Structure 3 contains the project name of records in structure 2. The requirement is that if the records in structure 2 have the create date as the current date then the corresponding project in structure 3 has to be passed on to the database by creating a statement. To do this, we need to check the date of the record in structure 2 and if the date is equal to the current date then we have to use the element in structure 2 to select the corresponding rows in structure 3 to be passed on to the database. The INSERT statements have to be created for each of the rows of Structure 3 to be passed on to the database.
How do I achieve this?
I tried using node and text standard functions functions but was unable to achive the objective. Can I use UDF to read the IDoc structures and determine the statements?
regards
DebansuHi Debansu,
Use this Queue type UDF
public void UDF(String[] curDate, String[] Element_Str2, String[] date, String[] Element_Str3, String[] project, ResultList result, Container container) throws StreamTransformationException{
for(int i=0; i<date.length; i++)
if (curDate[0].equals(date<i>))
for(int j=0; j<project.length; j++)
if (Element_Str2<i>.equals(Element_Str2[j]))
result.addValue(project[j]);
Here first parameter is current date function, second parameter is 2nd structure element field, third parameter is date field from 2nd structure, fourth parameter is 3rd structure element field and fifth parameter is project field from 3rd structure.
Regards,
VR -
Hi All,
I am doing a IDOC to JDBC Scenario.I am done with IR and ID.
The Table in the DB is TABLE1 with Field1 and Field2.
Now when I run thescenario it throws an error ,
2009-03-19 12:41:06 Success INSERT INTO TABLE1 (Field1, Field2) VALUES (KM247850, FINJTIA)
2009-03-19 12:41:06 Error Unable to execute statement for table or stored procedure. 'TABLE1' (Structure 'Statement') due to java.sql.SQLException: [EUDNT038]The name "KM247850" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.
But it has successfully generated the SQL Query which I think is perfect.
But whats the error which follows that?
How do I resolve it?
Thanks,
VenuHi,
It could be due to wrong structure of JDBC, compare your target structure with this blog..
/people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30
Regards,
Sarvesh -
IDOC -to-JDBC Scenario for Purchasing Info Record - Urgent !!!
Hi All,
I am working on IDOC-to-JDBC Scenario and i have no concepts about IDOCs. I know how to configure an IDOC in XI , but i have no idea how to start for it in SAP.
Can anybody help me on how to find the INFREC IDOC in SAP, how to configure it , how to insert data into that IDOC and then finally how do we test that if its working or not .
Thanks & Regards,
RuchiHi All,
I am working on IDOC-to-JDBC Scenario and i have no concepts about IDOCs. I know how to configure an IDOC in XI , but i have no idea how to start for it in SAP.
Can anybody help me on how to find the INFREC IDOC in SAP, how to configure it , how to insert data into that IDOC and then finally how do we test that if its working or not .
Thanks & Regards,
Ruchi -
Idoc to jdbc scenario problum in queue ?
hi experts
I am facing a problem in IDOC to JDBC Scenario (PI 7,1) . When i trigger the idoc first time it is inserting in to the data base . when i trigger second and third time struck in the queue .By default the quality of service it is taking EOIO,
My question is :
1. How to clear the Queue ? and is there is any method it automatically release the queue ?
2. How to change the QOS EOIO to EO .(i don't find any option at jdbc adapter level to give QOS ) ?
Thank You
G.Praveen KumarHi,
>>1. How to clear the Queue ? and is there is any method it automatically release the queue ?
To Re-process Automatically
/people/sap.user72/blog/2005/11/29/xi-how-to-re-process-failed-xi-messages-automatically
>>2. How to change the QOS EOIO to EO .(i don't find any option at jdbc adapter level to give QOS ) ?
For any Adapter, Receiver side QOS option wont be there. Sender side only will be available.
As soon as you trigger the Idoc from ECC, this will be sent to receiver in the Idoc generation order only
REgards
Seshagiri -
Very strange error : IDOC to jdbc scenario
Hi
I am getting a very strange error when I see the log for the idoc to jdbc scenario that I am building.
The mapping test shows the header record and line item record properly in the mapping result.
insert, access nodes, fields with access nodes are all formed correctly.
However the communication channel log shows below error.
Could not execute statement for table/stored proc. "tblTestItem" (structure "Item") due to com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near ')'.
JDBC Message processing failed, due to Error processing request in sax parser: Error when executing statement for table/stored proc. 'tblTestItem' (structure 'Item'): com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near ')'.
The message status was set to WAIT.
The query that I see in the log is :INSERT INTO tblTestItem () VALUES ()
However mapping tool shows that all nodes are correctly formed.
Please assist.Hi
I am still getting this issue even after the below steps so kind of stuck - actually very much stuck.
1. Restart of the dev environment
2. Tried with a new extension of the idoc
In the communication channel log for the JDBC receiver channel I still see
INSERT INTO tblItem () VALUES ()
The payload that I see in the message content tab is as follows
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MT_XXX_XXXX xmlns:ns0="http://capita.com/pi/XXXX">
- <Statement>
- <dbTableName action="INSERT">
<table>tblItem</table>
</dbTableName>
- <access>
<InvoiceNo>0000000009293467</InvoiceNo>
</access>
</Statement>
</ns0:MT_XXX_XXXX>
How do I debug the jdbc adapter to see how it converts the above xml output from the mapping step (note that this output is from an actual run and not test tool) to a sql query.
Very strange that the column names are present in the target payload but it is not reflecting in the query.
I have other tables being populated with the same jdbc receiver communication channel which makes this more and more confusing.
PLEASE ADVICE.
Maybe you are looking for
-
System copy: import abap phase
Hi Guys, While performing system copy I am facing issue in import abap phase, pasting the log for your reference: SAPSSEXC_26.log D:\usr\sap\<SID>\SYS\exe\uc\NTAMD64\R3load.exe: sccsid @(#) $Id: //bas/700_REL/src/R3ld/R3load/R3ldmain.c#13 $ SAP D:\us
-
What is better way for creating a thread? Why?
A thread can be create in two way, extending Thread class or implimenting Runnable. What is better way for creating a thread? Why?
-
Hi Experts, I need to call a RFC in R/3.But the problem is if Req parameter is 'A' i need to send back response from RFC and If Req is 'B' it updated some entried in R/3 using same RFC. Currently i have designed like SOAP--XI(server proxy).But how i
-
Hi, I have wrote the following custom XSQL Serializer to render the PDF. import org.w3c.dom.Document; import org.apache.log.Hierarchy; import org.apache.fop.messaging.MessageHandler; import oracle.xml.xsql.XSQLPageRequest; import oracle.xml.xsql.XSQL
-
Several Updates Missing from "All Software Updates"
We've been using SCCM 2012 to patch our systems for a few months now and I thought everything was going smoothly until we got an audit back from out Security office about our boxes missing several patches, listed below. So I go back to the SCCM con