cancel
Showing results for 
Search instead for 
Did you mean: 

how can we use result.addValue, result.SUPRESS, in udf

Former Member
0 Kudos

how can we use result.addValue, result.SUPRESS, in udf.

can anybody help me?

Thanks,

Kumar

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

thanks for giving the usefull answers.

Thanks a lot.

Former Member
0 Kudos

Hi,

Sample code is

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

{

if (value<i>.equals(""))

result.addValue(ResultList.SUPPRESS);

else

result.addValue(value<i>);

}

if ( tdline[j].equals(ResultList.CC) ) -


to check the context change

Former Member
0 Kudos

hi,

this objects are used only in case of Advanced User defined function to return the results of the function to the target fields.

In AUDF you can return entire Queue or a context as inpute depending on the condition.

ResultList objects have following functions

1)void addValue(String value):- used to Appends a value to the results list.

2)void addContextChange():- used to appand a context change in the target queue.this can be achived using ResultList.CC also.

3)void addSuppress():-Appends the constant ResultList.SUPPRESS to the list. The generation of the target field and its sub nodes is suppressed for such entries.e.g after ResultList.SUPPRESS the queue is closed and no sub node be created after this.

4)void clear():-used to deletes all previously appended values from the list.

regards,

navneet

former_member190389
Active Contributor
0 Kudos

Hi,

1. Change the cache to context in UDF.

2. Now you can use the variable result in the method declaration i.e public fname(...,ResultList result,...)

3. This result acts like List (java).

to add a value to the output use result.addValue ("abc");

this will make the first element in the list as 'abc".

to add a suppress use ResultList.SUPPRESS constant.

like result.addValue(ResultList.SUPPRESS) now the second value after "abc "is "_ sUpPresSeD _"

also you can use result.addSuppress(); for the same

FYI

to add a context change you can use

result.addValue(ResultList.CC) or result.addContextChange();

both will add the value "_ cC _" which will result in context change.

Edited by: Progirl Progirl on Jul 25, 2008 10:10 AM

Former Member
0 Kudos

Hi,

There r 2 types of UDF - Simple and Advanced- Simple UDFs uses Value, wherein we can manipulate only one value (input is one String). Therefore a single string is expected as input and the output would also b a single string.

Advanced UDFs uses Context or Queue, where you manipulate many values (input is an array of Strings).

This will help u

http://help.sap.com/saphelp_nw2004s/helpdata/en/40/7b8e40496f6f1de10000000a1550b0/content.htm

The most useful thread.........

Thanks,

Madhu

Edited by: Madhu sudhan Reddy on Jul 25, 2008 6:25 AM