Skip to Content
avatar image
Former Member

How to Concatenate Strings in XI !

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Jul 05, 2006 at 02:02 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

  • Jul 05, 2006 at 03:15 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 05, 2006 at 02:09 PM

    Hi Mercelo,

    last week we had a similar problem:

    help-on-a-udf

    You can do it as in func2. But your case is not so easy, as it is not sufficient to concatenate the TDLINE, the other thing is reducing the entries of item according to dublicates of CRID.

    Du you have entries only for one CRID?

    Regards

    Stefan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

  • avatar image
    Former Member
    Jul 05, 2006 at 02:31 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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.

  • avatar image
    Former Member
    Feb 23, 2007 at 07:47 AM

    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);

    }

    Add comment
    10|10000 characters needed characters exceeded