on 03-16-2008 1:27 PM
Hello,
I have the following scenario.
Source File
<ORDER>
<ITEMS>
<ITEM>
<NUM>10</NUM>
...
<CONDITIONS>
<CONDITION>
<TYPE>T1</TYPE>
<VALUE>V1</VALUE>
</CONDITION>
<CONDITION>
<TYPE>T2</TYPE>
<VALUE>V2</VALUE>
</CONDITION>
</ITEM>
</ITEMS>
</ORDER>
I have to map this to an IDOC with the structure
<E1BPITEM>
<NUM>10</NUM>
</E1BPITEM>
<E1BPCOND>
<NUM>10</NUM>
<TYPE>T1</TYPE>
<VALUE>V1</VALUE>
</E1BPCOND>
<E1BPCOND>
<NUM>10</NUM>
<TYPE>T2</TYPE>
<VALUE>V2</VALUE>
</E1BPCOND>
I am using graphical mapping. everything works well until I have an order with no conditions at all.
in that case in all subsequent orders the NUM fields are mapped incorrectly.
my mapping:
<NUM> ... THIS IS MY PROBLEM
<TYPE> (in context items) -> exists -> createif -> E1BPCOND
<TYPE> (in context items) -> splitbyvalue (each) ->TYPE
<VALUE> (in context items) -> splitbyvalue (each) ->VALUE
Do I need a UDF or can I solve this using graphical mapping? I have never written a UDF that uses Reultlist. what do I need to know?
Thanks,
Yoni
Hi Raj,
Thanks, but it's still the same problem. instead of 20,30,40 I get 30,40,nothing.
I attached a picture of 3 queues: UDF, cond_type, cond_value
http://sap-xi.co.il/sap_xi.JPG
Thanks,
Yoni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Yoni,
What I would do is use a nice mapping sandwich. Use two mappings in the Interface Mapping.
The first mapping will work on the same message, just making it simpler to handle.
The second mapping will be the map you already have, actually creating the IDOC.
Use the first mapping would create a conditions node for every item. One way of doing that is creating a new message type, which has the conditions element mandatory.
I'm sure there are other ways you can think of but that's the simplest one.
Now, you have a much simpler message to handle, which your existing map can probably handle with no problems.
The interface mapping will look like this:
Source message -> Pre-Mapping -> Interm. Message
Your-Mapping -> IDOC
(The interface mapping will have two rows in the mapping section )
Good luck!
Roy
Wow... that was a hard one!
I solved it using Roy's idea of 2 mappings. in the first one I added a COND_NUM field and populated it using useoneasmany if exists.
in the second one I mapped COND_NUM just as I did COND_TYPE and COND_VAL.
and.. it works!
I also learned the advanced UDF (queue) which I never did before although in the end I didn't have to use it.
Thanks to everyone and especially Roy.
Yoni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the helpful answer. It looks nicer than my graphical mapping but still the same problem. When there is an order with no conditions one SUPPRESS is added to condition type and value queues but not to the NUM queue.
Source XSD:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="com:post:sd:sales" targetNamespace="com:post:sd:sales">
<xsd:element name="sales_new_MT" type="sales_new_DT" />
<xsd:complexType name="sales_new_DT">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
e1cb7e20f38211dcb9b00019bb2d97c0
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="FILE_HEADER">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
2af82de0557311dccef00019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="SYS_CODE" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
2af82de1557311dc87e70019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="HAFK_CASH" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c00771411dcc5c80019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="HAFK_CH" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c01771411dcbef00019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="HAFK_CR" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c02771411dc8ecf0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="SUM_NO_ORD" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c03771411dcb4f00019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="WORK_DATE" type="xsd:date">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c04771411dc8f860019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="MAAZAN" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c05771411dc8b240019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="SNIF" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c06771411dcbe960019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="ASHNAV" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c07771411dcc16e0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ORDERS">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
2af82de4557311dcb4530019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ORDER" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
2af82de5557311dcb61a0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="SERV_DATE" type="xsd:date" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
2af82de6557311dccabe0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="PRICE_DATE" type="xsd:date" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
2af82de7557311dca7f20019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="SNIF" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
2af82de8557311dcc78b0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="ASHNAV" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c08771411dc8b350019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="ORDER_ID" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c09771411dcbfef0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="USER_ID" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c0a771411dca75c0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="INVOICE" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c0b771411dcc40f0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="ORD_TYPE" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c0c771411dccc710019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="ORD_TEXT" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c0d771411dcb34c0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="MAAM_ORDER" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
6d52d3f0ac7811dca1640019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="CUSTOMERS">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
2af82de9557311dca4d70019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CUSTOMER" minOccurs="0" maxOccurs="10">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
2af82dea557311dc9f370019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="PARTN_ROLE" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
2af82deb557311dc93ef0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="PARTN_NUMB" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
2af82dec557311dc98400019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="NAME" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c0e771411dc8c650019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="COUNTRY" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c0f771411dc9e620019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="CITY" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c10771411dc856a0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="POST_CODE1" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c11771411dcb0840019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="STREET" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c12771411dc91cd0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="HOUSE" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c13771411dc964f0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ITEMS">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
2af82ded557311dc94570019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ITEM" maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
2af82dee557311dc9bbd0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CONDITIONS" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
ab4c79b0ac7111dc9f0e0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CONDITION" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
ab4c79b1ac7111dccbef0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="COND_TYPE" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
4379b3c0ac7611dc8f8f0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="COND_VAL" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
4379b3c1ac7611dc80610019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CNDS" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9fca6e70ce7d11dcb57a0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CND" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9fca6e71ce7d11dc88aa0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CNDT" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9fca6e72ce7d11dcb18a0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="CNDV" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9fca6e73ce7d11dcb4760019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="MKT_SAP" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
2af82def557311dca2150019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="NUM" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
844eb460c37611dc97ff0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="ITEM_CATEG" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c14771411dca0a30019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="QTY" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c15771411dcbf590019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="LEGACY" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c16771411dcb8e20019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="STOCK" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
6d4040e0ac7911dc8caf0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="MAAM_ITEM" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
2af82df2557311dc921c0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="ITEM_TEXT" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c19771411dc96fa0019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="REF_NUMBER" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
987d6c1a771411dcce450019bb5c48d9
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Target XSD is IDOC SALESORDER_CREATEFROMDAT2.SALESORDER_CREATEFROMDAT202
with maxoccurs changed for multiple idoc scenario.
sample file (2 orders , first with no conditions and second with 3 conditions):
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<ns0:sales_new_MT xmlns:ns0="com:post:sd:sales">
<FILE_HEADER>
<WORK_DATE>20080310</WORK_DATE>
<SYS_CODE>Z02</SYS_CODE>
</FILE_HEADER>
<ORDERS>
<ORDER>
<SERV_DATE>20080310</SERV_DATE>
<SNIF>101</SNIF>
<ASHNAV>131</ASHNAV>
<ORDER_ID>20080310101</ORDER_ID>
<USER_ID>40076416</USER_ID>
<ORD_TYPE>ZOR1</ORD_TYPE>
<MAAM_ORDER>A</MAAM_ORDER>
<CUSTOMERS>
<CUSTOMER>
<PARTN_ROLE>AG</PARTN_ROLE>
<PARTN_NUMB>40000001</PARTN_NUMB>
</CUSTOMER>
</CUSTOMERS>
<ITEMS>
<ITEM>
<NUM>10</NUM>
<MKT_SAP>Z230000163</MKT_SAP>
<QTY>1</QTY>
<LEGACY>163</LEGACY>
<MAAM_ITEM>1</MAAM_ITEM>
</ITEM>
</ITEMS>
</ORDER>
<ORDER>
<SERV_DATE>20080310</SERV_DATE>
<SNIF>101</SNIF>
<ASHNAV>301</ASHNAV>
<ORDER_ID>20080310101</ORDER_ID>
<USER_ID>32547747</USER_ID>
<ORD_TYPE>ZOR1</ORD_TYPE>
<MAAM_ORDER>A</MAAM_ORDER>
<CUSTOMERS>
<CUSTOMER>
<PARTN_ROLE>AG</PARTN_ROLE>
<PARTN_NUMB>40000001</PARTN_NUMB>
</CUSTOMER>
</CUSTOMERS>
<ITEMS>
<ITEM>
<NUM>10</NUM>
<MKT_SAP>Z220000060</MKT_SAP>
<QTY>1</QTY>
<LEGACY>160</LEGACY>
<MAAM_ITEM>1</MAAM_ITEM>
</ITEM>
<ITEM>
<NUM>20</NUM>
<MKT_SAP>Z220000071</MKT_SAP>
<QTY>1</QTY>
<LEGACY>171</LEGACY>
<MAAM_ITEM>1</MAAM_ITEM>
<CONDITIONS>
<CONDITION>
<COND_TYPE>ZST1</COND_TYPE>
<COND_VAL>433.67</COND_VAL>
</CONDITION>
</CONDITIONS>
</ITEM>
<ITEM>
<NUM>30</NUM>
<MKT_SAP>Z220000074</MKT_SAP>
<QTY>6</QTY>
<LEGACY>174</LEGACY>
<MAAM_ITEM>1</MAAM_ITEM>
<CONDITIONS>
<CONDITION>
<COND_TYPE>ZST1</COND_TYPE>
<COND_VAL>1296.33</COND_VAL>
</CONDITION>
</CONDITIONS>
</ITEM>
<ITEM>
<NUM>40</NUM>
<MKT_SAP>Z220000075</MKT_SAP>
<QTY>10</QTY>
<LEGACY>175</LEGACY>
<MAAM_ITEM>1</MAAM_ITEM>
<CONDITIONS>
<CONDITION>
<COND_TYPE>ZST1</COND_TYPE>
<COND_VAL>17221.00</COND_VAL>
</CONDITION>
</CONDITIONS>
</ITEM>
<ITEM>
<NUM>50</NUM>
<MKT_SAP>Z220000076</MKT_SAP>
<QTY>41</QTY>
<LEGACY>176</LEGACY>
<MAAM_ITEM>1</MAAM_ITEM>
</ITEM>
</ITEMS>
</ORDER>
</ORDERS>
</ns0:sales_new_MT>
Thanks,
Yoni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
My source file looks like this:
<ORDERS>
<ORDER>
<ITEMS>
<ITEM>
<NUM>10</NUM>
<MKT_SAP>Z230000163</MKT_SAP>
<QTY>1</QTY>
<LEGACY>163</LEGACY>
<MAAM_ITEM>1</MAAM_ITEM>
</ITEM>
</ITEMS>
</ORDER>
<ORDER>
<ITEMS>
<ITEM>
<NUM>10</NUM>
<MKT_SAP>Z220000060</MKT_SAP>
<QTY>1</QTY>
<LEGACY>160</LEGACY>
<MAAM_ITEM>1</MAAM_ITEM>
</ITEM>
<ITEM>
<NUM>20</NUM>
<MKT_SAP>Z220000071</MKT_SAP>
<QTY>1</QTY>
<LEGACY>171</LEGACY>
<CONDITIONS>
<CONDITION>
<COND_TYPE>ZST1</COND_TYPE>
<COND_VAL>433.67</COND_VAL>
</CONDITION>
</CONDITIONS>
</ITEM>
<ITEM>
<NUM>30</NUM>
<MKT_SAP>Z220000074</MKT_SAP>
<QTY>6</QTY>
<LEGACY>174</LEGACY>
<CONDITIONS>
<CONDITION>
<COND_TYPE>ZST2</COND_TYPE>
<COND_VAL>1296.33</COND_VAL>
</CONDITION>
</CONDITIONS>
</ITEM>
<ITEM>
<NUM>40</NUM>
<MKT_SAP>Z220000075</MKT_SAP>
<QTY>10</QTY>
<LEGACY>175</LEGACY>
<MAAM_ITEM>1</MAAM_ITEM>
<CONDITIONS>
<CONDITION>
<COND_TYPE>ZST3</COND_TYPE>
<COND_VAL>17221.00</COND_VAL>
</CONDITION>
</CONDITIONS>
</ITEM>
<ITEM>
<NUM>50</NUM>
<MKT_SAP>Z220000076</MKT_SAP>
<QTY>41</QTY>
<LEGACY>176</LEGACY>
<MAAM_ITEM>1</MAAM_ITEM>
</ITEM>
<ITEM>
<NUM>60</NUM>
<MKT_SAP>Z220000077</MKT_SAP>
<QTY>43</QTY>
<LEGACY>177</LEGACY>
<MAAM_ITEM>1</MAAM_ITEM>
</ITEM>
</ITEMS>
</ORDER>
</ORDERS>
In the target IDOC I should be getting 3 E1BPCOND for the second IDOC for NUM 20, 30 and 40. 1 condition for each item num.
What I am actually getting is 3 E1BPCOND in which the NUM is 30, 40 and nothing instead of 20,30,40.
<?xml version="1.0" encoding="UTF-8"?>
<SALESORDER_CREATEFROMDAT202>
<IDOC BEGIN="1">
<E1SALESORDER_CREATEFROMDAT2 SEGMENT="1">
... No conditions here. this is OK
</E1SALESORDER_CREATEFROMDAT2>
</IDOC>
<IDOC BEGIN="1">
<E1SALESORDER_CREATEFROMDAT2 SEGMENT="1">
<E1BPSDHD1 SEGMENT="1">
...
</E1BPSDHD1>
<E1BPSDITM SEGMENT="1">
<ITM_NUMBER>10</ITM_NUMBER>
<MATERIAL>Z220000060</MATERIAL>
<PLANT>1000</PLANT>
<TAX_CLASS1>1</TAX_CLASS1>
<E1BPSDITM1 SEGMENT="1">
<CUST_MAT35>160</CUST_MAT35>
</E1BPSDITM1>
</E1BPSDITM>
<E1BPSDITM SEGMENT="1">
<ITM_NUMBER>20</ITM_NUMBER>
<MATERIAL>Z220000071</MATERIAL>
<PLANT>1000</PLANT>
<TAX_CLASS1>1</TAX_CLASS1>
<E1BPSDITM1 SEGMENT="1">
<CUST_MAT35>171</CUST_MAT35>
</E1BPSDITM1>
</E1BPSDITM>
<E1BPSDITM SEGMENT="1">
<ITM_NUMBER>30</ITM_NUMBER>
<MATERIAL>Z220000074</MATERIAL>
<PLANT>1000</PLANT>
<TAX_CLASS1>1</TAX_CLASS1>
<E1BPSDITM1 SEGMENT="1">
<CUST_MAT35>174</CUST_MAT35>
</E1BPSDITM1>
</E1BPSDITM>
<E1BPSDITM SEGMENT="1">
<ITM_NUMBER>40</ITM_NUMBER>
<MATERIAL>Z220000075</MATERIAL>
<PLANT>1000</PLANT>
<TAX_CLASS1>1</TAX_CLASS1>
<E1BPSDITM1 SEGMENT="1">
<CUST_MAT35>175</CUST_MAT35>
</E1BPSDITM1>
</E1BPSDITM>
<E1BPSDITM SEGMENT="1">
<ITM_NUMBER>50</ITM_NUMBER>
<MATERIAL>Z220000076</MATERIAL>
<PLANT>1000</PLANT>
<TAX_CLASS1>1</TAX_CLASS1>
<E1BPSDITM1 SEGMENT="1">
<CUST_MAT35>176</CUST_MAT35>
</E1BPSDITM1>
</E1BPSDITM>
<E1BPSDITM SEGMENT="1">
<ITM_NUMBER>60</ITM_NUMBER>
<MATERIAL>Z220000077</MATERIAL>
<PLANT>1000</PLANT>
<TAX_CLASS1>1</TAX_CLASS1>
<E1BPSDITM1 SEGMENT="1">
<CUST_MAT35>177</CUST_MAT35>
</E1BPSDITM1>
</E1BPSDITM>
...
<E1BPCOND SEGMENT="1">
<ITM_NUMBER>30</ITM_NUMBER>
*This is the Problem!!! should be 20
<COND_TYPE>ZST1</COND_TYPE>
<COND_VALUE>43.3670</COND_VALUE>
</E1BPCOND>
<E1BPCOND SEGMENT="1">
<ITM_NUMBER>40</ITM_NUMBER>
*This is the Problem!!! should be 30
<COND_TYPE>ZST2</COND_TYPE>
<COND_VALUE>129.6330</COND_VALUE>
</E1BPCOND>
<E1BPCOND SEGMENT="1">
*This is the Problem!!! there is no ITM_NUMBER here. should be 40
<COND_TYPE>ZST3</COND_TYPE>
<COND_VALUE>1722.1000</COND_VALUE>
</E1BPCOND>
</E1SALESORDER_CREATEFROMDAT2>
</IDOC>
</SALESORDER_CREATEFROMDAT202>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Yoni,
For this kid of thing you have to go for UDF. This UDF is to match the ITM_NUMBER of segment E1BPCOND only
Create UDF with cache paramtere Queue, then pass
NUM (as A)----
> UDF -
>ITM_NUMBER
COND_TYPE (as B)-> mapWithDefault(pass [])->
for(int i = 0; i<B.length; i++)
{
if(B<i> != "")
{
result.addValue(A<i>);
result.addContextChange();
}
}
Note : There may be some changes required on the precise logic that you might be looking for.
If you could share the XSD files of both source side and target side then Probably here it will be easy to try-out the excat logic on our XI system.
Thanks
Swarup
Yoni,
Try this and let me know if it helps! Since I don't have system right now, couldn't able to check it.
NUM [Context- ORDERS] --------->1
COND_TYPE[Context - ITEM]---->MapWithDefault["No Value"]----->RemoveContext----->2
1 & 2 --------->UDF-------->ITM_NUMBER
UDF Advanced ( Queue , two inputs)
Let's consider my input argument names are num , cond_type
for(int i=0;i<num.length;i++)
{
if(!cond_type<i>.equals("No Value"))
{
result.addValue(""+num<i>+"");
result.addContextChange();
}
}
Hope it helps!
raj.
Hi,
Of course I've tried using it. the problem is that NUM always exists while TYPE does not and tha'ts way the contexts get mixed up
Yoni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Yoni,
Then have you tried with using the Root node field that have mapped with target side E1BPCOND in place of TYPE.
If the existance of TYPE filed is not fixed then there should be some filed available as for reference that the structre E1BPCOND will exists or not. Without this kind of reference you can't do anything with even UDF also.
Thanks
swarup
Hi,
Here As per my understanding you need to generate the multiple nodes of <NUM> with same value for each <CONDITION>
I think you could achieve this without UDF also with using API useOneAsMany.
NUM->useOneAsMany->SplitByValue--->NUM
TYPE-->
TYPE-->
Refer
http://help.sap.com/saphelp_nw04/helpdata/en/ee/bf9640dc522f28e10000000a1550b0/frameset.htm
Thanks
Swarup
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.