cancel
Showing results for 
Search instead for 
Did you mean: 

Java UDF --> Code

Former Member
0 Kudos

Hi Experts,

I am having a field name orderno ,i have to covert it to xml like

<root>

<orderno>2132323</orderno>

</root>

Any one help me with code as i am not an java deveoper

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

So...actually when i had tried it i cant add more than one response to the request message..

Former Member
0 Kudos

Hi Mahesh,

Are you using a BPM ??

Former Member
0 Kudos

You can go through the below link, if not using BPM for a Synch scenario

https://wiki.sdn.sap.com/wiki/display/XI/File-RFC-File(Without+BPM)

jus in ur Mapping for response use a 1..N mapping.

Regards,

Rahul Grover

Answers (10)

Answers (10)

Former Member
0 Kudos

Thanks Experts for actively participating for my query...the scenario has solved when we split it into two scenario one is jdbc to rfc (sync) for updating and then proxy to jdbc for inserting....

Thanks very much !!!!!!!!!!

Regards

Mahesh

Former Member
0 Kudos

Thanks for reply Experts..

Well i have two response messages how to add it in service interface as it has only one response message fields.?

otherwise the scenario was very clear as for sync we need to use requestrsponsebeans and multimapping for the message split ??

plz explain if its possible like this !!

or the other way is using async but i fear how will the rfc work..! i am in dilemma !!

Anyways thanks for posting ...

Regards

Mahesh

Former Member
0 Kudos

In order to add the multiple messages to teh message interface/service interface you need to go to the message tab and need to provide the messsages there with the help of help (F4) button for the same

HTH

Rajesh

Former Member
0 Kudos

Thanks Satheesh,

But i had referred this document earlier,but there is a problem of adding two response message in the service interface...

I had worked an solution :please let me know will it work:

As we know the scenario is synchronous : i am thinking to split it into two async scenario

In first senario we will be fetching data from the table and update the rfc(jdbc to rfc)

In second scenario we will map the response back and split it into two message which will separately update and insert the data into the table:(Just like the doc which Satheesh has posted):

Plz let me know any feedback that will it work or not???

Thanks in advance....

Former Member
0 Kudos

hi mahesh,

that's fine if your requirement is fullfilled. But I have a doubt here, that how then r u going to handle the response of RFC separately. What I mean to say is that , you can achieve your requirement by keeping it synchronous. You can use a BPM step and u can achieve this with making a multimapping as satish already told.

But if you still want to go wiht 2 Async interfaces than go ahead and enjoy.

Regards,

Rahul

Former Member
0 Kudos

Thanks swaroop,,,

But it involves message split from the response that we are getting::

Let me explain the scenario again !

this is an jdbc-rfc-jdbc

1)First we have to fetch the data from the table using JDBC and pass the value to RFC.

2)The rsponse message from RFC we have to split it into two message,from which one will update the data and the other one will insert the data into the table(that means multiple mapping)

kINDLY REFER TO THE LINK TO HAVE AN ROUGH GRAPHICAL IDEA

LINK: http://img188.imagevenue.com/img.php?image=89450_SCENARIO_122_827lo.jpg

Former Member
0 Kudos

Hi Mahesh,

Did you try to use multimapping in your response message? Hope this should work to your issue. Please check this for some information on this:

/people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible

Regards,

---Satish

Former Member
0 Kudos

Thanks Suraj for prompt reply; Actually i had hard coded the java UDF .,which i will be posting in sdn soon,

Anyways..

I was want an certain opinion from Experts:

Senario:JDBC-RFC-JDBC(Sunchronous)

In this scenario we have pick data from JDBC table and pass it to rfc ,then in the RFC response message we have to split it in two data types one will update the table and other one will insert the table with certain values:

can any1 help me in designing the scenario ???

Thanks in advance

Former Member
0 Kudos

Hi,

You need to have Update and Insert Actions on response side, so better to handle it with BPM.

Refer -

Thanks

Swarup

Former Member
0 Kudos

Hi Mahesh,

It should be very straight forward mahesh. Get the data from database and map to the request of rfc and then in response mapping map the response strcuture with your two strucutures. So create two message types for insert and update and the do multimapping for the response which would insert in both the tables.

Regards,

---Saitsh

Former Member
0 Kudos

So here we have to CREATE an UDF that converts the source fields to xml and that xml is posted in the JDBC Table in address field

Former Member
0 Kudos

Source file is xml file from which we have to select

plot no

state

country

phone

and make it as xml file like

e.g.,

<root>

<plot no>22</plot no>

<state>bangalore</state>

<country>india</country>

<phone>22222</phone>

</root>

and post the xml into address field of the jdbc table

Former Member
0 Kudos

Hi Experts,

Suppose for example:

Consider a scenario FILE TO JDBC

In source we have fields

name

age

plot no

state

country

phone

and in target

we have three fields

name

age

address

and adress field in table will contain an xml data containing

<root>

<plot no>22</plot no>

<state>bangalore</state>

<country>india</country>

<phone>22222</phone>

</root>

now we have to write on udf code ..if any 1 plz help me with code !!

Thanks in advance

former_member187339
Active Contributor
0 Kudos

Hi Mahesh,

Still the problem is unclear.

Please answer the questions which I have raised in my first post


In source we have fields
name
age
plot no
state
country
phone

Is source a flat file (text file)?

and you want the target to be a XML file?

Regards

Suraj

former_member187339
Active Contributor
0 Kudos

Hi,

Now i think i am able to under stand.

You have a source like this

<root>

<name></name>

<age></age>

<plot no></plot no>

<state></state>

<country></country>

<phone></phone>

</root>

and you target is like this

<root>

<name></name>

<age></age>

<address> Complete source XML<address>

</root>

You need to use XSLT code here

Check the blog of Michal

/people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping

Alsop make sure the JDBC data type shoudl be of the format as mentioned here

http://help.sap.com/saphelp_nwpi71/helpdata/EN/2e/96fd3f2d14e869e10000000a155106/content.htm

Regards

Suraj

Former Member
0 Kudos

orderno is a field in source structure,i have to pass it like an xml file at the target structure,,

former_member187339
Active Contributor
0 Kudos

Hi Mahesh,

Didn't get your requirement.

What type of scenraio is it? Will you be getting xml or text file in source? What adapter are you planning to use in source.

Try answering these and i am sure we (SDN) will be able to help you

Regards

Suraj