cancel
Showing results for 
Search instead for 
Did you mean: 

UDF req for mapping

Former Member
0 Kudos

Scenario IDoc to File:

For one filed I get different values. As many as 20 values from sap and for that value I will have to set an error code. Each Number from SAP will have an error code respectively.

Thanks

Kiran

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Use Fixed value funtion it will very easy way to do it.in my project i got the same requirement i used same fixed value.if u want u can use UDF also as one of them mentioned in the thread.

Regards,

Phani

Reward points if Helpful

Former Member
0 Kudos

Hi All,

The problem is I will not know what value will be coming.

So the source sap value is dynamic. and I have to populate its corresponding value into file as I explained earlier.So I cannot use FixedValue Function I guess.

Any More clues please

Thanks

Kiran

Former Member
0 Kudos

Hi Kiran,

For each value from the file you have decided the error code also.

If not then how will you come to know for which value in file represent which error code.

Can you please calrify this.

Thanks n Regards,

Chirag Gohil

santhosh_kumarv
Active Contributor
0 Kudos

Hi Kiran,

>>So the source sap value is dynamic. and I have to populate its corresponding value into file as I explained earlier.

You have posted that u would get 20 different values and u would definately know the error codes associated to those values. So specify all the possible Values and error codes in the FixedValue Function/ Value Mapping so that in the runtime the error code corresponding to the Value will be picked up dynamically.

In addition have a look at the Blog that i replied in the previous post which is worked for a similar scenario.

Hope this clears..

Regards

San

Former Member
0 Kudos

Hi

as per your requirement you can use the fix value function

source field>fixvalue>target field

in the fix value function define ur condition

key value

1 A

2 B

Thanks

Rinku

Former Member
0 Kudos

public void func(String inputValue)

{

if(inputValue.equals("1")

return 'A';

else if(inputValue.equals("2")

return 'B';

:

:

}

It this your requirement.

Former Member
0 Kudos

Hi Monika..

Thanks for that UDF . But I used a case statement instead of IF.Its working fine now. Rewarded points.

Now my problem is I have as many as 30 interfaces which will have to use the same UDF. So I have to create a new UDF in each Interface.

My question is is there a way that we can place this UDF centraly something like a Function Module or a Subroutine and call it or use it where and when require. Because, if tomorrow, if any small change comes for in the UDF... It is very laborious work we need to do.

Any thoughts please...

Thanks

Kiran

Former Member
0 Kudos

Hi Kiran

Yes u can define global method by creating a java class

Steps

> create java class with whatever method u want to use again and again

> create JAR file of the java class

> import into impotted archive folder

> and while creating UDF u can use import statement like normal java program

> and access those method in ur code

rewards point if helpfull

Former Member
0 Kudos

thanks ajay

1. so if a change comes, then i will have to change in the global method and do i need to re-import that to archive folder?

2. Where should I perform all these steps?

3. I am not sure of impotted archive folder and other things

sorry.. i ve no idea at all on java. am an abaper. so plz provide more details so that i can get it done with my colegues.

Thanks

Kiran

Former Member
0 Kudos

Hi Kiran

Yes, you are right we will need to import in archive folder as JAR

Steps>

>First Make a java class containing your method or any number of other method

like

public class TextOne {

public static void main(String[] args) {

}

public String yourMethodName(String parameter){

String result = "your value"; // as for example

return result;

}

}

>step continue

>go to command prompt

> go to directory(package name like in above code) where u r java file is there

>make jar by following command

>jar -cvf nameofjarfile.jar yourjavafilename.java

>nameofjarfile.jar will we created

>go to archive folder in IR

>import that jar file

>go to UDF

>write import packagename

>now u can access function like class's object.method name

Reward points if helpful

Former Member
0 Kudos

Hi Ajay,

Thanks for that detailed steps.

I shall try 2 sit with my java team now.

But am not able to find any archive folder in IR/ any clues please

Thanks

Kiran

Former Member
0 Kudos

Hello

Go to mapping object >> Imported archive> Crate it >

> then click on Icon below Archive program>import your Jar file

reward point if helpful

Former Member
0 Kudos

Thanks for your patience in answering my questions

rewarded you.

Kiran

Former Member
0 Kudos

Hi Ajay,

Thanks for all your replies.

But I still want you to tune.

Is there a way that we can control this at ID level itself. Thus all our transformation can be dealt at ID itself before it could be handled at IR.

Hope am clear.

Thanks

Kiran

arunneerolil
Contributor
0 Kudos

hi,

Do you want to map 20 source values to a single target ??

Pls clarify .

Chemmanz

Former Member
0 Kudos

No..

When 1 value is coming from SAP i want to convert or replace that to A

similarly..

2 to B

3 to C

4 to D

so on....

Former Member
0 Kudos

Hi Kiran,

I am bit confused your requirement.

Let me expalin you what i have understood...From sap you will gettting so many values for particular field...of couree at a time only one..but the same value may repeat or may not be repeat.

If you know the values what you are getting for particular source value you can use Fixed Values funcitonand you can enter the source field and target field.

Ex: 1-A

2-B

etc....use this funciton and check it if this suits your requirement that's fine or if you have any special requriement let me know.

Thanks and Regards,

Chandu.

arunneerolil
Contributor
0 Kudos

hi

you can use ValueMapping for this purpose

chk this thread for detailed info..

rgds

Chemmanz

Former Member
0 Kudos

try using fixValues function from 'Conversion' set

enter source target accordingly in table

santhosh_kumarv
Active Contributor
0 Kudos

Hi Kiran,

Value Mapping would be the right solution..

<a href="/people/community.user/blog/2007/01/08/valuemapping-using-the-graphical-mapping-tool using the Graphical Mapping Tool</a> By Praveen Kumar

<a href="/people/sreekanth.babu2/blog/2005/01/05/design-time-value-mappings-in-xslt Time Value Mapping in XSLT</a> By Sreekanth Babu

Also try using the FixValues function.

Regards

San