Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Message Mapping HELP!!!!

hi people.i am currently studying xi and my mentor has left me an assignment of which im struggling to map. could someone be good enough to post a snap shot example of how i would map the senario and where i would use the udf. the senario is as follows:........................................This is an interface between HNS and Camelot. HNS are a service provider to Camelot. HNS carry out all of the installations of Comms Equipment throughout the country.

The purpose of this interface is for HNS to send updates back to camelot on the status of the work that they have been requested to carry out.

A file will be picked up that contains many items, however some of these items are identicle items and only the Action and Quantity's are different. In this case the Target file should contain only One occurence of an ItemNumber but the subnode for Actions should contain all of the Action and Quantity Items for that particular ItemNumber.

The file is to be picked up from HNS and sent to TWO of Camelots systems (Camelot_CRM & Camelot_ECC). Both of Camelots systems use the same message structure and hence the message mappings are also the same.

Below is a sample of the type of file that HNS will drop off.

<Source>

<Details>

<ItemNumber>01<ItemNumber>

<StartDate>20080410<StartDate>

<EndDate>20080420<EndDate>

<Action>Complete<Action>

<Quantity>1<Quantity>

</Details>

<Details>

<ItemNumber>01<ItemNumber>

<StartDate>20080410<StartDate>

<EndDate>20080420<EndDate>

<Action>InProcess<Action>

<Quantity>2<Quantity>

</Details>

<Details>

<ItemNumber>01<ItemNumber>

<StartDate>20080410<StartDate>

<EndDate>20080420<EndDate>

<Action>Cancelled<Action>

<Quantity>1<Quantity>

</Details>

<Details>

<ItemNumber>02<ItemNumber>

<StartDate>20080310<StartDate>

<EndDate>20080320<EndDate>

<Action>Complete<Action>

<Quantity>1<Quantity>

</Details>

<Details>

<ItemNumber>02<ItemNumber>

<StartDate>20080310<StartDate>

<EndDate>20080320<EndDate>

<Action>Problem<Action>

<Quantity>5<Quantity>

</Details>

</Source>

Quick Hints:

You will need to play with the contexts...

You will need to use the node function "formatbyexample"

You will need to use the below UDF:

ArrayList al = new ArrayList(Arrays.asList(a));

int count = 0;

Object object = null;

Object objectAux = null;

ArrayList ret = null;

ret = new ArrayList();

if ((al != null) && (al.size() > 0))

{

object = (Object) al.get(count);

objectAux = (Object) al.get(count);

ret.add(object);

count++;

while (count < al.size())

{

object = (Object) al.get(count);

if (!object.equals(objectAux))

{

ret.add(object);

objectAux = object;

}

count++;

}

}

String str[] = (String[]) ret.toArray(new String[ret.size()]);

for(int i = 0; i < ret.size(); i++){

String r = str<i>;

result.addValue(r);

}

Edited by: andy coip on Sep 21, 2008 2:31 PM

Edited by: andy coip on Sep 21, 2008 2:32 PM

Not what you were looking for? View more on this topic or Ask a question