cancel
Showing results for 
Search instead for 
Did you mean: 

Queue in Message Mapping UDF

Former Member
0 Kudos

Hi Guru's,

I am facing a problem in Message Mapping where i have to write a Advanced UDF but i am unaware of Advanced UDF's...please help me on this following requirement.

1.     It Should be a Queue Type UDF

2. It should take as input the E1KNA1M-SPERR field,
the E1KNB1M-SPERR field with all context values
(removeContexts->SplitByValue),
the E1KNB1M-BUKRS field with all context values
(removeContexts->SplitByValue), and a Constant 'PRD'

3. If the 1st value in the E1KNA1M-SPERR field array is 'X', set a value of 'Y' to the output Queue and exit

4. Else, loop over the E1KNB1M-LPFCN array.
If the current value in the loop matches with constant 'PRD',
then
check if the value in the E1KNB1M-SPERR array for the current loop counter is 'X'.

If it is 'X', then set a value of 'Y' to the output Queue and exit.

If it is not 'X', then set a value of 'N' to the output Queue and exit.

So how to write Advanced UDF.Please help me on this? waiting for your response.

Thanks & Regards,
Nissu

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

It could be something like

   

  public void advancedUDF(String[] q_E1KNA1M_SPERR,

                                                     String[] q_E1KNB1M_SPERR,

                                                     String[] q_E1KNB1M_BUKRS,

                                                     String vConst,

           ResultList result, Container container) throws StreamTransformationException{

      if (q_E1KNA1M_SPERR[0].equals("X") ){

          result.addValue("Y");

          return;

      }

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

          if (q_E1KNB1M_BUKRS[i].equals(vConst)){

              if (q_E1KNB1M_SPERR[i].equals("X")){

                  result.addValue("Y");

                  return;

              }else{

                  result.addValue("N");

                  return;

              }

          }

      }

  }

It should do what you described. However, this is just a basic version and you should make some checks - first queue should not be empty, second and third queues have the same length, both queues have no null values, etc.

I created this UDF with Testview - nice tool if you need to create and then maintain complex UDFs. Please have a look on this blog to see how to use it.

Alex

Former Member
0 Kudos

Hi Alex,

Thank you for your valuable reply...now its working fine.

Thanks & Regards

Nissu