cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced UDF

Former Member
0 Kudos

Hi Experts,

In my scenario. i am sending file which contain multiple header with multiple item lines. in item line. in mapping counter to Assigned to item_number. at every context change at header i need to reset the counter to 10. for this i have to write Adv UFD.

plz can any one provide Logic or UFD.

thanks in Advance,

Venu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

>> at every context change at header i need to reset the counter to 10

the logic:

create a UDF cache = queue.

give header as input.

the context change is represented by ResultList.CC start a for loop. check if the input vector's current value is equal to ResultList.CC , then assign the desired value to counter.

[reward if helpful]

regards,

latika.

Former Member
0 Kudos

Hi Latika Sethi

Can u plz send Code for that. Iam Trying the same but it is giving error

Former Member
0 Kudos

kindly post the error and ur code.

regards,

latika.

Former Member
0 Kudos

Hi Latika Sethi

Below is the code can u correct it and send it back

int counter ;

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

if( a[index] = REsultList.CC ){

counter =0; }

else{

Counter = counter + 10;

}

}

Point will be rewarded for if u solve this.

thanks in advance

venu

Former Member
0 Kudos

venu,

1) the code is clearly in error as java is case sensitive. maintain proper case.

2) Also, it shud be a<i> not a[index]

as far as the logic is concerned it will only give u number of items in last header coz the counter's value will be over-written. there fore if u want number of items in each header add the counter to result by using result.addValue()

still if u face problem, kindly post the error also.

regards,

latika.

*Dont forget to mark helpful answers*

Former Member
0 Kudos

Hi

int counter ;

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

{

If ( a<i> = =REsultList.CC )

{ counter =0; }

else

{

Counter = counter + 10;

result.addValue();

}

still it is giving error . plz rectify

Thanks

venu

Former Member
0 Kudos

for more info...

I am sending the sender and destination sample data

source ...........................

Header_data1

item_data

item_data

item_data

Header_data2

item_data

item_data

item_data

item_data

destination......................

<IDOC1>

<Header>

.........

........

.......

<item1>

........

incr_no = 10

.......

.......

.......

<item2>

........

incr_no = 20

.......

.......

.......

<item3>

........

incr_no = 30

.......

.......

.......

</IDOC1>

<IDOC2>

<Header>

.........

........

.......

<item1>

........

incr_no = 10 (now I am getting 40)

.......

.......

.......

<item2>

........

incr_no = 20(now I am getting 50)

.......

.......

.......

<item3>

........

incr_no = 30(now I am getting 60)

.......

.......

.......

<item4>

........

incr_no = 40(now I am getting 70)

.......

.......

.......

</IDOC2>

Now, with standard function counter, I am getting 40,50,60,70 in the second IDOC "incr_no"

help !!!

Former Member
0 Kudos

Hi Venu,

when I understand your problem correct you won't have to write a UDF as a standard function exists which should cover your problem: index (within category statistic).

Properties:

Initial Value: 10

Increment: 10

Count indices in: context

You'll have to ensure that you give the input queue with correct context changes. In your case it should look like that:

item_data (set context to Header_data) --> Standard Function index --> output field in IDoc structure.

Input queue of item_data should look like that your mapping editor:

item_data

item_data

item_data

[Context Change]

item_data

item_data

Former Member
0 Kudos

Hello Lars Rektorschek ,

I used Index in the mapping, but Item num getting the same value for all the item line .it is not incrementing . i gave the following values in index

Initial Value: 10

Increment: 10

Count indices in: context

Please provide some solution

thanks

Venu

Answers (1)

Answers (1)

Former Member
0 Kudos

I suggest you to see the following link to learn more about mapping:

Mapping functionality in XI

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9202d890-0201-0010-1588-adb5e89a...

SAP Exchange Infrastructure - Graphical_Mapping

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6658bd90-0201-0010-fbb6-afe25fb3...

SAP Exchange Infrastructure - Graphical Mapping Exercise

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/fd5ebd90-0201-0010-d697-91374d5b...

SAP Exchange Infrastructure - Graphical Mapping - Advanced

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/be05e290-0201-0010-e997-b6e55f95...

SAP Exchange Infrastructure: Mapping Patterns - Understand Context Handling in Message Mapping - Webinar Powerpoint

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

SAP NetWeaver Exchange Infrastructure Mapping Troubleshooting - Webinar Powerpoint

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e01e9400-9e81-2910-20a5-a862945a...

Mapping Lookups a RFC API

XI 3.0 New Mapping Features

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8a57d190-0201-0010-9e87-d8f327e1...