cancel
Showing results for 
Search instead for 
Did you mean: 

PI7.1 Help needed

Former Member
0 Kudos

Hi,

I have the mapping like this

IDDAT(E1EDK03)EqualsIfThen DATUM(E1EDK03)removecontext-copyvalue(0)--targetfield(Underroot1)

001

Here the root1 is under root has the fixed value mapping with values 111,112,113 means if there is any value among these then only the root1 will be created.

Now I check the mapping with the roo1 mapping as

Qualf-equal-equals-createif-root1

113

whreas there is no value 113 in the input payload

I get the follwowing error when I check mapping with copyvalue for the targetfield

Insufficient number of values in argument queue for function CopyValue. Value with index '0' not found

It works well without copyvalue.

What can be done it to wok with and withou copyvalue?

Thanks

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

answered

Former Member
0 Kudos

Hi

Do the mapping without copyValue function

> IDDAT(E1EDK03)EqualsIfThen DATUM(E1EDK03)removecontext---targetfield(Underroot1)

> 001

Regards,

Venkata Ramesh

Former Member
0 Kudos

Hi Venkata,

I am doing the same way but I am getting the error as I mentioned earlier when I do it without copyvalue(0).

How to skip copyvalue?

Thanks

Former Member
0 Kudos

Hi,

> I am doing the same way but I am getting the error as I mentioned earlier when I do it without copyvalue(0).

You are using IfWithoutElse function, double click on that function and select Keep SUPPRESS Value checkbox.

Regards,

Venkata Ramesh

Former Member
0 Kudos

Hi Venkata,

Thanks for the quick reply.

Please tell me the following

1.THis UDF is the replacement of CopyVlaue node function,right?

2.THe parameters for this UDF are

Exectuion Type:Single Values

Category:User Defined

Argument:var1,var2

Please correct me if I am wrong.

Thanks

Former Member
0 Kudos

Hi,

> 1.THis UDF is the replacement of CopyVlaue node function,right?

No. This UDF is for getting the correct values based on context.

Ex: E1EDP03 comes multiple times and some times DATUM exists and IDDAT not exist or some times IDDAT exists and DATUM not exists at this time it takes the next context value as output but that is wrong. To avoid those conditions we can use this UDF.

> 2.THe parameters for this UDF are

Input parameters are Segment and Field

Exectuion Type:QUEUE type UDF

Regards,

Venkata Ramesh

Former Member
0 Kudos

Hi Venkata,

I declared 2 arguments as var1 and var2 and another thing came as Resultlist automatically.

Is it correct?

But I am getting error in the UDF at

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

if(segment.equals(""))

result.addValue(field[j]);

Also ,do I need to change the context of IDDAT and DATUM to IDOC?

Thanks

former_member184681
Active Contributor
0 Kudos

Dear Gayatri,

You really don't need a UDF for this purpose. Just do as I described earlier and you'll be fine:

Add an ifWithoutElse step. Put this as the if condition:

IDDAT(E1EDK03)EqualsIfThen DATUM(E1EDK03)removecontext--exists()

and this as the "then" value:

IDDAT(E1EDK03)EqualsIfThen DATUM(E1EDK03)removecontext

Simply put the result to: copyvalue(0)targetfield(Underroot1) and you got it.

Regards,

Greg

Former Member
0 Kudos

Hi,

The actual mapping is

IDDAT(E1EDK03)EqualsIfThen DATUM(E1EDK03)removecontext-copyvalue(0)--targetfield(Underroot1)

113

The hierarchy is

Root

-


Underroot1

-


targetfield

Now as per the mapping of the Root,there are 3 values 111,112,113 for which it should create the Underroot1 and so targetfield

Now in my case targetfield is validated for IDDAT = 113,it is there also but gets populated only with CopyValue(0) and not without CopyValue nodefunction.

Can you please tell me how to skip CopyValue node function?

Thanks

Former Member
0 Kudos

Hi,

> I declared 2 arguments as var1 and var2 and another thing came as Resultlist automatically.

> Is it correct?

YES

> if(segment.equals(""))

Here you need to check Segment of i value // segment

> Also ,do I need to change the context of IDDAT and DATUM to IDOC?

No

After this UDF you need to map like below

UDF output --> mapwithDefaultValue --> Collapse context node function --> Split by value Node function --> Target Field name.

Regards,

Venkata Ramesh

Former Member
0 Kudos

Hi Venkata,

Thanks for the reply.

if(segment.equals(""))
Here you need to check Segment of i value // segment{i}

Is it the value of segment E1EDK03?If so then what should it be as it is the source

Or is it the value of IDDAT,that is,113 here?

Thanks

Former Member
0 Kudos

Hi Greg,

Add an ifWithoutElse step. Put this as the if condition:
IDDAT(E1EDK03)--Equals--If--Then DATUM(E1EDK03)--removecontext--exists()
and this as the "then" value:
IDDAT(E1EDK03)--Equals--If--Then DATUM(E1EDK03)--removecontextSimply put the result to: --copyvalue(0)--targetfield(Underroot1) and you got it.

I need to skip CopyValue and the above method did not work.

The actual mapping is

IDDAT(E1EDK03)EqualsIfThen DATUM(E1EDK03)removecontext-copyvalue(0)--targetfield(Underroot1)

113

The hierarchy is

Root

-


Underroot1

-


targetfield

Now as per the mapping of the Root,there are 3 values 111,112,113 for which it should create the Underroot1 and so targetfield

Now in my case targetfield is validated for IDDAT = 113,it is there also but gets populated only with CopyValue(0) and not without CopyValue nodefunction.

Can you please help me?

Thanks

Edited by: Gayatri Deshpande on Feb 7, 2012 12:30 PM

Former Member
0 Kudos

> Is it the value of segment E1EDK03?If so then what should it be as it is the source

Source is E1EDK03 segment

> Or is it the value of IDDAT,that is,113 here

This is IDDAT condition (If IDDAT = 113 or any other value then send corresponding DATUM value).

Regards,

VR

Former Member
0 Kudos

Hi Venkata,

Thanks for the reply.

I got 3 errors for the UDF

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

2.if(segment.equals(""))

Question:Should it be if(segment.equals("E1EDK03")),if so,it still gives error

Is it if(segment.equals("113")),the expected value of IDDAT?

3.result.addValue(field[j]);

The actual mapping is

IDDAT(E1EDK03)EqualsIfThen DATUM(E1EDK03)removecontext-copyvalue(0)--targetfield(Underroot1)

113

The hierarchy is

Root

-


Underroot1

-


targetfield

Now as per the mapping of the Root,there are 3 values 111,112,113 for which it should create the Underroot1 and so targetfield

Now in my case targetfield is validated for IDDAT = 113,it is there also but gets populated only with CopyValue(0) and not without CopyValue nodefunction.

Can you please guide me?

Thanks

Edited by: Gayatri Deshpande on Feb 7, 2012 12:43 PM

former_member184681
Active Contributor
0 Kudos

Hi,

Got it finally for you. Instead of CopyValue(0) from the initial mapping, use SplitByValue(Each Value) just after the RemoveContext. I just tested it and it works fine.

Hope this helps,

Greg

Former Member
0 Kudos

Check this link and do the mapping like this

https://picasaweb.google.com/bvramesh2006/February72012#5706369834877618562

Regards,

VR

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

>>>whreas there is no value 113 in the input payload

1. maybe you can write a simple UDF for the same and it will check all the things you want ?

is that an option ?

2. what I can also suggest is chapter: . 5.14 IDoc Message Mappings page 197

from:

http://www.sap-press.com/products/Mastering-IDoc-Business-Scenarios-with-SAP-NetWeaver-PI.html

Regards,

Michal Krawczyk

Former Member
0 Kudos

Hi ,

Thanks for the replies.

Can you provide me any code for this?

Thanks

Former Member
0 Kudos

By using below code you can take the correct values

int j = 0;

try

{

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

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

{

result.addValue(field[j]);

j++;

}

else

result.addContextChange();

}

catch(Exception e)

{

result.addValue("");

}

This is queue type UDF and it takes 2 input values Segment and field.

In your case 2 times you have to use this UDF.

Map like this

E1EDK03 as first input value

IDDAT --> MapwithDefault node function --> RemoveContext node function as second input value

The above UDF output values checks with constants by using Equals function(UDF output Equals 113) this output gives to IfWithoutFunction, if this condition is true then give the same UDF output value instead of IDDAT value you can use the DATUM

Finally you can map this ifWithoutElse node function output value to Target Field

Note: some times if IDDAT value comes and there is no value at DATUM so at this time also it gives correct values, if you map without using this that gives wrong value.

Regards,

Venkata Ramesh

former_member184681
Active Contributor
0 Kudos

Hi,

Add an ifWithoutElse step. Put this as the if condition:

IDDAT(E1EDK03)EqualsIfThen DATUM(E1EDK03)removecontext--exists()

and this as the "then" value:

IDDAT(E1EDK03)EqualsIfThen DATUM(E1EDK03)removecontext

The interpretation is: if the source value exists, then put it into Underroot1. Else, do not create the Underroot1 node.

Hope this helps,

Greg