cancel
Showing results for 
Search instead for 
Did you mean: 

mapping problem

Former Member
0 Kudos

Scenario : IDOC - Soap

Target fields:

Location (0...unbounded)-segment

+name

+Part ((0...unbounded)-segment

++name

++Ord (0...unbounded)-segment

+++type

+++cost

Name, name, type and cost are fields.

The source fields ...

Location (0...unbounded)-segment

+name : 001 , 002

+Part ((0...unbounded)-segment

++name : Engine

++Ord (0...unbounded)-segment

+++type : General

+++cost : Qty

The output shud be:

Line1:

Location (0...unbounded)-segment

+name : 001

+Part ((0...unbounded)-segment

++name : Engine

++Ord (0...unbounded)-segment

+++type : General

+++cost : Qty

Line2:

Location (0...unbounded)-segment

+name : 002

+Part ((0...unbounded)-segment

++name : Engine

++Ord (0...unbounded)-segment

+++type : DEFAULT

+++cost : 0

I am facing problem while populating the DEFAULT segment in case the source side the value doesnt come.

how do I do it?

Thanks and reagards,

Nikhil..

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You could use

Source ---> mapWithDefault --->Target

double click on mapWithDefault to give defult value

or check for

Source ->Exists->If true the pass else pass constant with default value --->target

Former Member
0 Kudos

Hello Swarup,

for better understanding I have explained taking an example of target structure.

Actually the source is MATMAS04 IDOC

it will come like this...

MATMAS04

+IDOC

++E1MARAM (segment)

+++MATNR --> Part_name

+++E1MARCM (segment)

++++WERKS --> location_name

++++ZSEGMENT (segment)

+++++CLABS ---> type

+++++CUMLM ---> Qty

Former Member
0 Kudos

HI,

You could achieve this with formatByExample API.

Look the segment will be based on the existance of the sub-fileds in that segment so

pass segment as 1st param and sub-field as 2nd> FormatByExample>mapWithDefault --> target

This should work out.

Remember if the occurance of field and segment should be same

In your case

E1MARAM - >mapWithDefault--> FormatByExample ---> TargetField

________________MATNR----


>

Answers (3)

Answers (3)

justin_santhanam
Active Contributor
0 Kudos

Nikhil,

Does it got solved?

raj.

Former Member
0 Kudos

yes Raj,

This s the solution :

I have duplicated Ord node

Mapping to the original ORD node :

field > exists > formatbyeg > createif > target

field>mapwithdefault (II input to formatbyeg)

-


Mapping to the duplicated subtree:

field>exists>formatbyeg>count>==1?>removecontext>splitbyvalue> createif>

field>mapwithdefault (II input to formatbyeg)

sunil_singh13
Active Contributor
0 Kudos

I think you would have written UDF as the input in name is comma separated and you are spilitting the input based on comma and then changing its context .you can use the following UDF keep in mind the input to the udf will be the output of udf that u would have written for splitting the name based on comma and the other i/p will be type

u can change thae name as per u r conviniant .

String default = "DEFAULT" ;

for (int i = 0 ; i < name.length ; i++)

{

if(type<i>.equals(null) || type<i>.length() == 0)

{

result.addValue(default) ;

}

else

{

result.addValue(type<i>) ;

}

result.addValue(ResultList.CC);

}

if helpful reward points

Thanks

Sunil Singh

Former Member
0 Kudos

Hi,

Try to use the mapWithDefault function and put the Context of type to Node.

Please let me know if u need furthur help.

Thanks,

Bhargav

Note:Award Points if found useful