cancel
Showing results for 
Search instead for 
Did you mean: 

UDF for this mapping rule

Former Member
0 Kudos

Hi Friends,

I have one difficult issue which have one mapping rule to write user defined function. I am sending mapping rule Please give me java coding to create udf for this mapping rule which is following below:

CRFT.COSTR = M_ORD_01 and

CRFT.CRID = CRHE.CRID and

CRFV.FTNO = CRFT.FTNO and

CRFV.ATNAM = ZPPI_ORDER_SCHED_EN_DATE

And

CRFT.COSTR = M_ORD_01 and

CRFT.CRID = CRHE.CRID and

CRFV.FTNO = CRFT.FTNO and

CRFV.ATNAM = ZPPI_ORDER_SCHED_EN_TIME

From ATWRT of ZPPI_ORDER_SCHED_EN DATE+ ATWRT of ZPPIORDER_SCHED_EN_TIME

In format yyyy-MM-ddTHH:mm:ss

using this mapping rule, ATWART field can map with target field "End Time" i think.

Actually source field is CALCULATE but this field is not in Source structure

target field is "End Time" this field is in Target Structure.

I will wait for ur response

Thanks adn regards

Sai

Accepted Solutions (0)

Answers (2)

Answers (2)

vuyyurujyothi
Participant
0 Kudos

Hi Sai,

In ATWRT field, how many values (records) will come? What I mean is does it contain the data as follows?

Date1

Time1

Data1

Date2

Time2

Data2

.

.

.

.

Daten

Timen

Datan

If this is the case, Write one UDF and take ATWRT as a queue.

In UDF, use for loop and increment counter as 3 to access date and time.

For Date, start counter at 0.

For Time, start counter at 1.

Now You can do what ever you want.

If that is not the case, let me know clearly.

Regards,

Jyothi.

Former Member
0 Kudos

Hi jyothirmai,

thanks for you response

records come like what you said and also include another data like C9348

In ATWRT the data is like the following below:

20070704 -


date format(fist record)

120515 -


time format(second record)

cr1452----- normal data (3 record)

Please give me java code for using Udf.

thanks and regards

sai

vuyyurujyothi
Participant
0 Kudos

Hi,

Write two UDF's to get Date and Time Values like below:

// UDF to Date Values

List Date = new ArrayList();

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

{

Date.add(strATWRT<i>);

}

Iterator ite = Date.iterator();

while (ite.hasNext())

{

result.addValue((String)ite.next());

}

//UDF to get Time Values

List Time = new ArrayList();

for (int i = 1; i < strATWRT.length; i = i + 3)

{

Time.add(strATWRT<i>);

}

Iterator ite = Time.iterator();

while (ite.hasNext())

{

result.addValue((String)ite.next());

}

Use these UDFs with standard functions (substring & concat) to get the output.

Actually I have done this. But I don't know how to paste that one here.

Regards,

Jyothi.

Former Member
0 Kudos

HI jyoti,

thanks for giving good response.

you have given two java codes which are for date value and time value. but i think you didn't consider mapping conditions for those. where you store date value until you will get time value. After getting both value we have to concate in format

yyyy-MM-ddTHH:mm:ss

So for storing date adn time values in one function give me java code.

Thanks and regards

sai

former_member214364
Active Contributor
0 Kudos

Hi Sai,

Could you please make your requirement more clear.

Just give source and target nodes and fileds with occurrences and what conditions need to check to generate target elements/nodes.

Cheers,

Jag

Former Member
0 Kudos

Hi Jagadish,

Actually my Scenario is RFC to file.

Thsi is mapping rule:

(CRFT.COSTR = M_ORD_01 and

CRFT.CRID = CRHE.CRID and

CRFV.FTNO = CRFT.FTNO and

CRFV.ATNAM = ZPPI_ORDER_SCHED_EN_DATE

And

CRFT.COSTR = M_ORD_01 and

CRFT.CRID = CRHE.CRID and

CRFV.FTNO = CRFT.FTNO and

CRFV.ATNAM = ZPPI_ORDER_SCHED_EN_TIME

From ATWRT of ZPPI_ORDER_SCHED_EN DATE+ ATWRT of ZPPIORDER_SCHED_EN_TIME

In format yyyy-MM-ddTHH:mm:ss)

Target Field is "End Time" . Source Field is given as "CACULATE" but This field is not there in RFC.

ATWRT field is there in RFC. In this field 'ATWRT", we will get data from Database table like this

20070406------ This is DATE format

121005 -


This is Time format

cj123l -


This is normal data format

After getting these data records in same field ATWRT, ATWRT will map to "End Time" field using this mapping rule and then u should get data from "End Time" field in the format yyyy-MM-ddTHH:mm:ss.

i think now u understood.

Please give me java coding for udf.

Thanks and regards

sai

former_member214364
Active Contributor
0 Kudos

Hi Komala,

if your RFC is not customized just give RFC name and flat file structure.

i couldn't understand your requirement clearly.

just specify what is the output your are expecting and based on what condition.

Former Member
0 Kudos

Hi Jagadish,

This RFC is CONTROL_RECIPE_DOWNLOAD

in this RFC, i want to map ATWRT field to Target field "End Time" with mapping rule which i had already given.

In Graphical mapping, i am doing . but i can not get it because mapping condition is difficult. if you have any idea in graphical mapping give me early

before that i have to give explantion about this is date value and time value passed through this ATWRT field as different records.

i am doing as a condition ie first i have taken date condition. from that condition, first two fields CRFT.COSTER and M_ORD_01 has given to "equals" funtion like that have done remaining fileds then the output of those "equals" functions given to "and" functions finally i get one output of "and" function. while sending DATE values from RFC this output of "and " function.

Like this, for Time condtion i have done mapping same way and giving a TIME values from RFC as Second record then output of this "and" function while sending second record with time value.

here mainly i am getting problem is .....

here i am taking source field ATWRT( in this field i am sending date format adn time format as different records) with the outputs of the mapping conditons as input vaules of another function. i dont have any idea for another function why because is first date record should be wait until the time record comes in this function.after then both vaules should concat .

now here whenever you send date value through this field ATWRT as first record and after satishfy the date condition form mapping rule, The date value of ATWRT should go to input of concat function. next i will send time value like date value through ATWRT as second record . It should go to another input of concat function. Then here both date value and time value concat with T and should be come output in the format yyyy-MM-ddTHH:mm:ss and this will go to Target field "End Time".

I will be wait for ur possitive reply

thanks for giving response

Thanks adn regards

sai