cancel
Showing results for 
Search instead for 
Did you mean: 

Need Mapping Help

Former Member
0 Kudos

Hi Experts,

We have IDoc to JDBC scenario in our project. This interface is working fine but we have material description filed length (40 chars) when there is an apostrophe( ' ) coming at end of the material description(40th position) ( ex: AVEVDERIVC C NP VIUYA CSEMEWEA UYV ABC' ) , the message is failing in receiver JDBC channel. In PI We have replacing single quote with two quotes, after executing the PI mapping the field value converts ('AVEVDERIVC C NP VIUYA CSEMEWEA UYV ABC''), in this case we need to remove apostrophe( ' ) at 40th position. as per my understanding if the apostrophe are in odd number while sending to DB it is giving an error. Kindly do help me how we can handle this logic in PI.


Regards,

Sanjay.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182412
Active Contributor
0 Kudos

Hi Sanjay,

Use below mapping.

Regards,

Praveen.

Former Member
0 Kudos

Hi,

Thanks for your reply, i want to remove 40th position single quote,if the apostrophe(') comes at 40th position then we need remove that.we will get apostrophe at middle and starting as shown below,

EXample:

input : AVEVDERIVC' C NP VIU CSEMEWEA' UYV ABC'

OutPut : AVEVDERIVC' C NP VIU CSEMEWEA' UYV ABC


My case Replace String function is not working.


Please help me on this.


Regards,

Sanjay.

Former Member
0 Kudos

why you want to remove the 40th position quotes or last quote of the string?

Former Member
0 Kudos

Hi Ram,

Thanks for your reply, material description length is 40 chars at DB side, few material description does not have apostrophe. here first i am trimming the desc length to 40 chars and replace all single to double quote and then i am adding apostrophe at starting the field value and end of the field value('Snjay'). if we got 40 chars length description end with apostrophe then PI is adding one more apostrophe. while executing the SQL query in between the apostrophe taking as string, i have explained in my first post it is having 3 apostrophe, SQL query is searching for another closing apostrophe. As we had discussed with functional team regarding this issue they have suggested if field value is 40 chars end with apostrophe then we remove the apostrophe at end and sending 39 chars to DB or we will send the data same to DB what we are getting from ECC. could you please help us how we can handle this issue. highly appreciated.


Regards,

Sanjay.

manoj_khavatkopp
Active Contributor
0 Kudos

hi,

if field value is 40 chars end with apostrophe then we remove the apostrophe at end and sending 39 chars to DB or we will send the data same to DB what we are getting from ECC

the below UDF checks whether you have apostrophe at 40th position or not if it has it ll remove that , if it doesn't then same value will be passed :

  if(var1.lastIndexOf(''')==40)

        {

            return var1.substring(0,40);

        }

        else

        {

            return var1;

        }

JaySchwendemann
Active Contributor
0 Kudos

's solution will probably work.

If you want to resolve without UDF you could try something in the like of this (provided I understood your problem correctly)


faultText is your input field (just used the first mapping that I found to fiddle around, so don't bother about the naming of the fields)

Answers (2)

Answers (2)

Former Member
0 Kudos

In the receiver channel try giving the SQL Syntax parameter > use Escape symbol for Apostrophe '


or modify the Target structure to handle hasQuot attibute as "YES".

Former Member
0 Kudos

Hello Snjay,

As per my understanding replace string should work ,just replace the string which you want to do.

else you write UDF to count 40 character and pass.

Regards

Naveen