cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Query on receiver IDOC

Former Member
0 Kudos

Hi Experts, 

Can any one help me on my requirement. Which is as follows.

Sender Structure :-

Target Structure :- (IDOC)

Based on the dates which received from Source side to the TYPE field at target side I need to update that date and time.

EX:- If I get the value CreationDate, At the target I need to get CreationDate and its date and time

<CreationDate>

                01/12/2014 13:00:05

</CreationDate>

OR

If I get the calue DocumentDate then I need to get map DocumentDate date and time

<DocumentDate>

                02/12/2014 13:00:05

</DocumentDate>

For this Which fields I receive I have to get those values at the target as shown in the examples. Here YDATE is a different list at ECC and those values store in Tables.

Can you please help me out how to map.

Will appricate for your inputs in advance.

Thanks

G V Anil

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear venkat,

I will suggest UDF . It will be easy n simple

try to write once else let us know , we will provide the udf.

Warm Regards,

Rudra

Former Member
0 Kudos

Hi Rudra,

Can you please provide the UDF..?

As I have less knowledge in JAVA.

Will be very thank ful if u provide the steps to create the Mapping.

Thanks

G V Anil

former_member191435
Contributor
0 Kudos

Hi,

Try this map

For type field u can select using the or statement..

Let me know still if yu face any issue

Thanks,

Sreenivas

Former Member
0 Kudos

Hi Sreeniavas,

Can you please elobrate bit more,

Mapping seems bit confusing.

Thanks

G V Anil

former_member191435
Contributor
0 Kudos

Hi,

Here take field2 field3 field4 and field 5 as per your fields....

here I have taken field3 and field 4 first

1) First I am checking field4 is exists if it exists then I am sending the value of field4  else

again I am checking the field3 is existing then I am taking the value of field3.  In else I am assiging the value of field 3 to else....

2)  Now I am taking  the field 2 and field 5 values

First I am checking field5 is exists if it exists then I am sending the value of field5  else

again I am checking the field2 is existing then I am taking the value of field2.  In else I am assiging the value of field 2 to else...

Now I taken the conditions from field3, field4   and field5 and field2   again same rule I applied for these 2 things......

from this step I will get the value of one field of all the 4 fields...which one is existing.....

then that value I am doing Datetrans function from that I am doing conversion then Finally I am getting the value   EX:   02/12/2014 13:00:05

Then next I am taken substring 0,10 assign that to date

and again I more substring from 11 to 8  assign that field to time...

Thanks,

Sreenivas

Former Member
0 Kudos

Hi Sreenivas,

Thanks for your time for clear explination, In my requirement I cant use EXIST. All the dates may be posted at the time im a payload.

Thanks

G V Anil

Former Member
0 Kudos

Hi Rudra,

Waiting for the UDF, Can you please send me.

Thanks

G V Anil

Former Member
0 Kudos

Sorry Venkat ,

Just now saw your comment . give me 10 mins

Former Member
0 Kudos

Hi Rudra,

NP , will wait, Thanks for your time.

Thanks

G V Anil

former_member191435
Contributor
0 Kudos

hi,

If you get all the dates at a time in the payload then you can do the duplicate subtree in the target and do the mapping for individual ones... not required any udf...

Thanks,

Sreenivas

Former Member
0 Kudos

Hi Sreenivas,

Its a IDOC structure which is created from the customer side. Guess they wont change it.

And I'm trying to understand the requirment. Which seem to be tough

Thanks

G V Anil

Former Member
0 Kudos

Hi Rudra,

Still waiting ....!!!

Former Member
0 Kudos

Hi Anil,

Hope you are looking for the same result.

Please use the below UDFs  for  Type, Date ,time . Please modify udf according your values

For Type

public String calculate(String CreationDate, String DocumentDate, String BaseLineDate, String DueDate, String ReversalDate, Container container) throws StreamTransformationException{

String A= "";

if (CreationDate !="")

{

A="CreationDate";

}

else if (DocumentDate !="")

{

A="DocumentDate";

}

else if(BaseLineDate !="")

{

A="BaseLineDate";

}

else if(DueDate!="")

{

A="DueDate";

}

else if(ReversalDate!="")

{

A="ReversalDate";

}

else

{

A="NotValid";

}

return A;

}

*********************************************************************

For Date

String A= "";

if (CreationDate !="")

{

A=CreationDate.substring(0,10);

}

else if (DocumentDate !="")

{

A=DocumentDate.substring(0,10);

}

else if(BaseLineDate !="")

{

A=BaseLineDate.substring(0,10);

}

else if(DueDate!="")

{

A=DueDate.substring(0,10);

}

else if(ReversalDate!="")

{

A=ReversalDate.substring(0,10);

}

else

{

A="NotValid";

}

return A;

***************************************************************

For Time

String A= "";

if (CreationDate !="")

{

A=CreationDate.substring(11,19);

}

else if (DocumentDate !="")

{

A=DocumentDate.substring(11,19);

}

else if(BaseLineDate !="")

{

A=BaseLineDate.substring(11,19);

}

else if(DueDate!="")

{

A=DueDate.substring(11,19);

}

else if(ReversalDate!="")

{

A=ReversalDate.substring(11,19);

}

else

{

A="NotValid";

}

return A;

Former Member
0 Kudos

Check Please ,

If You were looking for the same thing

Former Member
0 Kudos

Hi Rudhra,

Thanks for your rply.

Are this 3 different UDF's or only 1..?,  if 3 different UDF's how to map the fields  DATE and TIME

Thanks

G V Ani

former_member191435
Contributor
0 Kudos

Hi,

there are 3 udfs.... given by rudra...

For type field use the Type UDF    and Date use Date UDF and Time use time UDF.

use these methods in all the 3 UDFs

public String calculate(String CreationDate, String DocumentDate, String BaseLineDate, String DueDate, String ReversalDate, Container container) throws

Thanks,

Sreenivas

Former Member
0 Kudos

Dear Venkat,

One UDF will give you only one return value . how can you map that value to each field.

All threee udf are quite similar nothing to worry about them .

this is the way to use udf .. we are taking 5 input fields and one output. check how to create simple udf in pi

Give the arguments name same as the dates I have given . It will work .

Warm Regards,

Rudra

Former Member
0 Kudos

Thanks Sreeni to make him understand .

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Azhar, Rudra,Sreenivas, Sneha,

Thanks All for your time and solution's which really healped me lot to learn new thing and solving my problem.

I implimented Sreenivas rply (If you get all the dates at a time in the payload then you can do the duplicate subtree in the target and do the mapping for individual ones). As this solution meets my requirement. And other solutions might be helpful for me in future. Thanks once again...!!!

Thanks

G V Anil

0 Kudos

Hi Anil,

1.  I have used a single UDF instead of 3, that returns the TYPE, Date and Time in "TYPE|DateTime" format.

2. The output of this UDF is being mapped to a Graphical variable (V_Date).

3. Then I'm using Substring function and passing the values to the three fields,  TYPE, DATE,  and TIME, as shown in the screenshots..

Former Member
0 Kudos

That's a gud idea ..  i missed my mistake .

thanks

0 Kudos

Hi Anil,

There are several ways to achieve this. One of them would be through a UDF.

Please refer the below screenshot,  I have tried to implement it using a UDF. The Mapping logic and the UDF is provided below.

Thanks,

Sneha

azharshaikh
Active Contributor
0 Kudos

Hi,

You can achieve this using Graphical Mapping (if-then-else) , Substring, Date Tran... functions as follows:

Assuming your ECC date format is YYYYMMDD and Time is : HH:mm:ss (please check the format that you need in target system and according convert it in Mapping using Date Trans function)

Regards,
Azhar

Former Member
0 Kudos

Hi Hazar,

Thanks for your quick reply,

Not only for CreationDate and DocumentDate

Which ever date is passed from Source fields (/CreationDate/DocumentDate/BaseLineDate/DueDate/ReversalDate) That only field sent to tarfet.

Can you please suggest.

Thanks

G V Anil

azharshaikh
Active Contributor
0 Kudos

Hi,

I assume that only one of these dates (CreationDate/DocumentDate/BaseLineDate/DueDate/ReversalDate) will be coming in your source payload ?

Just extend the MM that I shared above. Add similar logic for BaseLineDate/DueDate/ReversalDate ( you will need to add 3 more If-then-else to achieve the required results)

Regards,

Azhar

Former Member
0 Kudos

Hi Azar,

Thanks you so much for the information,

Will try this mapping and update you.

Thanks

G V Anil

Former Member
0 Kudos

Hi Azhar,

When I tried mapping the Soruce field CreationDate to Length and Concat at a time I'ts not allowing me to map.

Can you please suggest.

Thanks

G V Anil

Former Member
0 Kudos

Hi Azhar,

In the same way how it is possible to map 3 substrings to 1 If then else..?

Thanks

G V Anil

azharshaikh
Active Contributor
0 Kudos

Hi,

Give the screenshot of the mapping that u did, alongwith the Source and Target structures and payload.

Regards,

Azhar

Former Member
0 Kudos

Hi Azhar,

Thanks for your rply, I'm using PI 7.0 I can't able to map Creat6ionDate source field to length and concat at a time, In the same way how it is possible to map 3 substrings to 1 If then else..? Is it possible in PI 7.0 Please suggest.

Thanks

G V Anil

azharshaikh
Active Contributor
0 Kudos

Hi,

Seems you are very new to PI n graphical mapping world...Welcome!

Just drag an output link (from Creation Date field to Length input function)...same Source field (CreationDate can be used as input for multiple other functions) and this is supported in 7.0 as well....and same is the case with Substring...

The mapping screenshot that I shared should suffice your requirement. Give it a try and try to test for 2 date fields initially as I have shown in Screenshot (once it works, you can add rest of the date logic for other date fields too)..will be good hands on n learning for you

Regards,

Azhar

Former Member
0 Kudos

Hi Azhar,

Thanks for your comment , But when I'm trying in my system its not accepting both at a time, if I'm mapping to Concat then the length mapping is automatically getting removed, vice versa.

Is there will be any setting to do that are can you show tel me how to do.

Thanks for understanding and inputs

Thanks

G V Anil

azharshaikh
Active Contributor
0 Kudos

Hi,

Double Click on the required Source Field (CreationDate) again from the Source Structure Tree...it will give you 1 more instance of the Node / Field in the mapping area (use this to map it further)...

Regards,

Azhar

Former Member
0 Kudos

Hi Azhar,

You mean like this as shown below..?

Thanks

G V Anil

azharshaikh
Active Contributor
0 Kudos

Yes