on 10-19-2006 3:44 AM
Hello all,
Please provide some helps to achieve the mapping scenario specified below:
I would like to map the Source Message to 2 Target Messages based on the value of <STATUS> ('G' or 'F'). And the 2 Target Messages will be later on used by 2 SEND steps to map them into 2 JDBC-format messages to insert 2 different tables (bulk insert).
Please tell me how to correctly configure the mapping scenario. I've tried to map them via graphical mapping(using "If without Else"), but didn't work when both 'G' and 'F' records exist in the Source Message.
<b>Source Message</b>
<XML>
<LOT> (0~unbounded)
<HEADER>
<STATUS> (1~1)
</HEADER>
<BODY>
<PO_NUM> (1~1)
</BODY>
</LOT>
</XML>
<b>Target Message</b>(same structure for both target messages)
<XML>
<LOT> (0~unbounded)
<STATUS> (1~1)
<PO_NUM> (1~1)
</LOT>
</XML>
Regards,
Steve
Steve,
Create 2 Message Types using the same Target Datatype and then create 2 Corresponding message Interfaces.
Now, in the mapping include both the target message types as your target messages and then do the needful in the mapping using ifwithoutelse.
Regards,
Bhavesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Steve,
Basically prakash and myself have given the same idea. In details
<u>Message Mapping</u>
Source Message -- MessageType1
MessageType2
Now, while mapping the Lot / Fields of the Message Type 1 , use the following logic
Source --Lot-- Status --
IFWITHOUTELSE --- Target Fields
Constant =f
Same logic for the Lot / Fields of Message Type 2 just the constant will change.
Regards,
Bhavesh
Bhavesh,
This mapping configurations is what I have, but if there are 'G' and 'F' records mixed in the Source Message, there would be a mapping error:
-
IF
Source/Lot/Status = Constant(G)
Then
Target1/Lot/PO_NUM = Source/Lot/PO_NUM
IF
Source/Lot/Status = Constant(F)
Then
Target2/Lot/PO_NUM = Source/Lot/PO_NUM
And somehow I had to include the configuration below;otherwise, the records won't be populated.
-
IF
Source/Lot/Status = Constant(G)
Then
Target1/Lot = Source/Lot
IF
Source/Lot/Status = Constant(F)
Then
Target2/Lot = Source/Lot
Regards,
Steve
Hi Steve,
Lets take the following eg:
Source_MT
-RecordSet
--Field1
--Status
Target1_MT
-RecordSet
--Field1
--TStatus
Target2_MT
-RecordSet
--Field1
--TStatus
Your mapping should be
Status
Equals --> IFWithoutElse --Target1_MT/RecordSet
/ /
Constant("F") Source_MT/RecordSet
Simillarly
Status
Equals --> IFWithoutElse --Target2_MT/RecordSet
/ /
Constant("G") Source_MT/RecordSet
Try this and let me know
Regards,
Prakash
Hi Prakash,
Thanks for the response. Here are what I've found with your suggestion.
<b>1)</b>
I still need to map the following, since their occurences are "1..1":
Field1 -> Field1
Status -> TStatus
<b>2)</b>
The error remains the same:
Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd.
3)
I've even tried 1:1 mapping, but the error remains the same whenever there are 'G' & 'F' records mixed in the Source_MT.
Regards,
Steve
Hi Prakash,
Here are the configurations that I have for 1:1 mapping. (only mapping records with 'G' Status to Target_MT as a workaround for 1:2 mapping, but this still doesn't work. Whenever there are 'G' & 'F' records co-exist, a mapping error is caused.) Please take a look at them.
Source_MT
-Header
--VendorCode (1..1)
--Contact (1..1)
-Body
--Lot (0..unbounded)
---PoNum (1..1)
---Status (1..1)
Target_MT
-Header
--VendorCode (1..1)
--Contact (1..1)
-Body
--Lot (0..unbounded)
---PoNum (1..1)
---Status (1..1)
Target_MT/Header/VendorCode = Source_MT/Header/VendorCode
Target_MT/Header/Contact = Source_MT/Header/Contact
IF Status Equals Constant("G")
Then Target_MT/Body/Lot = Source_MT/Body/Lot
IF Status Equals Constant("G")
Then Target_MT/Body/Lot/PoNum = Source_MT/Body/Lot/PoNum
IF Status Equals Constant("G")
Then Target_MT/Body/Lot/Status = Source_MT/Body/Lot/Status
Regards,
Steve
Hi Prakash,
<i>You need to change the context of the Status to root level I mean to Messages level.</i>
Which level specifically regarding my XML structure?
<i>If the payload has both G and F fine... what is it has either G or F? I hope you are handling that as well.</i>
The situation now is, if the payload has both G and F records, the mapping would show the message:<b>Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd.</b> If it only has either G or F records, the mapping is fine.
Regards,
Steve
Hi Prakash,
Do you mean to perform the changes below? It still doesn't work.
Target_MT
-Header
--VendorCode (1..1)
--Contact (1..1)
-Body
--Lot (0..unbounded)
---PoNum (1..1)
---Status (1..1)
to
Target_MT
-Header
--VendorCode (1..1)
--Contact (1..1)
-Lot (0..unbounded)
--PoNum (1..1)
--Status (1..1)
Regards,
Steve
Hi Steve,
The best way to find out what difference the Context Change makes to output of mapping is to Test the Mapping and then go to the step -> Right click -> Display Queue.
Also check this link http://help.sap.com/saphelp_nw04/helpdata/en/bd/ca1105c81c6742a0f8c8d49f8834bf/content.htm
It explains the concept of Contexts and their use in mapping
Hope this helps.
Regards,
Seema
Hi Steve,
method that I specified is:
mapping1 = source -> target1
mapping2 = source -> target2
in interface determination use the interface and give the 'Condition' for it. then select the correct mapping. In this approach you do not need to create IF or context object in DESIGN. All the work can be done in CONFIG.
Otherwise you can use other methods provided above i.e. using IfWithoutElse in mapping or context.
Regards,
Faiq
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Steve,
The easiest way would be to create the 2 message mappings. Put the required condition 'G' or 'F' in the interface determination in Config.
It will link to the required mapping depending on your condition.
Hope it helps.
Regards,
Faiq
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Steve,
How are you doing this? Is it using multimapping?
Try this
1. You should me already defined a target structure say MT_Targ and now copy that message type and create one more with a different name MT_Targ2
2.You wil be having 2 Inbound Interface 1 having MT_Targ and the other with MT_Targ2
3. In the message mapping got to the message tab and in the target side add MT_Targ2 also
4. Do the mapping with IFWihoutElse. Also make sure the same condition should also be applied while mapping MT_Src>Mt_Targ and MT_Src>MT_Targ2
5. Do the respective change in the interface mapping.
Regards,
Prakash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prakash,
<i>4. Do the mapping with IFWihoutElse. Also make sure the same condition should also be applied while mapping MT_Src>Mt_Targ and MT_Src>MT_Targ2</i>
Could you specify the mapping details? Cuz' what I have didn't work.
<i>5. Do the respective change in the interface mapping.</i>
What kind of change?
Regards,
Steve
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.