cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping problem in context handling

Former Member
0 Kudos

Hi experts,

I am doing a file to file scenario in which i have to change the queue context is it possible? for simple context change we use ResultList.CC in advance UDF but what to do if we want to add a queue cahnge .To dig more deep into the problem i am explaining my scenario.

my output structure is <GROUP> .....(1 to unbounded)

<Records>....(1 to unbounded)

field1

field2

..

..

..

field13

In one group there can be many records and there will be multiple Groups.Suppose in my udf i want to add a queue change to add some field in other group then how will i achive it ? please guide me with ur inputs

Regards,

Saurabh

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

The solution i got by appending as many space as the suprressed values

GabrielSagaya
Active Contributor
0 Kudos

function myudf(String a[], ResultList result, Container container)

{

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

{

if(!a<i>.equals(""))

result.addValue(a<i>);

else

result.addContextChange();

}

}

GabrielSagaya
Active Contributor
0 Kudos

have addContextChange() in your UDF

function myudf(String a[], ResultList result, Container container)

{

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

{

if(!a[<i>].equals(""))

result.addValue(a[<i>]);

else

result.addContextChange();

}

}

vijay_b4
Active Contributor
0 Kudos

Hi,

context object is a generic term used to make a reference to message heder fileds in the XML file (also vth XPATH). Context of an element is nothing but just the level (with reference to its parent node) where the XML tag appears in the given XML document.

Check this links for more info:

/people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f59730fa-0901-0010-df97-c12f071f...

http://help.sap.com/saphelp_nw2004s/helpdata/en/d9/718e40496f6f1de10000000a1550b0/content.htm

/people/stefan.grube/blog/2005/12/30/test-user-defined-functions-for-the-xi-graphical-mapping-tool-in-developer-studio

/people/harrison.holland5/blog/2006/12/08/mapping-context-changes-in-xi

http://help.sap.com/saphelp_nw2004s/helpdata/en/4b/a20c4cfea96b498b1e1af3f32f0670/frameset.htm

/people/venkataramanan.parameswaran/blog/2007/02/06/is-there-a-possibility-to-access-xi-standard-functions-in-user-defined-functions-yes

Reward points if this helps

Regards

Pragathi.

Former Member
0 Kudos

Hi Mario,

Thanks for ur quick reply,but when i used it i got the error" non-static method addContextChange() cannot be referenced from a static context ResultList.addContextChange();".please tell me if i have to do any other setting to use this code.Secondly hope u understand my requirement i have to add context change to move to diffrent queue not simple context change.

Please feel free to ask any question if u have not understood clearly .

Regards,

Saueabh

stefan_grube
Active Contributor
0 Kudos

You can use result.addContextChange()

See also:

/people/stefan.grube/blog/2005/12/30/test-user-defined-functions-for-the-xi-graphical-mapping-tool-in-developer-studio

Regards

Stefan

Former Member
0 Kudos

Hi Saurabh,

to force a context change in UDF, use:

ResultList.addContextChange();

See also

http://help.sap.com/saphelp_nw04/helpdata/en/b1/83a09f668320419dbe00a741e0fe6a/content.htm

Regards Mario