on 03-01-2010 2:19 PM
Hi friends,
I have problem when generate multiple Idocs (FIDCC1) an multiple positions based on an External Definition for a SQL Server table. I have selected all fields from this table from a SELECT into the JDBC configuration.
My mapping is like this:
DWCAJA.ResultSet 1..1
IDOC.
Thats ok and generate n IDOCs by every change of PK.
The problem is when i want to map positions because i dont have any field in source message to identify the number of positions to map with E1FISEG.
If I have two differents Pks and n rows, the result of testing is as folow:
FIDCC1
IDOC
E1FIKPF
E1FISEG
E1FISEG
IDOC
E1FIKPF
(?)
I cant obtain n BSEG segments according PK. I've mapped and all fields of row segment but those are created in the first IDOC node only,
Any suggestions?
Regards,
Pablo.-
UseOneAsMany Standard function. If this doesnt fit your requirement, you can write a UDF to create context according to your requirement.
Sample Code:
for(int i = a.length-1; i < b.length; i++)
{
result.addValue(a[0]);
result.addContextChange();
}
Regards,
Praveen Gujjeti.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The problem is I have many fields in source message and UseOneAsMany Standard function doest work for this case.
I think the issue is how connect <row> node with E1FISEG segment to generate many segments for any rows. When te pk have changed, y need to generate another Idocs with many positions of BSEG.
Important: Primary key : DWSucCod + DWCajSec
Payload:
- <row>
<DWSucCod>11</DWSucCod>
<DWCajSec>1</DWCajSec>
<DWCtaConCo>1100001</DWCtaConCo>
<DWRecImp>100</DWRecImp>
</row>
- <row>
<DWSucCod>11</DWSucCod>
<DWCajSec>1</DWCajSec>
<DWCtaConCo>1100002</DWCtaConCo>
<DWRecImp>200</DWRecImp>
</row>
Result:
IDOC
E1FIKPF
E1FISEG
hkont :1100001
dmbtr : 100
E1FISEG
hkont :1100002
dmbtr : 200
Payload:
- <row>
<DWSucCod>11</DWSucCod>
<DWCajSec>1</DWCajSec>
<DWCtaConCo>1100002</DWCtaConCo>
<DWRecImp>200</DWRecImp>
</row>
- <row>
<DWSucCod>12</DWSucCod>
<DWCajSec>1</DWCajSec>
<DWCtaConCo>1100003</DWCtaConCo>
<DWRecImp>300</DWRecImp>
</row>
Result:
IDOC
E1FIKPF
E1FISEG
hkont :1100002
dmbtr : 200
IDOC
E1FIKPF
E1FISEG
hkont :1100001
dmbtr : 300
Payload:
- <row>
<DWSucCod>11</DWSucCod>
<DWCajSec>1</DWCajSec>
<DWCtaConCo>1100001</DWCtaConCo>
<DWRecImp>100</DWRecImp>
</row>
- <row>
<DWSucCod>11</DWSucCod>
<DWCajSec>1</DWCajSec>
<DWCtaConCo>1100002</DWCtaConCo>
<DWRecImp>200</DWRecImp>
</row>
- <row>
<DWSucCod>12</DWSucCod>
<DWCajSec>1</DWCajSec>
<DWCtaConCo>1100003</DWCtaConCo>
<DWRecImp>300</DWRecImp>
</row>
Result:
IDOC
E1FIKPF
E1FISEG
hkont :1100001
dmbtr : 100
E1FISEG
hkont :1100002
dmbtr : 200
IDOC
E1FIKPF
E1FISEG
hkont :1100003
dmbtr : 300
Luis,
In your case, BKPF and BSEG nodes are at the same level, in my case i'm using the Idoc structure and the structure of the target message is standard.
Your case:
IDOC
--->BKPF
-->-BSEG
In Idoc case:
IDOC
--->BKPF
->->BSEG
I dont did anything with the key, my source message is an esternal definition and I dont have the posibility to change the structure, but I dont knoe if you refer that. I dont know how to change the context of the PK.
Hi Pablete
I have the IDOC 1.. to unbounded.
I put the complete logic.
Concat(DWCajSec+DWSucCod)----SplitByValue(value change)-CollapseContext--->IDOC
constant -
> E1FIKPF
Concat(DWCajSec+DWSucCod) -
SplitByValue(value change)------E1FISEG
DWCtaConCo.....>>hkont
DWRecImp........>>dmbtr.
DWCajSec+DWSucCod -- change the contex for each element and for both target.
If you still has the problem with the change context so put the function remove context after concat function, but i don't think this it the problem.
Edited by: Luis Ortiz on Mar 2, 2010 10:51 AM
I've chagend the context of DWCajSec and DWSucCod and it's works!!!!!
My map:
N different Idocs depending primary key
DWSucCod---
DWCajSec -
concat -
sort----splitbyvalue(value change)-collapsecontext----IDOC
Constant---E1FIKPF
E1FISEG segment
DWSucCod---
DWCajSec -
concat -
sort----splitbyvalue(value change)--IDOC
HKONT-----HKONT
DMBTR-----DMBTR
.......
It's important when select data from SQL table, use the sentence ORDER BY to map exactly each position to corresponding E1FISEG node.
Thanks a lot!
Edited by: Pablete on Mar 3, 2010 2:29 PM
Hi,
Try using SortByKey, SplitByValue while mapping target fields. You must be able to achieve the result by playing around with the functions. All the best.
Regards,
Vineetha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
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.