cancel
Showing results for 
Search instead for 
Did you mean: 

Message Mapping Issue on header level

Former Member
0 Kudos

HI all,

I am doing File to IDOC scenario where I am having issue wiht mapping :

Flat File

Row -0Unbound

FieldA1..1

FieldB1..1

IDOC

--

--Segment

---Field1

---Field2

-


Segment1

-


Field11

FieldA is Order number.. IDOCs will generate up on order numbers change... FieldB is discount... If Discount is avaliable in any of the order number then I need to Pass YES orelse NO... Segment is a header segment where I need to pass whether discount is YES or NO... Suppose there are 5 rows of same order with discount in 4 row then I need to pass YES if discount doesnt avaliable in all 5 rows then NO..

Row

--FieldA<123>

--FieldB<>

</Row>

Row

--FieldA<123>

--FieldB<>

</Row>

Row

--FieldA<123>

--FieldB<10>

</Row>

Row

--FieldA<222>

--FieldB<>

</Row>

Row

--FieldA<222>

--FieldB<>

</Row>

IDOC

--

--Segment

---Field1<123>

---Field2<YES>

-


Segment1

-


Field11

</IDOC>

IDOC

--

--Segment

---Field1<222>

---Field2<NO>

-


Segment1

-


Field11

</IDOC>

Any inputs how to get value on header level? I tried but I am able to get only first value..not drilling down to each value depending on order number?

Thanks

Rajeev.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Map Like bellow.

FieldB-------------------------FormatByExample--sort---collapsecontext--length--greater(constant(0))--Splitbyvalue(Each)---@
           FieldA--SplitByValue(ValueChange)--

@---if---then(constant(YES))--else(constant(NO))--Field2.

Sort:

Type of comparision: lexicographical(case insensitive)

Order: descenting

Regards,

Prakasu.M

Former Member
0 Kudos

Hi Prakasu,

Its working but there is one issue:

If one fo the discount value is 99.00 then I need to pass NO.. How can I achieve this? I used the UDF but it is taking only the highest value which is 99.00 but even if it is 99.00 I need to pass NO..

Suppose if first row discount is 99.00 and second row its 2,00 then I need to pass YES as it has 2,00 in the second row..

Row

--FieldA<123>

--FieldB

</Row>

Row

--FieldA<123>

--FieldB<99>

</Row>

Row

--FieldA<123>

--FieldB<>

</Row>

Row

--FieldA<222>

--FieldB<8>

</Row>

Row

--FieldA<222>

--FieldB

</Row>

IDOC

--

--Segment

---Field1<123>

---Field2<NO>

-


Segment1

-


Field11

</IDOC>

IDOC

--

--Segment

---Field1<222>

---Field2<YES>

-


Segment1

-


Field11

</IDOC>

First row value is 99 and Null it has to give NO as if discount has 99 then it should pass NO.. in the second order first row is 8 and second row is null.. it should give YES but it is giving NO becuase if is taking only the last value in the Context change..

Any inputs how to achieve this?

Thanks

Rajeev.

Edited by: rajeev raj on Nov 23, 2009 2:52 PM

Answers (3)

Answers (3)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi

Please give the occurrences of the IDOC fields too and then we can make suggestions...

Regards,

Former Member
0 Kudos

Hi Rajeev,


Row
--FieldA<123>
--FieldB
</Row>
Row
--FieldA<123>
--FieldB
</Row>
Row
--FieldA<123>
--FieldB<10>
</Row>

Row
--FieldA<222>
--FieldB
</Row>
Row
--FieldA<222>
--FieldB
</Row>
IDOC 
--
--Segment
---Field1<123>
---Field2<YES>
----Segment1
-----Field11
</IDOC>

IDOC 
--
--Segment
---Field1<222>
---Field2<NO>
----Segment1
-----Field11
</IDOC>

I think u can achieve this by using a UDF with category as ALL Values of a context.

In first for loop take all the Rows as an array and then compare the Field A values with all the remaining row values and then find out the odd ones then compare all the combination of FieldValueA and FieldValueB when ever there is change then pass YES value to IDOC segment and respective fieldA value..

Regards:

Amar Srinivas Eli

abhay_rajhans2
Contributor
0 Kudos

Hi

Use sort function. First sort field A then sort B field depending on A.

Write a simple UDF where UDF will check whether for particular value of A field if it is having B field then pass Yes.

Former Member
0 Kudos

HI,

I used sortby Graphical function .. and used UDF but I am getting only the first IDOC values.... reamining IDOCs I am not getting that field at all...

Any inputs please.

Thanks

Rajeev