cancel
Showing results for 
Search instead for 
Did you mean: 

JDBC to IDOC scenario - Mapping problem with E1FIBSEG

Former Member
0 Kudos

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.-

Accepted Solutions (1)

Accepted Solutions (1)

former_member181985
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Pablete

Can you put a payload example and the result that you want to get?

how do you populate your target element ( E1F1SEG)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Pablete

Please try this. it works.

DWSucCod (change context - row)---

DWCajSec (change context- row)--->concat ->splitByValue(valueChange)->collapseContext--IDOC(node)

DWSucCod (change context - row) ---

DWCajSec (change context- row)----->concat ->splitByValue(valueChange)->E1FISEG(node)

Former Member
0 Kudos

Luis, I try this, but foy every new PK, generates all BSEG segments into the first IDOC node, if there are two PKs, first IDOC node have two BSEG and the second none, is empty.

Former Member
0 Kudos

Hi Pablete.

Check on this link also check the results.

[IDOC - Mapping|http://www.imaxenes.com/imagen/idoc_row1ba12jn.jpg.html]

Former Member
0 Kudos

Hi Luis,

I tried but doesn't works. I do the same mapping but generates 3 IDOCs nodes, not separates properly IDOC and BSEG positions, but I have a question, how did you do the mapping in <row> node in the source and E1FIKPF in target message?

Thanks a lot!

Former Member
0 Kudos

Hi Pablete

I not use the row for the mapping.Because the creation of IDOC depends of KEY(DWSucCod+DWCajSec)

The element E1FIKPF only I put a constant because in your example don't have a value.

One question, Did you change the context for the KEY?

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Pablete

I made the change the E1FISEG under E1FIKPF Segment and it works correctly with the same logic

To change the context.. only clik right on the element DWSucCod and the other you can see a popup menu and choose the section context then choose row.

Former Member
0 Kudos

I did the same logic but doesn't works. In my case I have the node IDOC 1..unbounded, if I put IDOC 1..1 not generates more than 1 IDOC.

I dont know what can I do......

Former Member
0 Kudos

The KEY is in the context of row node.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Answers (1)

Answers (1)

Former Member
0 Kudos

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.