on 12-16-2010 12:03 AM
I have an outgoing SQL function that sends multiple rows of data for use in creating an IDOC in ECC. I am trying to key the creation of new IDOCs (already did the maxOccurs trick to the IDOC definition) based on a field in the JDBC return data...
JDBC Message Format...
SEGNAM - TRANS_ID - MATERIAL - VKORG...ETC
MARA - 00001 - 1234 - <space> - ...
MARC - 00001 - 1234 - VK01 - ...
MARA - 00002 - 9876 - <space> - ...
MAKT - 00002 - 9876 - <space> - material description - ...
Each time there is a new TRANS_ID, I need to indicate a new IDOC in the message mapping. I have tried all kinds of combinations of TRANS_ID --> dropContext --> splitValue and TRANS_ID --> collapseContext --> splitValue, but nothing has worked.
Has anyone done this kind of message map (without any BPM please)?
Thanks,
Nathan
Please use following logic:
TRANS_ID --> removeContext --> sort:ascending --> splitByValue:ValueChanged --> collapseContext --> IDOC
this would create one IDOC for every Trans_ID.
And for the other fields in every record, please use sortByKey and FormatByExample to group the records for every IDOC.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Nathan,
I have tried all kinds of combinations of TRANS_ID --> dropContext --> splitValue and TRANS_ID --> collapseContext --> splitValue, but nothing has worked.
Remember that you have placed a splitByValue just after you have removed the context of TRANS_ID. This would cause the mapping to only take the first value of the context. The right way would be
TRANS_ID --> removeContext --> sort:ascending --> splitByValue:ValueChanged --> collapseContext --> IDOC
The code above would ensure that there are no duplicate TRANS_ID whenever you are creating a new IDOC.
Hope this helps,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Mark,
Can I ask a follow up?
Your solution worked well, so that each unique TRANS_ID now creates one IDOC regardless of how many rows (other segments) are contained in the incoming data.
My question is, how do I now address each row for further mapping, i.e.
row 1 SEGNAM = MARA, TRANS_ID = 1, MATNR = 123...
row 2 SEGNAM = MARC, TRANS_ID = 1, MATNR = 123, WERKS = PL01...
row 3 SEGNAM = MARA, TRANS_ID = 2, MATNR = 987
Right now, if there are 2 TRANS_IDs in the incoming data, I get two IDOCs, but only access to the first 2 rows of data for mapping...even if there are other rows that should be part of the two IDOCs (e.g. other segments).
Thanks,
Nathan
Hello Nathan,
For this one, you have to play with contexts.
row 1 SEGNAM = MARA, TRANS_ID = 1, MATNR = 123...
row 2 SEGNAM = MARC, TRANS_ID = 1, MATNR = 123, WERKS = PL01...
row 3 SEGNAM = MARA, TRANS_ID = 2, MATNR = 987
This also depends on the occurrence of the parent node. example, if I want MATNR to be populated, the logic would be like
ex:
IDOC1..unbounded) (The logic is the already provided in an earlier response)
-->MATNR (1..1)
MATNR --------> removeContext ----------------> FormatByExample --> MATNR
TRANS_ID --> removeContext --> splitByValue:ValueChange --> /
If the rows are not in order of trans_id, then you need to incorporate sorting into the logic above.
Hope this helps,
Mark
Stefan,
Thanks for the help. I am following you suggestion and getting the segments to appear.
The top-level segment, MARA, is working perfectly. The problem is that the sub-segments, e.g. MARC, only appear in one of the two IDOCs/TRANS_ID in my sample file. How can I make sure that the sub-segments (MARC, MARD, etc) are processed for each TRANS_ID and appear in their respective IDOCs?
Thanks,
Nathan
Sample data (subset of columns, but with example keys of segnam, trans_id, and matnr):
MARA,1,TestPart1,ZASM,MFG,EA,10.000
MARC,1,TestPart1,NULL,NULL,NULL,NULL
MARD,1,TestPart1,NULL,NULL,NULL,NULL
MARD,1,TestPart1,NULL,NULL,NULL,NULL
MLAN,1,TestPart1,NULL,NULL,NULL,NULL
MTXL,1,TestPart1,NULL,NULL,NULL,NULL
MARA,2,TESTPART2,ZCOM,MFG,EA,1.000
MARC,2,TESTPART2,NULL,NULL,NULL,NULL
MARC,2,TESTPART2,NULL,NULL,NULL,NULL
MARD,2,TESTPART2,NULL,NULL,NULL,NULL
MARD,2,TESTPART2,NULL,NULL,NULL,NULL
MLAN,2,TESTPART2,NULL,NULL,NULL,NULL
MTXL,2,TESTPART2,NULL,NULL,NULL,NULL
Edited by: Nathan Leach on Dec 16, 2010 3:26 PM
Grasping at straws now...would swapping the SEGNAM and TRANS_ID field order help?
TRANS_ID, SEGNAM, MATNR, ...
1, MARA, MAT1...
1, MARC, MAT1...
2. MARA, MAT2...
2, MARC, MAT2...
I guess I don't really understand the process...I am used to much simpler mappings. Anything more info you can provide would be greatly appreciated.
Thanks,
Nathan
check this blog for the use of formatbyexample:
/people/stefan.grube/blog/2005/12/29/new-functions-in-the-graphical-mapping-tool-xi-30-sp13
check this blog for the use of ifwithoutelse and createif
/people/stefan.grube/blog/2006/01/09/the-use-of-suppress-in-the-xi-30-graphical-mapping-tool
You have to make sure, that the context of the targets are aligned.
The node functions splitbyvalue and removecontexts will help you.
Hi,
Have you tried the below logic:
Trans_ID>removeContect>SplitbyValue(Value change)>collapseContext>Idoc (0..unbounded)
-Rahul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nathan,
What are the occurrences of the following fileds and their hierarchy
SEGNAM
TRANS_ID
Have to tried with removeContexts node function?
Cheers,
Jag
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
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.