cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a webdynpro Method from a JavaScript function

0 Kudos

Hi there, i'm working on a WD application where i need to pass a set of data from a JavaScript function to a specific webdynpro method. I want to know whether it's possible. If so, how can it be done?

Thanks in advance

Accepted Solutions (0)

Answers (1)

Answers (1)

rohit_singhal
Active Contributor
0 Kudos

Hi Nitin,

You can try using an AJAX call to your webdynpro component.

You can pass the values as URL parameters.

Below is an example of the same:

  1. var sessionid = Math.random(); 
  2. var url = "/irj/servlet/prt/portal/prtroot/<DC name/Package Name>.<Method Name>"
  3. url = url + "?sessionid="+sessionid+"&navurl="+<data that you want to pass to WD method>; 
  4. $.ajax({ 
  5.         url: url, 
  6.         data: queryStr, 
  7.         success: function(a,b,c){ 
  8.                 <Function name>(a);  /*Here you can use the returned value which is returned in paramter a. and use it in your javascript function*/ 
  9.         } 
  10.   });

Let me know in case you need more details.

Best Regards,

Rohit

0 Kudos

Hey rohit,

Thanks a lot for the quick reply. i'll try with this and will revert back with the results.

0 Kudos

could you please give me a little more insight on the URL part?, presently i've created a JS file in the MIME repository, is it possible to invoke the method through a URL?

rohit_singhal
Active Contributor
0 Kudos

Hi Nithin,

Could you try calling through the URL?

Let me know in case you face any issues.

Best Regards,

Rohit

0 Kudos

hi, The server is responding with a 404 error when the URL is called.

rohit_singhal
Active Contributor
0 Kudos

Hi Nithin,

Where is the webdynpro component located?

Can you paste the error message in the post.

Best Regards,

Rohit