Skip to Content

Strip blank spaces at begin of the field value

Hello,

I am using standard XSLT mapping provided by SAP for SAP SNC and SAP ECC integration(Proxy->PI->IDOC).

I have a field that is coming with padded blank spaces and i have to remove that before mapping to Idoc in XSLT mapping.

I am using below function to remove blank spaces but nothing is working. Seems to be i am placing at wrong place or i syntax might be wrong.

Please help me to fix this issue.

<xsl:strip-space elements="ID"/>


My source structure:


InvoiceRequest

-MessageHeader

-Invoice

--Item

---ID


Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Jul 27, 2016 at 03:33 PM

    Used below function to trip preceding spaces in xslt code.


    Untitled.png (20.1 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • Oct 20, 2015 at 02:32 AM

    Bhavana,

    I recommend, not to change standard XSLT given by SAP. Please create an additional graphical mapping (one-to-one) where you can use standard function 'trim'. Use this additional graphical mapping after XSLT in operational mapping.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 19, 2015 at 02:58 AM

    Hi Bhavana

    Please provide the full XSLT mapping and also a sample of your source message.

    Rgds

    Eng Swee

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 19, 2015 at 04:19 AM

    Hello Bhavana,

    It the white spaces are  coming in a single field,you can remove it in mapping using udf or standard mapping functions.No need of additional XSLT.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 19, 2015 at 06:40 AM

    Hi Bhavana.

    First of all i totally agree with Raghuraman and with Eng, it's difficult to help you if you don't share your XSL and if it is not necessary you should try ever to use the message mappings. Also we need to know what is your PI and SP version because in this way we can know if you can use XSLT 2.0. If you only can use XSLT 1.0 you can check the solution provided in the stackoverflow's thread xml - How can I trim space in XSLT without replacing repating whitespaces by single ones? - Stack Overflow

    Regards.

    Add comment
    10|10000 characters needed characters exceeded