cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping

Former Member
0 Kudos

Hi everyone,

I have a following scenario..

Source Message

<Maintag>

<tag1>

<number>1</number>

<message>This is</message>

<Date>03/27/2006</Date>

</tag1>

<tag2>

<num>1</num>

<mes>crazy</mes>

<Time>11:30</Time>

</Maintag>

Target Message

<Result>

<number>1</number>

<message> This is crazy</message>

<Date>03/27/2006</Date>

<Time>11:30</Time>

</Result>

How can I do this mapping? Can I do it in GUI or need Java mapping??

Thanks for the suggestions...

Thilothama

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Its not required to go for Java mapping. Graphical mapping can slove problem. If standard functions are not statisfying your requirement, a small user defined function to chk the number and then to concat message will work.

-Kavita

Answers (4)

Answers (4)

Former Member
0 Kudos

Please refer to the following one

.

This is similar to your requirement....

Regards

KNS Kumar

Former Member
0 Kudos

hi,

You can solve this using graphical mapping.

Use the if then clause.

If <number> isequal to <num> then, map <number> to <num>, source message to <mes>, source time to <Time> etc.

Regards,

Smitha.

Former Member
0 Kudos

Hi Thilothama,

You can use the user defined functions present.

->use the equals function to check if the two numbers are equal.

-> give the output of the equals step to the input of an if without else function.

So then the mapping will take place only if the two numbers are the same.

Hope this helps.

Regards,

Jesse.

Former Member
0 Kudos

Hi Thilothama,

If you have same number of tag1 and tag2 nodes in source message, you can use the standard function concat on <message> and <mes> nodes. And assign the <number>, <date> and <time> directly to the result.

praveen

Former Member
0 Kudos

But I should compare that num and number has the same value right?? otherwise it will be based on an assumption that everything will be in order and place...How do I check if the those two numbers are same???

Former Member
0 Kudos

You can use the concat function based on evaluation of a condition in graphical mapping. check out the standard functions which can help you in creating a if / then / else construct.

Former Member
0 Kudos

comparing using ifThenElse will not serve the purposes as it doesnt compare the corresponding values..

Eg. tag1...1,2,1,3

tag2...1,1,2,3

so u need to sort both the queues and apply the formatByExample function..then u'll get the desired result. Check out the documentation..http://help.sap.com/saphelp_nw04s/helpdata/en/67/7ca04267deb111e10000000a155106/content.htm

praveen

Former Member
0 Kudos

Praveen,

Actually, I have an RFC - which has BAPIRET - it takes a table of input values and after execution, returns back a table of BAPIRET for each row in the input table. Ineed to mix the message, type I get from BAPIret and the input values and map to the output - for the input values sent - this is the message output...So Do I need formatbyExample even to check within a single message??

Former Member
0 Kudos

If you have the row number in input table as the identifier (for cross-reference) in BAPIRET messages, then you need to sort the input table and BAPIRET message, type and then apply the formatByExample or useOneAsMany accordingly.

Former Member
0 Kudos

Praveen,

I dont have the row number in the table - but I can create one field in the datatype and in the mapping I can increment for each row created right? If so how do i do it?? just could u throw some light on it..plz.. and in the rfc I can assign the row number in the ROW field. Can you give some sample code for formatByExample??

Former Member
0 Kudos

Thilothama,

Can you tell me the RFC which we have imported from SAP system and XSD of the target message type, so that I can try it my system.

praveen

psirupa@gmail.com

Former Member
0 Kudos

Its a custom RFC - not the standard one. But do you think I can do anything else otherthan comparing the message for Row number? If I just do plain graphical mapping, like pick from both the nodes and map to target one, what kind of problems will occur - given that the number of bapiret is equal to the number of rows in the other table.

Former Member
0 Kudos

You can do the plain Graphical mapping with the following assumptions.

No of entries in BAPIRET and Input table are equal

The matching order is maintained in these queues correctly (as desired).

If you are not sure about the order...you have to sort bot the queues on one common field and then apply formatByExample.

For more clarity, go thru the examples in /people/sundararamaprasad.subbaraman/blog/2006/02/21/real-example-for-formatbyexample

If you still not clear...gimme the src and target xsd fo ur messages...In case of ur custom rfc....copy-paste the XSD after importing it into IR.

Former Member
0 Kudos

http://help.sap.com/saphelp_nw04s/helpdata/en/67/7ca04267deb111e10000000a155106/frameset.htm in this link the advanced user defined function has String as arguments. Can I send integer values?? For example that ID is integer, can I still use this function? or do I have to convert integer to string?

Former Member
0 Kudos

You need not convert them as mapping runtime treats all data as strings. When it transfered to the participating system, SAP R/3 etc...it will convert to corresponding types in those systems.

So, you can safely apply the funtion.

Former Member
0 Kudos

Praveen,

Thanks for such a help...I am planning to use the user defined java function which they have mentioned in the above link. I have added Row to my other table and going to treat as a common entry for bapiret and my input table. Is this solution fine or u think i will need formatbyExample??

Thank you

Thilothama

Former Member
0 Kudos

'user defined java function which they have mentioned in the above link'??

The function given in the link is a SAP standard node function available from SP13..

Former Member
0 Kudos

Could you please let me know the function name? Is it "useOneAsMany"

Former Member
0 Kudos

UseOneAsMany will replicate an element as many times as the other element.

FormatByExample copies the values of first queue and context from the second queue.

Both of these are SAP node functions...u dont need any develop user defined functions.

Now, tell me what function do u want to apply?

Former Member
0 Kudos

Did you solve the issue? If yes, can you please share it with us.

praveen

Former Member
0 Kudos

I have used useOneasMany and yet to test it for my different scenarios..I will update once I have done it...Thanks for the replies and help