cancel
Showing results for 
Search instead for 
Did you mean: 

Handling Special character "Carriage Return" in PI

Former Member
0 Kudos

Hi Experts,

I have a scenario where JMs adapter is my source and is sending data which is of Fixed length.

My problem is when JMS is sending the data in any of the incoming fields its passing a carriage return(0D- Hexadecimal character).

When this character is coming the record is getting breaked into two or failing in my channel.

Please guide me in handling this issue and to remove this character from the record.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

U can handle this issue by ant of these...

1. U can ask the third party sending messages in JMS to replace the carriage return character by none or empty.. when they are sending it to the messaging system.

But i dont think so they are ready to do it....

2.No problem. U can handle this in the mapping itself.

When the record is breaking because of carriage return, u will receive a new record.

In UDF check the length of each record. If it is less than the Fixed Length we are expecting then combine these 2 records into one.

Still less than the Fixed length append 3rd one also.. so on.

U can go for one extra graphical mapping for this.

And then other mapping which u will use noramally.

in Operation Mapping specify them in sequence.

Babu

Answers (4)

Answers (4)

Former Member
0 Kudos

I handled one case using an UDF to identify a newline character and throwing an exception.

public void NewLine_Char(String[] inputData,ResultList result,Container container){

  char []strTemp = new char[<Give a number as per length of your inputData>];

  i,j;

  int count=inputData.length;

  int length[] = new int[<Give a number as number of occurrences of inputData>];

  String str= "Error: Carriage return found in long description";

  for (i=0;i<count;i++){

       length[i] = inputData[i].length();

       strTemp= inputData[i].toCharArray();

       for(j=0;j<length[i];j++){

            if(strTemp[j]=='\n'){

                 throw new RuntimeException(str);

            }

       }

       result.addValue(inputData[i]);

  }

}

stefan_grube
Active Contributor
0 Kudos

> I have a scenario where JMs adapter is my source and is sending data which is of Fixed length.

> My problem is when JMS is sending the data in any of the incoming fields its passing a carriage return(0D- Hexadecimal character).

Why does the sender adds the 0D to the line?

If you have no chance to change the sender application, then you could write an adapter module which deletes the 0D.

udo_martens
Active Contributor
0 Kudos

Hi,

you can easily remove carriage returns with xsl function

normalize-space()

Regards,

Udo

Former Member
0 Kudos

Thanks for the solution Babu.

But one more issue i am facing is that the value coming in the next field after carriage return is missing from the xml received in PI.

Any suggestions could be of great help.

Former Member
0 Kudos

Hi,

I think u need to check this from the third party providing the JMS messages in messaging system only.

If the data is coming to PI somehow.. then u can handle the data.. if not u need to ask the 3rd party only...

Babu

Former Member
0 Kudos

Hi,

u also have one more option...

ConvertCRLFfromToLF bean used for the converting CRLF pf windows to LF of unix and vice versa.

Please go through following link...

http://help.sap.com/saphelp_nw04/helpdata/en/96/f04142099eb76be10000000a155106/content.htm

Babu