on 05-20-2009 11:04 AM
Hi, I have an IDOC -> PI -> File simple scenario but I donu2019t know how to solve the following problem. I have to built my file header line with data from IDOC segments. That data comes from the same segment but different u201Cinstancesu201D and there is a field to identify the instances, something like that:
Source IDOC
Segment1 with parameter = 001
Segment1 with parameter = 002
Target FILE header line:
[segment1.001-field1];[segment1.002-field1]
The mapping checks the parameter value but generates an error because the 2nd field of the file is obligatory and when the mapping founds the 1st segment then it canu2019t continue searching the segment with parameter = 002 and complete the file line.
Sorry for my bad explanation, I hope you understand the problem.
Edited by: Marshal on May 20, 2009 12:04 PM
Hi Marshal
Here it is better to write one advanced(context) UDF so that to check all instances of the segment .
Thanks
Prasad Nemalikanti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marshal,
Can you give us the header line XML structure?
if it is something like this:
<Header>
<field1></field1>
<field2><field2>
</Header>
Then you can map using the IF condition in the mapping
parameter -> equals -> if without else -> field1
'001' -> data
and similarly for field2
parameter -> equals -> if without else -> field1
'002' -> data
Regards,
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The if condition is what I tried but it crashes because when it finish with the first segment it doesn't know how to go to the "next" to complete the line.
I tried to simplify in the first post but now I'm going to paste the complete XML test data (without unused fields):
<?xml version="1.0" encoding="UTF-8"?>
<DELVRY03>
<IDOC>
<E1EDL20>
<VBELN>VBELN</VBELN>
<E1ADRM1>
<PARTNER_Q>OSP</PARTNER_Q>
<PARTNER_ID>OSP_Partner</PARTNER_ID>
<NAME1>OSP_NAME1</NAME1>
<STREET1>OSP_STREET1</STREET1>
<POSTL_COD1>OSP_COD1</POSTL_COD1>
<CITY1>OSP_CITY1</CITY1>
</E1ADRM1>
<E1ADRM1>
<PARTNER_Q>WE</PARTNER_Q>
<PARTNER_ID>WE_Partner</PARTNER_ID>
<NAME1>WE_NAME1</NAME1>
<STREET1>WE_STREET1</STREET1>
<POSTL_COD1>WE_COD1</POSTL_COD1>
<CITY1>WE_CITY1</CITY1>
</E1ADRM1>
</E1EDL20>
</IDOC>
</DELVRY03>
As you can see the field "PARTNER_Q" is the parameter field to identify segments. My final file has to be like that:
OSP_PARTNER;OSP_NAME1;WE_PARTNER;WE_NAME1
The if condition is what I tried but it crashes because when it finish with the first segment it doesn't know how to go to the "next" to complete the line.
to make the if condition work for all the instances of <E1ADRM1>....the only thing that you need to do is in the mapping logic suggested by ravi just increase the context of the <PARTNER_Q> node on the source side and make it to point to <E1EDL20>...this will apply the logic for all the instances of E1ADRM1 in E1EDL20.....no need of any UDF
to make the if condition work for all the instances of <E1ADRM1>....the only thing that you need to do is in the mapping logic suggested by ravi just increase the context of the <PARTNER_Q> node on the source side and make it to point to <E1EDL20>...this will apply the logic for all the instances of E1ADRM1 in E1EDL20.....no need of any UDF
Hi abhishek,
I've done this but know the IF without els doesn't work. All the fields from the first E1ADRM1 instance are mapped to the file 2 times, and the 2nd E1ADRM1 data is not mapped right.
Here I post an example of target XML:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:OL_MT_Entrega xmlns:ns0="urn:general-optica-es:ol:entrega">
<Entrega>
<header>
<tipreg>01</tipreg>
<nument>vbeln</nument>
<codol>OSP_Partner</codol>
<nomol>OSP_NAME1</nomol>
<domol>OSP_STREET1</domol>
<pobol>OSP_CITY1</pobol>
<cpol>OSP_COD1</cpol>
<coddes>WE_Partner</coddes>
<nomdes>WE_NAME1</nomdes>
<domdes>WE_STREET1</domdes>
<pobdes>WE_CITY1</pobdes>
<cpdes>WE_COD1</cpdes>
</header>
</Entrega>
</ns0:OL_MT_Entrega>
PD: There is another positions part on target XML but 1st I have to solve the header mapping
use the below logic:
PARTNER_Q --- Exists
----And ----ifWithoutElse ------> header(i hope you want to repeat header)
PARTNER_Q --- equalS ---- Not Then(E1ADRM1)
Constant(keep it blank)
The two conditions applied on PARTNET_Q will check if there is a PARTNER_Q node andif it has any value i.e. it is not blank.....then map the E1ADRM1 (repeating source node) to the header node (if you want to map it to some other node then have that particular node....
Now here you may need to increase the Context of PARTNER_Q node
Do let me know if your mapping need is something else
Regards,
Abhishek.
Thanks abhishek but I still don't get it. I can't map E1ADRM1 to header node because I need to map data from E1EDL20 (parent node) into nument field.
I've done all what you say but the data of the 1st insance of E1ADRM1 is still mapping to all the target fields instead to map the 2ond instance on the fields finished with "*des".
Sorry, maybe I don't understand you completly...
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
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.