cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping help to create node for each souce field

Former Member
0 Kudos

Hi,

This is re-posting from my prevoius post, because I felt that was too lengthy and difficult to understand.

Lets say we have these 6 fields from source (For 1st field we need concatinate 4 other source fields)

1) Concatinate Lic_Start, VBELN, POSNR and PSMNG (these 4 are from source)

2) LIC_TYPE

3) LIC_CLASS

4) GAME_FAMILY

5) PSMNG

6) LIC_PLANT

And in the target we have folling node:

<licenseModelAttributes> 0...1

-


<attribute> 0...Unbound

-


<attributeName></attributeName> 1...1

-


<stringValue></stringValue> 0...1

-


</attribute>

</licenseModelAttributes>

For each field in the source we have to create separate node of attribute in target under licenseModelAttributes.

Lets say we have PSMNG field value as 10 in the source, we have to create target as follows:

<attribute>

-


<attributeName>AVP_QUANTITY</attributeName>

-


<stringValue>10</stringValue>

</attribute>

What ever the vlaue in field PSMNG (10 in this case) has to map to "stringValue".

Have to pass AVP_QUANTITY to "attributeName".

Same way it has to create 6 modes for 6 source fields and map the values accordingly.

Any help would be great.

Thanx

Navin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi navin,

I think in this case you have to create 2 udf, with queue and six inputs

:

the first has to create a queue of field names:

"XXX1"

"XXX2"

"AVP_QUANTITY"

..

and the second has to create a queues with fields values.

then map them on your target fields.

Regards,

Sergio

Former Member
0 Kudos

Hi Sergio,

Any sample code?

Thanx

Navin

Former Member
0 Kudos

Hi Navin,

create your udf <b>enqueueInputs</b> of type queue:


public void enqueueInputs(String[] param1,String[] param2,String[] param3,String[] param4,String[] param5,String[] param6,ResultList result,Container container){
result.addValue(param1[0]);
result.addValue(param2[0]);
result.addValue(param3[0]);
result.addValue(param4[0]);
result.addValue(param5[0]);
result.addValue(param6[0]);
}

Then take the output of the udf and assign it to the output putting the standard function <b>splitbyvalue (each value)</b> in the middle.

For attributeName assign six constants as the input of the udf

For stringValue assign the six source fields as the input.

Regards,

Sergio

Former Member
0 Kudos

Hi Ranjit and Sergio

Got it guys. Thanks a lot.

Assigned points and closed thread.

Navin

Answers (2)

Answers (2)

ranjit_deshmukh
Active Participant
0 Kudos

HI Navin,

if you know how to use udf you can do something like this:

1. see to it that you need 6 fields only.

2. create an udf with the context option and have 6 variables assigned to it(i.e. 6 parameters)

3. now in udf you can write as:

result.addValue(a[0]);

result.addValue(b[0]);

result.addValue(c[0]);

result.addValue(d[0]);

result.addValue(e[0]);

result.addValue(f[0]);

4.now use this udf and map it to the attribute as well as to the node 'StringValue'.

5.simply assign the value 'AVP_QUANTITY' to attrib.name six times(you can use the udf again).

thats all tell me if this works.

Ranjit

Former Member
0 Kudos

Hi Ranjit,

I created UDF with 6 input parameters as Context.

6 source filds --> UDF --> attribute. Its creating 6 "attribute" nodes.

Now I need to assign values to the fields "attributeName" and "stringValue".

For attributeName:

I need to assign values: SERIAL_NUMBER, AVP_TYPE, AVP_CLASS, AVP_FAMILY, AVP_ISSUER and AVP_QUANTITY.

For stringValue:

I need to pass what ever the values in the source fields like:

VBELN+POSNR --> stringValue

LIC_TYPE --> stringValue

LIC_CLASS --> stringValue

GAME_FAMILY --> stringValue

PSMNG --> stringValue

LIC_PLANT --> stringValue

Thanx

Navin

I assigned same UDF for stringValue...but its populating only first value from the source.

Message was edited by:

navin kumar

I added splitByVlaue after UDF to stringValue. Its populating all the fields and doing right.

How do I assign SERIAL_NUMBER, AVP_TYPE, AVP_CLASS, AVP_FAMILY, AVP_ISSUER and AVP_QUANTITY values to attributeName??

Message was edited by:

navin kumar

Former Member
0 Kudos

Hi Navin,

Use the concept of duplicate tree. In ur case u hv to copy the target sructure 6 times depending on the no of source fields.

Check this link

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/2f/5bc63d15431352e10000000a114084/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/2f/5bc63d15431352e10000000a114084/frameset.htm</a>

<i>Lets say we have these 6 fields from source (For 1st field we need concatinate 4 other source fields)</i>

I didnt understant the above statement. Can u plz elaborate tht.

Regards,

Akshay

Former Member
0 Kudos

Hi Akshay,

I think concept of duplicate tree doesn't work in my case. I have to create 6 nodes for the 6 source fields (for each source field there will be one similar node with different values).

<u>Lets say we have these 6 fields from source (For 1st field we need concatinate 4 other source fields)

I didnt understant the above statement. Can u plz elaborate tht.</u>

I have given 6 fields for which we have to generate 6 nodes. Among those 6 source fields....first one is string which we get by concatinating 4 other source fields Lic_Start, VBELN, POSNR and PSMNG.

Thanx

Navin