cancel
Showing results for 
Search instead for 
Did you mean: 

User Define Function issue

Former Member
0 Kudos

Hi all

i am doing Idoc to file Scenario.my problem is in message mapping..

sometime at (IDOC) source one segment get repeated 2 times.

like

E1IDPUK2 (a,b,c)

E1IDPUK2 (a,b,c)... <b> but i want the particularfield value which comes from 2nd segment..in above case take "a".</b>

the segment occurances can be 2....many.. and so want the particular field value from last segment

the particular field (ex="a") is populated for every repetition of segment but i want

the last repeated segment ,"a" field value...

can any body share me the java code...

note : a,b,c are taken as example fields of the segment.

Thanks & Regards,

Ajay..

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

the structure is :

pexr2002/ idoc/ EIIDPU1/E1EDP02/BELNR

I need the belnr field value of the last generated segment..

Former Member
0 Kudos

Dear all i am new to java...

so that why i am asking the code..

regards,

ashutosh

Former Member
0 Kudos

Hi Ajay,

First time you should clearly says that "i m new in java".

/******UDF*******/

public static void myFormatByExample(String[] a, ResultList result,Container container){

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

if(!a[j].equals("") || !a[j].equals(ResultList.CC)){

result.addValue(a[j]);

result.addSuppress();//as per requirement.

}

}

}

Cheers!

Samarjit

former_member214364
Active Contributor
0 Kudos

Hi Ajay,

Could you please send us Parent and Super Parent segments of E1IDPUK2 segment.

and also which element under E1IDPUK2 segment you want it in output?

Cheers,

Jag

Former Member
0 Kudos

hi all

can any one share me the code of supressing the field "a" value...

except the last generated segment."a" field value..

the segment are dynamic...i cannot count them ..it is runtime...it may be 2, 3...

regards'

Ajay

Former Member
0 Kudos

Hi,

Write a UDF , before that remove context and in UDF take all values into Vector and then send to result list except last index .. after that use Splitbyvalue

it is vary ease..

regards

Chilla

Former Member
0 Kudos

Hi Ajay,

Michal was right.

I have some code which related to my project and it might be help you.

/********UDF*********/

public static void myFormatByExample(String[] a, ResultList result,Container container){

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

if (a[j].equals(ResultList.SUPPRESS))

result.addContextChange();

else{

while (a[j].equals(ResultList.SUPPRESS) && j<a.length){

j++;

}

result.addValue(a[j]);

j++;

}

System.out.println("J:"j" result:"+result);

}

}

Cheers!

Samarjit

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

it's pretty easy:

you need to use UDF of type queue

inside it:

check how many segment are there

and choose the last one

and you will have this field

I also presented such mapping exercises (with E1EDKA1 - partner segment) in my book:

<a href="/people/michal.krawczyk2/blog/2006/10/11/xi-new-book-mastering-idoc-business-scenarios-with-sap-xi"><b>Mastering IDoc Business Scenarios with SAP XI</b></a>

Regards,

michal

-


<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>