cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Help Needed

Former Member
0 Kudos

Hi,

<br><br>

my scenario is JDBC->XI->IDOC. I need help on mapping the outbound JDBC structure to IDoc structure (WPUBON01).

<br><br>

The db table structure is as following; <br>

<img src="http://img15.imgspot.com/u/07/86/00/Screencapture11.jpg">

<br><br>

and records within this table are as following; <br>

<img src="http://img15.imgspot.com/u/07/86/00/Screencapture12.jpg">

<br><br>

on this table;

records that are with TYPE = SH are header records,

records that are with TYPE = SL and TYPE = GV are line item records (with different DATA field values) that should be associated to its header record by mapping.

<br><br>

These types are associated to each other by values within the DATA field.

<br><br>

I.E. values after 2nd, 3th and 7th commas are identifiers for header that links to its line items.

<br><br>

I.E., the record with RID=1 is a header record and has 3 identifier values on its DATA field as "001" (second comma separated value from DATA field), "002" (third) and "003" (seventh). <br>

So the mapping should find all line item records associated to this header record, by following;<br>

for "SL" type of line item: using 3th, 4th and 8th values on DATA field, <br>

for "GV" type of line item: using 2nd, 3th and 7th values on DATA field, <br>

associate them and therefore map to the idoc.<br>

Mapping should do this for every one of header records in this incoming db data.

<br><br>

The target IDOC structure is as following;

<br><br>

WPUBON01 (0..1)

IDOC (0..n)

E1WPB01 (0..1) - (Header - record TYPE = SH)

fields for header,

E1WPB02 (0..unbounded) - (Line Item, record type = "SL" or "GV")

fields for E1WPB02

<br><br>

<br><br>

Any ideas on how to achieve this mapping greatly appreciated.

<br><br>

<br><br>

Thanks.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

<br><br>

Thanks for your responses and your time, <br>

<br>

<i>

>>for IDOC field, you'll need to add a new entry for each header field (meaning, row with type SH). input of UDF could be TYPE column with removeContext function.</i>...

<br><br>

Can you please show how the graphical mapping sequence and the UDF code should look like?

<br><br><br>

Mapping structures are as following;<br>

<img src="http://img9.imagevenue.com/aAfkjfp01fo1i-26668/loc395/62474_Screencapture_13_122_395lo.jpg" border="0">

henrique_pinto
Active Contributor
0 Kudos

in this case you dont have exact IDOC structure.

you didnt have to create a new message type from scratch. You can import IDOC message from backend system and use it in mappings. After importing, do like I said, for example:

TYPE - RemoveContext - UDF1 - IDOC

TYPE - RemoveContext - UDF1 - SplitByValue - E1WPB01

...

TYPE - RemoveContext - UDF3 - E1WPB02

...

etc.

where

UDF1:

...
for (int i=0; i < input.length; i++) {
  if (input<i>.equals("SH"))
    result.addValue(input<i>);
}
...

UDF3:

...
for (int i=0; i < input.length; i++) {
  if (input<i>.equals("SL") || input<i>.equals("GV"))
    result.addValue(input<i>);
  if (input<i>.equals("SH"))
    result.addContextChange();
}
...

or something like that.

Regards,

Henrique.

Former Member
0 Kudos

..or anyone knows a good thread/blog/help etc for helping figure out this UDF?

I can't find any good source with sdn search.

Thanks.

Former Member
0 Kudos

Hi,

write a UDF with input values two one is type,data and type of UDF as queue

type--removecontext\ UDF ---Splitbyvalue -


One target node.

data--removecontext-/

in UDF

if (type.equals("SH")){

String[] values = split(data, ",");

result.addValue(values(1));

result.addValue(values(2));

result.addValue(values(5));

}

<b> similarly repeat this function for each target node by changing the positions</b>

could you please let me know any issues.

Regards

Chilla

Former Member
0 Kudos

Hi,

Can anyone please write a sample UDF for such scenario that i can continue with?

Chandra, can you please give me your email so that i can post screenshots to you?

Thanks

Former Member
0 Kudos

Hi,

See if example input is data="hello0123456789"

then we need to map the each two chars to each field

so in you UDF take one imput as string data

1)

String a = " ";

source -- UDF -- field1

a = data.substring(0,2);

return a;

2)

source -- UDF -- field1

a = data.substring(2,4);

return a;

......

Regards

Chilla

ccschilla@hotmail.com

henrique_pinto
Active Contributor
0 Kudos

Just some ideas:

you'll need to create basically 4 UDFs:

for IDOC field, you'll need to add a new entry for each header field (meaning, row with type SH). input of UDF could be TYPE column with removeContext function.

For header field, same as above but with SplitByValue function after udf. Its data is like header field but with input from DATA column (instead of TYPE column), also with removeContext function. Since input is different (and you need to get data from 2, 3 and 7 csv positions) this udf will be a lil different. But you will have to gather data only for rows with type = SH, then you need to enter both TYPE and DATA queues into UDF.

For item fields, same UDF as header field, but UDF must be different since it will add new entries for TYPE = SL or GV. Also, you cant use SplitByValue cause it aint 1:1 like header. You'll have to add a context change for each type SH found.

For item data, same logic as above, but you will get data from 3, 4 and 8 positions for type SL and 2, 3 and 7 positions for type GV; then, you'll need to pass both queues as input parameters. Also, you'll have to treat context changes in the same way as above (each type SH = context change).

Regards,

Henrique.

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

You will need to write a UDf that will split the string on the basis or , and then return the correspodning filed that you want.

Regards

Bhavesh

Former Member
0 Kudos

HI,

try to use UDF to solve this type of issues.

and the structures are not visible.

Regards

Chilla

Former Member
0 Kudos

Hi, do you mean the screenshots are not correctly displayed?

Can you please show an example of UDF for such mapping?

Thanks.

Former Member
0 Kudos

hi,

yes structure you have given not able to see

without structure , how can i give UDF code

Regards

Chilla

henrique_pinto
Active Contributor
0 Kudos

well, for me the printscreens are showing.

the problem is with ur system, chandra.

Henrique.

bhavesh_kantilal
Active Contributor
0 Kudos

The images are visible for me as well. Looks like some proxy setting for you chilla.

regards

Bhavesh