Skip to Content

Java Script to add special character in members conversion

Hi all,

Users want to add special characters to their members. For example convert 120000050130 to 1_20000.501.30 The logic is after every first digit or character, insert "_", then after the next 5 digits, insert ".", after the next 3 digits/characters, insert another "."

Regards

Jordan

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Jan 23 at 09:32 PM

    First you need to convert %eternal% to string:

    js: %external%.toString

    Then

    js:

    %external%.toString().slice(0,1)+"_"+%external%.toString().slice(1,6)+"."+%external%.toString().slice(7,10)+"."+%external%".toString().slice(10)

    You can test it here:

    http://js.do/

    <script>
    alert("120000050130".toString().slice(0,1)+"_"+"120000050130".toString().slice(1,6)+"."+"120000050130".toString().slice(7,10)+"."+"120000050130".toString().slice(10))
    </script>
    Add comment
    10|10000 characters needed characters exceeded

  • Jan 23 at 04:15 PM

    Sorry, but you didn't accepted my answer in previous question!

    https://answers.sap.com/questions/404916/invalid-special-characters-in-transformation-and-c.html

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 23 at 05:24 PM

    If you open ANY JavaScript tutorial you will find function:

    substring(start [, end])

    or

    substr(start [, length])

    or

    slice(start [, end])

    And you can test your code on any JavaScript test page!



    Add comment
    10|10000 characters needed characters exceeded

  • Jan 23 at 05:09 PM

    Hello,

    Please review KBA 1448836 for permitted characters. This KBA covers valid characters for all areas of BPC, anything outside it or stated as invalid will not be supported.

    Best Regards,

    Leila Lappin

    Add comment
    10|10000 characters needed characters exceeded