none
how to Set UNB11 test indicator & UNB9 value is null at orchestration level of biztalk2010

    Question

  • Hi,

    I set UNB11 value empty like following code

    msgD93ASource(EdiOverride.UNB9)="";
    msgD93ASource(EdiOverride.UNB11)="";

    after generating .edi file UNB11 showing 0 value like

    UNB+UNOC:3+7080000985678:14+7080000081585:14+120201:0637+366++++0++0

    so I want to remove last two 0's and place blank values. is it possible at any level?

     

    how to set null value for UNB11 at orchestration level?

     

    Regards,

    kishore

     

     

    Wednesday, February 01, 2012 5:49 AM

Answers

  • Hi,

     

    I written custom send piepeline component based on above input then it will be working fine.

                System.IO.StreamReader reader = new System.IO.StreamReader(inmsg.BodyPart.Data);
                string body = reader.ReadToEnd();
                body = body.Replace(this.m_strOldValue, this.m_strNewValue);

                System.IO.MemoryStream m = new System.IO.MemoryStream();
                System.IO.StreamWriter writer = new System.IO.StreamWriter(m);
                writer.AutoFlush = true;
                writer.Write(body);
                m.Position = 0;
                inmsg.BodyPart.Data = m;

                reader.Close();
                return inmsg;


    Regards,

    kishore.

     

     

     

     



    Monday, February 06, 2012 5:48 AM

All replies

  • There is a bug/feature!! in 2010 that BizTalk will no longer make an early termination of the UNB segment if test-flag and/or ack is not set. MS has denied our change-request and said that according to UN it is legal to include the "++++0++0" at the end of the segment.

    Although this is true, almost all of my customers that has gone from 2006R2/2009 to 2010 has had problems with partners that do not allow the extra part of the UNB segment, and therefore I have made a regular expression pipeline called "TerminateUNB", where I strip the UNB segment and place it on my send ports in a pipeline after the EDI assembler component. So far that is the only way I have found that will allow 2010 to make EDI like 2006R2/2009 did.

    Morten la Cour

    Wednesday, February 01, 2012 8:30 AM
  • please give that sample, i want to implement that
    Wednesday, February 01, 2012 8:36 AM
  • That's indeed a new feature in BizTalk 2010. We had the same issue and as la Cour suggested, we created a custom pipelinecomponent that will strip off the UNB segment.

    Something like this should do the trick:

    StreamReader reader = new StreamReader(pInMsg.BodyPart.Data);
    string s = reader.ReadToEnd();
    s = s.Replace("++++0++0", "");
    


    You can also modify the string.Replace with a Regex function on that string, it's what you most prefer...
    Then just create a new stream with your "modified" string. Please do note that this code is not streaming based, so when you are sending bigger files consider making your component streaming based.


    Glenn Colpaert - MCTS BizTalk Server - Blog : http://blog.codit.eu
    • Proposed as answer by sriaug Friday, February 03, 2012 9:30 PM
    • Unproposed as answer by kishore chokkapu Monday, February 06, 2012 5:49 AM
    Friday, February 03, 2012 8:11 AM
  • Hi,

     

    I written custom send piepeline component based on above input then it will be working fine.

                System.IO.StreamReader reader = new System.IO.StreamReader(inmsg.BodyPart.Data);
                string body = reader.ReadToEnd();
                body = body.Replace(this.m_strOldValue, this.m_strNewValue);

                System.IO.MemoryStream m = new System.IO.MemoryStream();
                System.IO.StreamWriter writer = new System.IO.StreamWriter(m);
                writer.AutoFlush = true;
                writer.Write(body);
                m.Position = 0;
                inmsg.BodyPart.Data = m;

                reader.Close();
                return inmsg;


    Regards,

    kishore.

     

     

     

     



    Monday, February 06, 2012 5:48 AM