cancel
Showing results for 
Search instead for 
Did you mean: 

Remove Spaces in EDI Files

Former Member
0 Kudos


Hi, I have a requirement of processing EDI Files and map it to an IDOC.  I have used B2B add on in splitting this file into several messages and translating EDI ANSI X12 to XML.  Scenarios are:

1) PI will pickup the EDI file from Trading Partner and send it to EDI Separator for splitting

2) EDI Separator will receive the splitted message then translate to XML then send to R/3 as an IDOC

Issue here is in splitting the EDI file into several messages. I'm encountering an error in the splitting part because of spaces/blanks in between ISAs.  Sample data below.

Sample data (spaces highlighted in yellow):

I tried removing the said spaces/blanks and can successfully split the file already.  Now given that the trading partner (sender of EDI file) will not do remove this in their side, how can I remove this in spaces/blanks in PI?

Please help. Thank you.

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member213558
Active Participant
0 Kudos

Hi.

There is some feasibility, before that i would like to know, are you configured '997 required'  at receiver EDI separator.

Regards.

Ramesh

Former Member
0 Kudos

Hi Ramesh, yes the 997 required is configured.  Also, this issue was already addressed using the SAP note: 1975469 - Spaces or Linefeed between ISA segment causes exceptions.

Former Member
0 Kudos

Hi i'm using B2B Add On in PI SP01 and I think i cannot use java mapping since i'm encountering the error before it gets translated to EDI XML.

With upgrading to SP02, I'll look into this possibility but this will take a week or 2.  So may i ask if you have other suggestions? Thank you so much.

Ryan-Crosby
Active Contributor
0 Kudos

Hi Ronwaldo,

Aside from doing the SP02 upgrade I think you would have to write an adapter module to strip out the spaces based on some form of regular expression.  If you add that into the module chain before the EDI splitter module then your problem should go away.  Overall, I would go with the SP02 upgrade but that would certainly be an option.

Regards,

Ryan Crosby

Harish
Active Contributor
0 Kudos

Hi,

You can call XSLT from adapter engine, For this, XSLT should be available in Adapter Engine.

 

Modules to be configured:

AF_Modules/MessageTransformBean    
Type L    <Adapter-Specific Module Name>

Parameter
for the call of the MessageTransformBean module

<Adapter-Specific
Module
Name>              Transform.Class              Value: com.sap.aii.af.sdk.xi.adapter.XSLTConversion


<Adapter-Specific
Module
Name>              XSLTConversion.XSLTFileName
             
Value: Data/DemoConversion.xsl

help link - Inserting MessageTransformBean in Module Processor - Adding Modules to the Module Processor - SAP Li...

regards,

Harish

Former Member
0 Kudos

Hi

Yes you can write an java mapping to read the raw data and then trim the spaces and passed the raw data again.

The logic will be bit complex since you will be reading the raw data instead of xml data.

iaki_vila
Active Contributor
0 Kudos

Hi Ronwaldo,

If you dont find a direct solution, you can use a XSL to remove the whitespaces:


<?xml version="1.0" encoding="utf-8" ?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output method="xml" indent="yes"/>

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

    <xsl:template match="@* | node()">

        <xsl:copy>

            <xsl:apply-templates select="@* | node()"/>

        </xsl:copy>

    </xsl:template>

    <xsl:template match="text()">

        <xsl:value-of select="normalize-space()"/>

    </xsl:template>

</xsl:stylesheet>

Regards.

0 Kudos

This problem may have already fixed with SP02 latest patch. I advise you to be always in latest patches

of SP02 for B2B as developments are happening at rapid pace in B2B add-on.

former_member191435
Contributor
0 Kudos

Hi ,

Can you please let me know how you are converting EDI to EDIXML.. Are you using BIC Map editor.

By Using Java Mapping you can remove the spaces in between IEA and ISA segment.

Thanks,

Sreenivs Veldanda.