Skip to Content
0
Dec 13, 2018 at 10:10 AM

Order items not inserting

295 Views

Hi Experts.

I create scenario SalesOrder/Create.

Inbound parameters:

Processing:

Atom2 code:<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:b1e="urn:com.sap.b1i.sim:b1event" xmlns:b1ie="urn:com.sap.b1i.sim:b1ievent" xmlns:b1im="urn:com.sap.b1i.sim:b1imessage" xmlns:bfa="urn:com.sap.b1i.bizprocessor:bizatoms" xmlns:jdbc="urn:com.sap.b1i.adapter:jdbcadapter" xmlns:js="com.sap.b1i.bpc_tools.Javascript" xmlns:rfc="urn:sap-com:document:sap:rfc:functions" xmlns:sim="urn:com.sap.b1i.sim:entity" xmlns:uplt="urn:com.sap.b1i.xcellerator:upltdoc" xmlns:utils2="com.sap.b1i.bpc_tools.Utilities" xmlns:vpf="urn:com.sap.b1i.vplatform:entity" xmlns:xci="urn:com.sap.b1i.xcellerator:intdoc" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" bfa:force="" vpf:force="" jdbc:force="" rfc:force="" b1ie:force="" b1e:force="" xci:force="" sim:force="" utils2:force="" b1im:force="" uplt:force="" js:force="">
    <xsl:output method="xml" encoding="UTF-8" indent="yes"></xsl:output>
    <xsl:param name="atom"></xsl:param>
    <xsl:param name="sessionid"></xsl:param>
    <xsl:variable name="msg" select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role='S']"></xsl:variable>
    <xsl:variable name="vpSender" select="/vpf:Msg/vpf:Header/vpf:Sender/@Id"></xsl:variable>
    <xsl:variable name="vpObject" select="/vpf:Msg/vpf:Header/vpf:Sender/@ObjId"></xsl:variable>
    <xsl:variable name="vpReceiver" select="/vpf:Msg/vpf:Header/vpf:ReceiverList/vpf:Receiver[./@handover='P']/@Id"></xsl:variable>
    <xsl:template match="/">
        <xsl:variable name="vptsDoc" select="document('/com.sap.b1i.internal/xml/timestamp')"></xsl:variable>
        <xsl:variable name="vpts" select="concat($vptsDoc/*/@year,'/',$vptsDoc/*/@month,'/',$vptsDoc/*/@date,' ',$vptsDoc/*/@hour,':',$vptsDoc/*/@minute,':',$vptsDoc/*/@second)"></xsl:variable>
        <vpf:Msg>
            <xsl:copy-of select="/vpf:Msg/@*"></xsl:copy-of>
            <xsl:copy-of select="/vpf:Msg/vpf:Header"></xsl:copy-of>
            <vpf:Body>
                <xsl:copy-of select="/vpf:Msg/vpf:Body/*"></xsl:copy-of>
                <vpf:Payload Role="X" id="{$atom}" ts="{$vpts}">
                    <xsl:call-template name="transform"></xsl:call-template>
                </vpf:Payload>
            </vpf:Body>
        </vpf:Msg>
    </xsl:template>
    <xsl:template name="transform">
        <Documents>
            <row>
                <DocObjectCode>17</DocObjectCode>
                <CardCode>
                    <xsl:value-of select="$msg/bfa:io/bfa:object/bfa:string[./@name='BusinessPartner']"></xsl:value-of>
                </CardCode>
                <DocType>
                    <xsl:value-of select="$msg/bfa:io/bfa:object/bfa:string[./@name='DocType']"></xsl:value-of>
                </DocType>
                <DocDueDate>
                    <xsl:value-of select="$msg/bfa:io/bfa:object/bfa:string[./@name='DeliveryDate']"></xsl:value-of>
                </DocDueDate>
                <NumAtCard>
                    <xsl:value-of select="$msg/bfa:io/bfa:object/bfa:string[./@name='OrderReference']"></xsl:value-of>
                </NumAtCard>
                <Comments>
                    <xsl:value-of select="$msg/bfa:io/bfa:object/bfa:string[./@name='Comments']"></xsl:value-of>
                </Comments>
            </row>
        </Documents>
        <Document-Lines>
            <xsl:for-each select="$msg/bfa:io/bfa:object/bfa:array[./@name='OrderItems']/bfa:object">
                <row>
                    <LineNum>
                        <xsl:value-of select="bfa:string[./@name='LN']"></xsl:value-of>
                    </LineNum>
                    <ItemCode>
                        <xsl:value-of select="bfa:string[./@name='Code']"></xsl:value-of>
                    </ItemCode>
                    <Quantity>
                        <xsl:value-of select="bfa:string[./@name='Quantity']"></xsl:value-of>
                    </Quantity>
                    <Price>
                        <xsl:value-of select="bfa:string[./@name='UnitPriceOnOrder']"></xsl:value-of>
                    </Price>
                </row>
            </xsl:for-each>
        </Document-Lines>
    </xsl:template>
</xsl:stylesheet>



B1 Object parameters: 

Atom4 code:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:b1e="urn:com.sap.b1i.sim:b1event" xmlns:b1ie="urn:com.sap.b1i.sim:b1ievent" xmlns:b1im="urn:com.sap.b1i.sim:b1imessage" xmlns:bfa="urn:com.sap.b1i.bizprocessor:bizatoms" xmlns:jdbc="urn:com.sap.b1i.adapter:jdbcadapter" xmlns:js="com.sap.b1i.bpc_tools.Javascript" xmlns:rfc="urn:sap-com:document:sap:rfc:functions" xmlns:sim="urn:com.sap.b1i.sim:entity" xmlns:uplt="urn:com.sap.b1i.xcellerator:upltdoc" xmlns:utils2="com.sap.b1i.bpc_tools.Utilities" xmlns:vpf="urn:com.sap.b1i.vplatform:entity" xmlns:xci="urn:com.sap.b1i.xcellerator:intdoc" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" bfa:force="" vpf:force="" jdbc:force="" rfc:force="" b1ie:force="" b1e:force="" xci:force="" sim:force="" utils2:force="" b1im:force="" uplt:force="" js:force="">
    <xsl:output method="xml" encoding="UTF-8" indent="yes"></xsl:output>
    <xsl:param name="atom"></xsl:param>
    <xsl:param name="sessionid"></xsl:param>
    <xsl:variable name="msg" select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role='S']"></xsl:variable>
    <xsl:variable name="vpSender" select="/vpf:Msg/vpf:Header/vpf:Sender/@Id"></xsl:variable>
    <xsl:variable name="vpObject" select="/vpf:Msg/vpf:Header/vpf:Sender/@ObjId"></xsl:variable>
    <xsl:variable name="vpReceiver" select="/vpf:Msg/vpf:Header/vpf:ReceiverList/vpf:Receiver[./@handover='P']/@Id"></xsl:variable>
    <xsl:template match="/">
        <xsl:variable name="vptsDoc" select="document('/com.sap.b1i.internal/xml/timestamp')"></xsl:variable>
        <xsl:variable name="vpts" select="concat($vptsDoc/*/@year,'/',$vptsDoc/*/@month,'/',$vptsDoc/*/@date,' ',$vptsDoc/*/@hour,':',$vptsDoc/*/@minute,':',$vptsDoc/*/@second)"></xsl:variable>
        <vpf:Msg>
            <xsl:copy-of select="/vpf:Msg/@*"></xsl:copy-of>
            <xsl:copy-of select="/vpf:Msg/vpf:Header"></xsl:copy-of>
            <vpf:Body>
                <xsl:copy-of select="/vpf:Msg/vpf:Body/*"></xsl:copy-of>
                <vpf:Payload Role="X" id="{$atom}" ts="{$vpts}">
                    <xsl:call-template name="transform"></xsl:call-template>
                </vpf:Payload>
            </vpf:Body>
        </vpf:Msg>
    </xsl:template>
    <xsl:template name="transform">
        <ServiceLayer>
            <bfa:io>
                <bfa:object>
                    <bfa:string name="DocEntry">17</bfa:string>
                    <bfa:string name="CardCode">
                        <xsl:value-of select="$msg/bfa:io/bfa:object/bfa:string[./@name='BusinessPartner']"></xsl:value-of>
                    </bfa:string>
                    <bfa:string name="DocType">
                        <xsl:value-of select="$msg/bfa:io/bfa:object/bfa:string[./@name='DocType']"></xsl:value-of>
                    </bfa:string>
                    <bfa:string name="DocDueDate">
                        <xsl:value-of select="$msg/bfa:io/bfa:object/bfa:string[./@name='DeliveryDate']"></xsl:value-of>
                    </bfa:string>
                    <bfa:string name="NumAtCard">
                        <xsl:value-of select="$msg/bfa:io/bfa:object/bfa:string[./@name='OrderReference']"></xsl:value-of>
                    </bfa:string>
                    <bfa:string name="Comments">
                        <xsl:value-of select="$msg/bfa:io/bfa:object/bfa:string[./@name='Comments']"></xsl:value-of>
                    </bfa:string>
                    <bfa:array name="DocumentLines">
                        <xsl:for-each select="$msg/bfa:io/bfa:object/bfa:array[./@name='OrderItems']/bfa:object">
                            <bfa:object>
                                <bfa:string name="LineNum">
                                    <xsl:value-of select="bfa:string[./@name='LN']"></xsl:value-of>
                                </bfa:string>
                                <bfa:string name="ItemCode">
                                    <xsl:value-of select="bfa:string[./@name='Code']"></xsl:value-of>
                                </bfa:string>
                                <bfa:string name="Quantity">
                                    <xsl:value-of select="bfa:string[./@name='Quantity']"></xsl:value-of>
                                </bfa:string>
                                <bfa:string name="Price">
                                    <xsl:value-of select="bfa:string[./@name='UnitPriceOnOrder']"></xsl:value-of>
                                </bfa:string>
                            </bfa:object>
                        </xsl:for-each>
                    </bfa:array>
                </bfa:object>
            </bfa:io>
        </ServiceLayer>
    </xsl:template>
</xsl:stylesheet>


For test i'm posting the JSON:

Scenario work without error, but order items not inserting.

Please help me, what i do wrong? Thank you

Message log from monitoring after scenario work success:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<Msg xmlns="urn:com.sap.b1i.vplatform:entity" httpprocstatus="ok" logmsg="0000" src="D"directMode="MsgLog-noSetVar" MessageId="18121317431506251585C0A837322D3A" SubMessageId="1"BeginTimeStamp="20181213174315" msglogexcl="false" handover2CentralSrv="" MessageLog="true"msglogdbop="insert" status="success">
<Header>
<msglog step="Default message log" always="false" b1ifactive="true"/>
<SimpleCall roottag="io" querykey.biu="" srvdoc1D.vbiu="" srvdoc1R.vbiu=""srvdoc1.vbiu="" srvdoc2.vbiu="" srvdoc3.vbiu="[D]OC.SendData" src="D"/>
<IPO Id="INB_HT_CALL_SYNC_XPT" tid="18121311460306251571C0A8373264B6"/>
<Sender Id="0010000109" ObjId="OC.SendData"/>
<vBIU Id="OC.SendData" SId="OC.HttpCall"/>

</Header>


<vpf:Body xmlns:vpf="urn:com.sap.b1i.vplatform:entity">
<Payload Role="T" Type="Call">
<http.user user="" lang="en" provided="false"/>
<http.host>192.168.55.50</http.host>
<http.secure>false</http.secure>
<http.method>POST</http.method>
<http.pathsuffix>/SalesOrder/Create</http.pathsuffix>
<httpheader.X-HTTP-Method-Override/>
<http.header.info id="accept-encoding" value="gzip,deflate"/>
<http.header.info id="content-type" value="application/json"/>
<http.header.info id="content-length" value="352"/>
<http.header.info id="host" value="WINS2012B1.net.orchard:8080"/>
<http.header.info id="connection" value="Keep-Alive"/>
<http.header.info id="user-agent" value="Apache-HttpClient/4.1.1 (java 1.5)"/>

</Payload>


<Payload Role="S">
<io xmlns="urn:com.sap.b1i.bizprocessor:bizatoms" pltype="json">
<object>
<string name="BusinessPartner">C23900</string>
<string name="DeliveryDate">20181201</string>
<string name="DocType">dDocument_Items</string>
<string name="OrderReference">Testrt</string>
<string name="Comments">12345</string>
<array name="OrderItems">
<object>
<string name="LN">1</string>
<string name="Code">A00001</string>
<string name="Quantity">5.0</string>
<string name="UnitPriceOnOrder">99.00</string>

</object>


<object>
<string name="LN">2</string>
<string name="Code">A00004</string>
<string name="Quantity">4.0</string>
<string name="UnitPriceOnOrder">250.00</string>

</object>



</array>



</object>



</io>



</Payload>


<vpf:Payload Role="X" id="atom2" ts="2018/12/13 17:43:15">
<Documents xmlns="">
<row>
<DocObjectCode>17</DocObjectCode>
<CardCode>C23900</CardCode>
<DocType>dDocument_Items</DocType>
<DocDueDate>20181201</DocDueDate>
<NumAtCard>Testrt</NumAtCard>
<Comments>12345</Comments>

</row>



</Documents>


<Document-Lines xmlns="">
<row>
<LineNum>1</LineNum>
<ItemCode>A00001</ItemCode>
<Quantity>5.0</Quantity>
<Price>99.00</Price>

</row>


<row>
<LineNum>2</LineNum>
<ItemCode>A00004</ItemCode>
<Quantity>4.0</Quantity>
<Price>250.00</Price>

</row>



</Document-Lines>



</vpf:Payload>


<Payload Role="C" id="atom1" system="0010000100" status="success" b1login="Technical User" method="Synchronous Insert" objectid="112" payload="atom2" keyname="DocEntry"keyvalue="" DIresult="success" DImsg="76"/>
<vpf:Payload Role="X" id="atom4" ts="2018/12/13 17:43:15">
<ServiceLayer xmlns="">
<bfa:io xmlns:bfa="urn:com.sap.b1i.bizprocessor:bizatoms">
<bfa:object>
<bfa:string name="DocEntry">17</bfa:string>
<bfa:string name="CardCode">C23900</bfa:string>
<bfa:string name="DocType">dDocument_Items</bfa:string>
<bfa:string name="DocDueDate">20181201</bfa:string>
<bfa:string name="NumAtCard">Testrt</bfa:string>
<bfa:string name="Comments">12345</bfa:string>
<bfa:array name="DocumentLines">
<bfa:object>
<bfa:string name="LineNum">1</bfa:string>
<bfa:string name="ItemCode">A00001</bfa:string>
<bfa:string name="Quantity">5.0</bfa:string>
<bfa:string name="Price">99.00</bfa:string>

</bfa:object>


<bfa:object>
<bfa:string name="LineNum">2</bfa:string>
<bfa:string name="ItemCode">A00004</bfa:string>
<bfa:string name="Quantity">4.0</bfa:string>
<bfa:string name="Price">250.00</bfa:string>

</bfa:object>



</bfa:array>



</bfa:object>



</bfa:io>



</ServiceLayer>



</vpf:Payload>


<Payload Role="C" id="atom3" system="0010000100" method="Add" objectid="Drafts">
<http.header/>
<httaError xmlns="urn:com.sap.b1i.xcellerator:upltdoc" HTTPcode="" HTTPmsg="">
<exceptionMsg>
java.net.ConnectException: Connection refused: connect (local port 60265 to address 0:0:0:0:0:0:0:0, remote port 443 to address 192.168.55.50 (WINS2012B1.net.orchard))
</exceptionMsg>


<returnData/>

</httaError>



</Payload>


<vpf:Payload Role="R" id="atom0" ts="2018/12/13 17:43:16" pltype="xml">
<DefineResponce xmlns="">
<HTTPresponse> Sales Order draft created successfully. </HTTPresponse>

</DefineResponce>



</vpf:Payload>



</vpf:Body>



</Msg>



Attachments

inbound.png (31.3 kB)
processing.png (81.7 kB)
b1-object.png (53.4 kB)
json.png (95.9 kB)