Skip to Content
avatar image
Former Member

How to generate flat file

Hi All,

My scenario is : EDI - SAP PO - File(.txt)

SAP PO  pull the EDI file and  It generate the field fixed lengths file to target.

In my source file  The HDR segment and  DTL segments are repeating  as mention below

.

.

HDR~HDR1~HDR2|

DTL~DATA1~DATA2|

DTL~DATA1~DATA2|

DTL~DATA1~DATA2|

DTL~DATA1~DATA2|

HDR~HDR1~HDR2|

DTL~DATA1~DATA2|

DTL~DATA1~DATA2|

HDR~HDR1~DHDR2|

DTL~DATA1~DATA2|

.

.The Source XML like as below ..

  <L_HDR>

      <S_HDR>

         <FIELD1>HDR1<FIELD1>

         <FIELD2>HDR2</FIELD2>

      </S_HDR>

      <L_DTL>

         <S_DTL>

           <FIELD1>DATA1<FIELD1>

           <FIELD2>DATA2</FIELD2>

         </S_DTL>

      </L_DTL>

      <L_DTL>

          <S_DTL>

            <FIELD1>DATA1<FIELD1>

             <FIELD2>DATA2</FIELD2>

          </S_DTL>

       </L_DTL>

       <L_DTL>

           <S_DTL>

             <FIELD1>DATA1<FIELD1>

             <FIELD2>DATA2</FIELD2>

           </S_DTL>

       </L_DTL>

   </L_HDR>

  <L_HDR>

        <S_HDR>

             <FIELD1>HDR1<FIELD1>

            <FIELD2>HDR2</FIELD2>

         </S_HDR>

       <L_DTL>

         <S_DTL>

            <FIELD1>DATA1<FIELD1>

             <FIELD2>DATA2</FIELD2>

         </S_DTL>

       </L_DTL>

       <L_DTL>

           <S_DTL>

             <FIELD1>DATA1<FIELD1>

              <FIELD2>DATA2</FIELD2>

           </S_DTL>

        </L_DTL>

  </L_HDR>

i Want to generate flat file to target. the format of flat file is shown below

CONSTANT H CONSTANT H       //HEADDER DATA OF HDR

HDR1              HDR2                           // HDR DATA

CONSTANT D CONSTANT D        //HEADDER DATA OF DTL

DATA1            DATA2

DATA1            DATA2                         //DTL DATA

DATA1            DATA2

CONSTANT H CONSTANT H        //HEADDER DATA OF HDR

HDR1              HDR2                           // HDR DATA

CONSTANT D CONSTANT D       //HEADDER DATA OF DTL

DATA1            DATA2

DATA1            DATA2                         //DTL DATA

CONSTANT H CONSTANT H        //HEADDER DATA OF HDR

HDR1              HDR2                           // HDR DATA

CONSTANT D CONSTANT D       //HEADDER DATA OF DTL

DATA1            DATA2                         //DTL DATA

please advise me the target stricture and looping LOGIC OF of Header Data of HDR,HDR,Header Data of DTL,DTL  segments

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Feb 08, 2016 at 04:37 AM

    Hello Reddy,

    You can refer the below link

    XI/PI: File Content Conversion for Complex Structures

    File Receiver with Content Conversion


    If you have any doubts, will help you out.

    Add comment
    10|10000 characters needed characters exceeded