on 07-04-2006 8:10 PM
Hello..
I have the scene RFC - XI - JDBC
insert in SQLServer tables... when i insert in last table i have one proble with concatenate Strings.
This is the error ocurred in my message monitor:
Unable to execute statement for table or stored procedure. 'TLINES' (Structure 'statement_TABELA4') due to java.sql.SQLException: [SQLServer 2000 Driver for JDBC][SQLServer]INSERT statement conflicted with TABLE FOREIGN KEY constraint 'FK_TLINES_CRFV'. The conflict occurred in database 'tmp_rfc', table 'CRFV'.
the problem is refering to TABLE FOREIGN KEY !
This is the message come from XML:
-
I need to concatenate the field TDLINE to insert the Data in only one line in the table because the TABLE FOREIGN KEY relationship !!!
My question is:
How to cancatenate the Field TDLINE ??
thanks...
Regards...
Boni
HI,
If i got it correctly, ...
write a UDF from source TDLINE and target to ... target node..
take the QUEUE and the context of TDLINE to its parent node item..
maintain loop and concat ..
ex
(String[] tdline)
String [] final ;
{for (int i =0;i<tdline.length;i++){
final.concat(tdline<i>);
}
result.addValue(final);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Boni,
I was not referring to the occurence of the message mapping, but the specific field "TDLINE"'s occurence.
For example, in the xml that you posted, the first record-set has :
<TDLINE>Data e hora de inicio:</TDLINE>
whereas in the second record-set there is no value:-
<TDLINE />
Regards,
Sushumna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sushumna !
thank you !!
Look the XML come from R/3:
i need to concatenate the items of TDLINE ...If you to analyze 3 first fields CRID, FTNO, FVNO are equal because of the key ok?
The Last field TDLINE was broken in segments of the XML and I need to concatenate this fields to insert an one only line of the database !
The others tables only insert one line ...how i do to insert all XML segments ???
thanks...
Boni.
Hi !
I change the ocurrence structure of XML Receiver ocurrence 0..unbounded !
When execute the application ..its insert only one line in the database fields to tables CRFT, CRFV !
The table TLINES i need to concatenate the field TDLINE because the foreigne Key ! ...the others tables does not only contain foreigne Key and insert only one line in database. However the XML has other segments ....
Why not insert the other elements???
thanks.
Boni.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stefan !
I need to insert in 4 tables CRHE, CRFT, CRFV, TLINES !
The only table that I need to concatenate field is TLINES !
The others Table the XML has many elements ...but insert only one ! ...This is because de ocurrence item is message Mapping ??? ...My ocurrence is 1 ..1 !
Some has a little tutorial how to use ocurrences im message mapping??
Thanks...
Boni
Hi Stefan..
I need to stop this to resolve other problem !
Now ..i return to make this !
Thanks for send the similar problem to analyse !
Yes ...to CRID i have only one entries !
I have more entries to FTNO and FVNO ...and concatenate the TDLINE for insert in only one line of database for each FTNO item and concatenate TDLINE itens for this FTNO !
Do you have some idea how i need make the java code ???
Thanks...
thanks...
Hi Srinivas,
I have come accrossed this kind of situ... If i am not wrong, ur requirement is, your source file filed "TDLINE" is multiple occurance, which you have to concatenate and map it to target filed, right!, if so, the following UDF will definetely help you.
String result1=new String( );
for(int j=0; j<a.length; j++)
result1 += a[j];
{
rsult.addvalue(result1);
}
regards
Hi Vijaya Lakshmi,
Sorry for delay my response. Thanks for your reply.
My Input structure is complex structure. here is the example
Source Structure
ZEmployee
Data
Employee first name
Employee Last name
Employee number
Employee Joining date
Employee Joining time
Lines
Tdline.
Target Structure is
ZEmployee
Employee first name
Employee Last name
Employee number
Employee Joining date
Employee Joining time
Employee Notes
In my scenario i need to concatenate all the TDLINES and pass to Employee Notes in the target for each employee. How to triger UDF for this scenario and I need to change any mappings.
your help is highly appreciated.
Regards,
Srini
Hi Boni,
The error clearly states that a Foreign Key constraint is being vioalted while trying to indert data into the database.
Just check which filed has a Foreign Key constraint and try to pass valid data to it.
Also, you have just posted a part of the data that is being pushed to the JDBC adapter. Can you give us the entire strucutre?
Regards,
Bhavesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To write the userdefined fucnctions, just go to the Message mapping, in the left side corner u will see a button called "Create new function", if u create a new function, Give a label and and chose the cache type as Value (for simple User Defined Function)/ Context or Queue (for advanced User Define Function) then write ur code.
For more details, go thro this site.
http://help.sap.com/saphelp_nw2004s/helpdata/en/84/e8763c997fda50e10000000a11405a/frameset.htm
You go better direct to this site:
http://help.sap.com/saphelp_nw2004s/helpdata/en/22/e127f28b572243b4324879c6bf05a0/frameset.htm
Regards
Stefan
Hi Boni,
Write a user defined function to read the value of tdline character by characte and if the character is a space, delete it. Also, i have noticed thet the occurence of this firld is 0..unbounded, so take care to map if the field has no value also.
Regards,
Sushumna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Boni,
How i can Write user defined function ??
There is detailed explanation of how to define your own function in help.sap.com. You will need to nkow java to code this function. Once the function is defined and saved, it can be used like any other standard function...drag and drop ni the editor..
"In the message mapping the item ocurrence it mut be 0..undounded ???"
I had mentioned this because...while you write the code, jes make sure that your code takes care of a condition where there is no value for this field altogether..
Regards,
Sushumna
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.