Skip to Content
author's profile photo Former Member
Former Member

Mapping Question...

Hi Guys,

I need a udf to split a string into an array.

Basically I could get a string with a seemingly unlimted length.

I want to then split this string into an array of 132 maximum obviously it can be less than 132 if there are not enough characters but the general gist is to split the string.

So lets say you had a string with length of 296 characters. It would then return an array with

132 characters

132 characters

32 characters

could someone provide me a udf for this please?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Apr 02, 2008 at 08:47 AM

    Hi,

    Actually u need some stuff regarding the mapping functions which are present in the message mapping..

    In node functions we get Split by value, Remove contexts, collapseContexts..

    Split By value again has 3 possiblities -- Each Value, Value Changed, Empty Value.

    and follow this documents for the information..

    Remove context -

    http://help.sap.com/saphelp_nw04/helpdata/en/1f/ea0fb12403844bbb6c4cbc8a00cda9/content.htm

    Collapse context -

    http://help.sap.com/saphelp_nw04/helpdata/en/4b/d11e3e1c3b120ae10000000a114084/content.htm

    Node Functions

    http://help.sap.com/saphelp_nw04s/helpdata/en/2c/2d8c4024d26e1de10000000a1550b0/frameset.htm

    reddy gundala

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      here is your udf:

      public void splitString(String a,Container container)

      {

      for(int i=0;a.length()/132-(132-a.length()%132)/5;i++)

      result.addValue(a.subString(i132,i132+132)

      result.addValue(a.subString(i*132,a.length());

      }

      **Reward points if helpful.

      --Sankar Choudhury

  • author's profile photo Former Member
    Former Member
    Posted on Apr 02, 2008 at 08:01 AM

    Hi,

    U can use substring std function provided in XI. Give the start and end postiond of string and accordingly it will split the string.

    Chirag

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 02, 2008 at 10:41 AM

    Hi,

    here is your udf:

    public void splitString(String a,Container container)

    {

    for(int i=0;a.length()/132-(132-a.length()%132)/5;i++)

    result.addValue(a.subString(i132,i132+132)

    result.addValue(a.subString(i*132,a.length());

    }

    **Reward points if helpful.

    --Sankar Choudhury

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.