Skip to Content
0
Jan 05, 2019 at 03:29 PM

B1if: Produce flat file in outbound

396 Views

Hi folks.

This is my first scenario in B1if v.1 where I have to append in a text flat file the items created in B1.

No problem to configure B1 Events and receive data from B1 after each Items creation and I'm able to create the outbound text flat file too. The problem is that the file is empty.

In my payload by event I see the Items object and I have the Control Format for XML to FlatFile too but seems not enough.

What I have omitted in my scenario configuration?

If can help, this is the debug session overview with the payloads in inbound to the final and End blocks

Here you have the xslt script in final

<?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:param name="atom"/>
	<xsl:param name="sessionid"/>
	<xsl:variable name="msg" select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role='S']"/>
	<xsl:variable name="vpSender" select="/vpf:Msg/vpf:Header/vpf:Sender/@Id"/>
	<xsl:variable name="vpObject" select="/vpf:Msg/vpf:Header/vpf:Sender/@ObjId"/>
	<xsl:variable name="vpReceiver" select="/vpf:Msg/vpf:Header/vpf:ReceiverList/vpf:Receiver[./@handover='P']/@Id"/>
	<xsl:template match="/">
		<xsl:variable name="vptsDoc" select="document('/com.sap.b1i.internal/xml/timestamp')"/>
		<xsl:variable name="vpts" select="concat($vptsDoc/*/@year,'/',$vptsDoc/*/@month,'/',$vptsDoc/*/@date,' ',$vptsDoc/*/@hour,':',$vptsDoc/*/@minute,':',$vptsDoc/*/@second)"/>
		<vpf:Msg>
			<xsl:copy-of select="/vpf:Msg/@*"/>
			<xsl:copy-of select="/vpf:Msg/vpf:Header"/>
			<vpf:Body>
				<xsl:copy-of select="/vpf:Msg/vpf:Body/*"/>
				<vpf:Payload Role="R" id="{$atom}" ts="{$vpts}">
					<xsl:call-template name="transform"/>
				</vpf:Payload>
			</vpf:Body>
		</vpf:Msg>
	</xsl:template>
	<xsl:template name="transform">
		<Fileout type="file">
			<xsl:for-each select="$msg/BOM/BO/OITM/*">
				<row>
					<col>
						<xsl:value-of select="ItemCode"/>
					</col>
					<col>
						<xsl:value-of select="ItemName"/>
					</col>
					<col>
						<xsl:value-of select="ItemType"/>
					</col>
				</row>
			</xsl:for-each>
		</Fileout>
	</xsl:template>
</xsl:stylesheet>

and, at last, the conversion XML to Text xslt script

<?xml version="1.0" encoding="UTF-8"?>
<FileOutbound>
    <segment id="Items">
        <field id="ItemCode" from="0" len="50" default="" justify="L" fillchar=""></field>
        <field id="ItemName" from="50" len="100" default="" justify="L" fillchar=""></field>
        <field id="ItemType" from="100" len="10" default="" justify="L" fillchar=""></field>
    </segment>
</FileOutbound>

Thanks a lot for your support.

Nicola

Attachments

overview.jpg (407.7 kB)