on 10-29-2015 1:43 PM
Hi Everyone,
I've an issue with my IDoc to Flat File scenario. I would appreciate any advice you could give on this.
I have mapped IDoc SHPORD|DELVRY06 to produce a fixed length flat file output. The IDoc's are collected in SAP and sent out to PI. We are appending all the IDocs sent out to one flat file.
For every IDoc line segment E1EDL24 we need one line in the flat file output. This works fine. (E1EDL24 ->removeContexts>Record)
The problem I have is grouping the lines in the flat file. Currently the output comes out like:-
<Transaction><Key><Material> <Quantity>
AB809MAT1 20
AB813PRD1 15
AB809MAT1 20
AB814PRD2 12
AB813PRD1 15
AB999ITM1 10
AB809MAT1 25
But the requirement is to have the output group (rolled up) by <Transaction><Key><Material> <Quantity> as follows:-
AB809MAT1 65
AB813PRD1 30
AB814PRD2 12
AB999ITM1 10
Do i need to perform another mapping step ? Or is there I way I can achieve this within the existing mapping ? I've searched around but for some reason can't seem to find this scenario. Any help would be greatly appreciated.
Thanks for your time.
JE
Hi Sritharan,
Thanks for your time.
Still not working. I'll describe a bit further. I've mapped the IDoc fine - so now I'm going to use another message mapping to format the flat file output.
The Message type looks like this:
<Record>
--<Transaction>
--<Key>
--<Material>
--<Quantity>
In order to group the output my mapping looks like this. I've concatenated Transaction,Key and Material to give me a KeyValue since we want a new record when this changes.
To sum the quantity for every record I need to formatByExample when mapping Quantity right ?
<Record>KeyValue-> removeContexts->sort->SplitValue(ValueChange)->collapseContexts-> <Record>
<Transaction> ----> <Transaction>
<Key> ---> <Key>
<Material> ----> <Material>
<Quantity>
Quantity->removeContexts-> formatbyExample->UDF(Add)-><Quantity>
KeyValue-> removeContexts->sort->SplitValue(ValueChange) ->
This doesn't work. The problem is relating the KeyValue and the Quantity - the Quantity doesnt stay with the Keyvalue.
I've attached screenshots below. Input show's 4 records and Output Shows 3 records which correct since we want to group where the KeyValue is the same (duplicated) however the Quantities are not in the right context.
My output should be:
AB
813
PRD1
15
AB
809
MAT1
45
AB
999
ITM1
10
Thanks for your support.
JE
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Sritharan,
I have tried with sortByKey but i cannot see a way to make it work.
The problem is with the other fields in the Record - i can't link them to the KeyValue (which I'm using to create one idoc per KeyValue so duplicates are not created)
So linking AB809MAT1 to the following:-
AB
809
MAT1
20
etc.
isn't looking possible for me at this stage. I will try looking into UDF maybe.
Thanks for your help
Hi all,
I've resolved this issue. I was not using the sort by key function correctly - Once I resolved the mapping and used the UDF (to add values in a context) from Sritharan my solution is now working perfectly. The solution is pretty straight forward once I got my thinking correct.
I would like to thank everyone for taking the time to help me here; particularly Sritharan for his effort in doing his utmost to help out.
So based on the above and for the record the correct mapping is as follows:
Thanks
JE
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Joel,
Requirment is little bit confusing.
You wish to collect the line items for a particular idoc.?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Sritharan,
That's excellent - it's almost there.
My last issue is with the context changes
Keyfield---->SortFunction--->split by value(valuechange)------>Collapsecontexts..
I have mapped this to the Record node under which my fields are.
It's not grouping exactly right. So for this example i'm testing the output in the message mapping test tab.
AB813PRD1 15
AB809MAT1 20
AB814PRD2 12
AB999ITM1 10
AB809MAT1 25
The resulting output is :
AB809MAT1 45
AB809MAT1 25
AB813PRD1 15
AB814PRD2 12
I would expect :
AB809MAT1 45
AB813PRD1 15
AB814PRD2 12
AB999ITM1 10
It appear to be pushing the contexts out by one. So instead of showing AB809MAT1 45 just once in the output it's showing twice - the first one has the total value while the next one is the original value.
When I display queue on CollapseContexts the sorting etc. looks fine - just the resulting output doesn't look like this.
I think something small is off here.
Thanks very much for your help on this.
JE
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.