cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Problem.. I Need to pass Unique value everytime to Target filed.

Former Member
0 Kudos

Hi All,

I need to pass some unique value everytime the message processed to the target field.

Source filed ---> Target Field

can anyone has the UDF to generate like this.. ?

I heard that through RFCLookup we can do that.. by maintaing some table and taking 2 parameters one as input and one as output and everytime when the message processes it will add by one to the previous value and pass to the target field.

I dont know much about these lookups..

Can anyone through some light on this, how i can solve this issue.??

Waiting for your answers.

Thanks&Regards

Deepthi.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

We can acheive it by passing RFC function in the UDF.

We need to create the RFC with one Ztable.

So that everytime.. the value comes.. it will update with +1 and send the value to the Target Field.

Former Member
0 Kudos

To achieve the requirement, there are a couple of considerations:

1. The Value must be maintained in a external data source, e.g. DataBase, flat file or excel cell, etc. This will prevent value being reset after server reboot.

2. The Value should be get by runtime mapping program

3. The Value should be able to be updated by the mapping program.

I remember that I read a blog using excel lookup, and also can be updated, will check it out tomorrow.

Liang

Former Member
0 Kudos

Hi Liang,

That's my exact issue.Please let me know when you find the solution.

Actually i tried with some UDF.. its generating unique values whenever mapping is executed.But when we Reboot the system we found that its reinitializing again from "1".

So definetly we need to maintain the count in some database and system has to update evytime according to that.

Iam trying something by calling RFC from UDF and updating the Ztable by incrementing everytime.

I wil let you know if i find any solution..

Meanwhile anyone wants to suggest me... Please respond.

Thanks

Deepthi.

Former Member
0 Kudos

Hi Deepthi,

What kind of unique value do you need to pass to the target field? Does it have any conditions like it should be a all character 5 character string or some thing like that? Or is it enough if you pass any string without any restiriction and just suffice it to be unique every time?

Regards,

Jaishankar

Former Member
0 Kudos

Hi Jai,

>> What kind of unique value do you need to pass to the target field? Does it have any conditions like it should be a all character 5 character string or some thing like that?

Its some unique number.. i can say with 4 digits.. Because we are dealing with EDI files where we need to pass Control number to differentiate between each files.So that the partner will have some Uniqueness to maintain in there tables.

Let me know if you need any more info.

Regards

Deepthi.

Former Member
0 Kudos

Deepthi,

4 digit no? Then you need to go for a BPM with all the steps to write to a db and read from it after each execution.

It is possible to get the value of message Id with in the mapping by writing a small UDF. This message Id a hexadecimal string will be unique for each and every message. If you can accomodate the whole string then the issue is solved.

Regards,

Jaishankar

Former Member
0 Kudos

Hi Jai,

We have set 14 digits(alfha numeric values) to accomadate.

Pls let me know how we can set with that message id.So that i can proceed and discuss with my partner if they are ok with that.

Meanwhile if you find any solution .. pls let me know.

Regards

Deepthi.

Former Member
0 Kudos

Use this UDF.


AbstractTrace trace;
String headerField;
java.util.Map map;

trace = container.getTrace();

// get constant map
map = container.getTransformationParameters();

headerField = (String) map.get(
        StreamTransformationConstants.MESSAGE_ID);
trace.addInfo("MESSAGE_ID:" + headerField);

return headerField;

This UDF has no input.

Regards,

Jaishankar

Former Member
0 Kudos

Hi deepthi,

If your source containing one unique value then you can just use the CopyValue function.

Source field>CopyValue[0]>Target field.

otherwise by using UseOneAsMany function also you can do it.

-


Sankar Choudhury

justin_santhanam
Active Contributor
0 Kudos

Deepthi,

I doubt you can go for lookup, coz after doing lookup again u need to update the table with latest values. Hence I would suggest you to maintain the values in some DB.

The do a synchronous,get the last value, use this value and obtain ur reqmt. Finally send the call to DB to update the DB with the new value. You need BPM for it.

Example:

Synchronous call get value 3009 , use this in ur reqmt. Update the DB 3010

raj.

Former Member
0 Kudos

Hi Raj,

Thanks for your reply. We are not supposed to use BPM.

I feel its a simple case..

I will maintain some Ztable in ABAP stack and i can maitain those values in that table ...

But i dont know exactly how i can acheive this ..

By looking into below blog.. i thought like calling UDF and creating RFC and maintaining one ZTABLE , i think i can acheive it..

/people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups

but need some direction how i can go about it..

Regards

Deepthi.

justin_santhanam
Active Contributor
0 Kudos

Deepthi,

I understood your case. Maintain where ever it's feasible. Lookup is possible, but how you will update the table again? See if you are looking up for some value say 3009, after taking the value you need to update it with 3010 right? How you will update. Upto my knowledge using look up u can only select the data, but u can't update the value.

raj.

Former Member
0 Kudos

Hi Raj,

I need to pass some unique value everytime the message process.. No need to update in table as well.

Can't i achieve this without using BPM..??

Iam worried now.

Thanks&Regards

Deepthi.

Former Member
0 Kudos

Hey Deepthi

Try using "Counter" function of graphical mapping under arithmetic. I never used it but I guess it is there for such purposes only.

I am also testing it will let u know with updates.

- Lalit -

justin_santhanam
Active Contributor
0 Kudos

Lalit,

She can't use counter function. If you see her reqmt, each and every time when the mapping program is called she must use the unique key, how come it's possible in Counter function. It's not possible.

raj