cancel
Showing results for 
Search instead for 
Did you mean: 

Inbound - Flat File dsv example

0 Kudos

Hi all,

I would like to create Delivery Notes based on a DSV file. Does anyone have a simple example from which I can learn?

For starters, I would like to know how to get the different values of a row. A for-each loop would work but how do I know in which column I am.

This is the file in my Sender system:

<Payload Role="S">

            <io xmlns="urn:com.sap.b1i.bizprocessor:bizatoms" pltype="csv">

                <row>

                    <col>H</col>

                    <col>C1032</col>

                    <col>1200001</col>

                    <col>12716418</col>

                    <col/>

                    <col>4500674129</col>

                    <col>27/09/2012</col>

                    <col>13/09/2012</col>

                    <col>27/09/2012</col>

                    <col>30074</col>

                    <col>Kverneland Nieuw Vennep</col>

                    <col>Hoof</col>

                    <col>Kverneland Gr.Nw-Vennep BV</col>

                    <col/>

                    <col>2153</col>

                    <col>LR Nieuw Vennep</col>

                    <col>NL</col>

                    <col/>

                    <col>0</col>

                    <col/>

                    <col/>

                </row>

                <row>

                    <col>L</col>

                    <col>C1032</col>

                    <col>12716418</col>

                    <col>2</col>

                    <col>36.72.449.286</col>

                    <col>Lenkachse</col>

                    <col>ST</col>

                    <col/>

                    <col/>

                    <col>N</col>

                    <col>N</col>

                    <col>P1</col>

                    <col/>

                    <col>Agrarprogramm</col>

                    <col>1</col>

                    <col>1</col>

                    <col>1</col>

                    <col>0.000</col>

                    <col>N</col>

                    <col>0</col>

                    <col>4</col>

                    <col>3</col>

                    <col/>

                    <col/>

                    <col/>

                </row>

            </io>

        </Payload>

Accepted Solutions (1)

Accepted Solutions (1)

bastian_schaefer
Active Contributor
0 Kudos

Hi Sebastiaan,

please use a 'format control dcoument'.

It's a xml-file controlling the file inbound, here you are able to define different names for the col elements.

Please check in the B1if online help for File Inbound (Help -> Documents -> 2. Scenario Development -> 2.2 Inbound ->2.2.3 File Inbound)

At chapter 3.1 Transforming a DSV file into XML, the structure of this document is described.

Please create the format control document and place it into the bizstore (into the integration step you're working with).

Enter a reference to this file using the inbound definition (see screenshot):

Best regards

Bastian

0 Kudos

Hi Bastian,

I found the necessary information and I created a format file and assigned it to the Step but alas, nothing changes... Is there a way to see why it's not working?

Maybe the problem is that different lines have a different meaning according to the first field. I create generic names to solve this:

<DSV><!-- Format Control Document -->

<field>HEADER</field>

<field>col01</field>

<field>col02</field>

<field>col03</field>

<field>col04</field>

<field>col05</field>

<field>col06</field>

<field>col07</field>

<field>col08</field>

<field>col09</field>

<field>col10</field>

<field>col11</field>

<field>col12</field>

<field>col13</field>

<field>col14</field>

<field>col15</field>

<field>col16</field>

<field>col17</field>

<field>col18</field>

<field>col19</field>

<field>col20</field>

<field>col21</field>

<field>col22</field>

<field>col23</field>

<field>col24</field>

<field>col25</field>

</DSV>

But the result stays:

<Payload Role="S">

    <io xmlns="urn:com.sap.b1i.bizprocessor:bizatoms" pltype="csv">

        <row>

            <col>H</col>

            <col>BPW</col>

            <col>1200001</col>

            <col>12716418</col>

            <col/>

            <col>4500674129</col>

            <col>27/09/2012</col>

            <col>13/09/2012</col>

            <col>27/09/2012</col>

            <col>30074</col>

            <col>Kverneland Nieuw Vennep</col>

            <col>Hoofdweg 1278</col>

            <col>Kverneland Gr.Nw-Vennep BV</col>

            <col/>

            <col>2153</col>

            <col>LR Nieuw Vennep</col>

            <col>NL</col>

            <col/>

            <col>0</col>

            <col/>

            <col/>

        </row>

        <row>

            <col>L</col>

            <col>BPW</col>

            <col>12716418</col>

            <col>2</col>

            <col>36.72.449.286</col>

            <col>Lenkachse GSLL12010 150x16 FL4118GSK SP=2150 FM=774 Zw. Lenk.</col>

            <col>ST</col>

            <col/>

            <col/>

            <col>N</col>

            <col>N</col>

            <col>P1</col>

            <col/>

            <col>Agrarprogramm</col>

            <col>1</col>

            <col>1</col>

            <col>1</col>

            <col>0.000</col>

            <col>N</col>

            <col>0</col>

            <col>4</col>

            <col>3</col>

            <col/>

            <col/>

            <col/>

        </row>

    </io>

</Payload>

bastian_schaefer
Active Contributor
0 Kudos

Hi Sebstiaan,

to activate your changes with the format control document, please de- and reactivate your scenario.

A format control document can only handle inbound files with a equal structure for each line, that's the primary purpose.

But there's maybe an alternative using conditions in atom0 to count the columns using []:

col[1] is the first, col[2] is the second, col[3] is the third ...

please find the following example splitting into header using condition [col[1]=&apos;H&apos;] and into item segments using condition

<xsl:for-each select="$msg/io/row[col[1]=&apos;L&apos;]">:

<xsl:template name="transform">

<xsl:attribute name="pltype">xml</xsl:attribute>

<header>

<col01>

<xsl:value-of select="$msg/io/row[col[1]=&apos;H&apos;]/col[1]"/>

</col01>

<col02>

<xsl:value-of select="$msg/io/row[col[1]=&apos;H&apos;]/col[2]"/>

</col02>

...

</header>

<item>

<xsl:for-each select="$msg/io/row[col[1]=&apos;L&apos;]">

<col01>

<xsl:value-of select="./col[1]"/>

</col01>

<col02>

<xsl:value-of select="./col[2]"/>

</col02>

...

</xsl:for-each>

</item>

</xsl:template>

The example above is working if the header is the first row of your CSV and only one header exists in your csv file.

Best regards

Bastian

0 Kudos

Hi Bastian,

Thanks!! That looks good! I can even rename the name of the elements and change it a bit with a choose element to allow multiple groups in one file...

I just have one more problem debugging this step.

If I create a file in DSV form (as the normal input) he doesn't convert it to XML (not even the anonymous row/col format). If I create a file with the row/col format (as in the Sender Payload), he just reads it as plain text...

Is there a way for me to debug this?

0 Kudos

Got it! I've created an XML file with the <io> part and this is working

Answers (0)