Connecting to SAP from Web Dynpro

Hi,
I am new to web dynpro, but have downloaded the java sneak preview edition and worked through it a bit. I understand that we have to use JCo to connect to SAP from Java Web dynpro, . Is it true?
What about web dynpro for ABAP? Can we use normal select statements to connect to SAP? How is it exactly done in that case?
Thanks in advance
PG

hi pg
Just go thru this example which describes how to connect to SAP from web dynpro application.
http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/tutorial on accessing abap functions in web dynpro - 4.htm
thanks
kris

Similar Messages

  • "UnknownHost" exception while connecting to mysql from web dynpro

    Hi
    I am trying to connect to Mysql 5.0 database from web dynpro application.I am using NWDS 7.1.
    I have followed this blog and created the datasource in NWA.
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/8675
    I have written the following code in my web dynpro application.
    InitialContext ctx;
           try{
                ctx=new InitialContext();
                DataSource ds=(DataSource)ctx.lookup("jdbc/dbconnect");
                Connection conn=ds.getConnection();     
                wdComponentAPI.getMessageManager().reportSuccess("connected");
                Statement stmt=conn.createStatement();
                   String query="select Col from TestTable";
                   ResultSet res=stmt.executeQuery(query);
                   while(res.next())
                        String str1=res.getString(1);
                        wdComponentAPI.getMessageManager().reportSuccess(str1);
              }catch (Exception e) {
                   wdComponentAPI.getMessageManager().reportSuccess(e.getMessage());
                   // TODO: handle exception
    But I m getting the following error as "UnknownHost exception"
    I checked with the datasource created in NWA.Here in the Driver status it is showing the driver as unknown.
    I have added the following driver.
    mysql-connector-java-5.0.8-bin.jar
    Any idea on how to solve this problem?
    Do I need to add the driver in my application also.
    Thanks in advance,
    Sumangala

    Hi,
    Have you created a datasource in Visualadmin?
    Was that tested and was it success full?
    If you havent done this this could be your issue
    make sure the following code is using the correct datasource
    DataSource ds=(DataSource)ctx.lookup("jdbc/dbconnect");
    Regards
    Ayyapparaj

  • No connection to SLD from Web Dynpro COntent Administrator

    Hi guys!
    I need to set up JCO connections to systems in Web Dynpro Admin, but I have no connection to SLD...  What is needed to set up?
    One more info: SLD has already imported CR content and is in status RUNNING..
    Thanx a lot!
    Peter

    Hi,
    Pls try the link below..
    http://help.sap.com/saphelp_nw2004s/helpdata/en/11/0dfe55e0c8fc4e910706a47ca6859b/frameset.htm
    Hope this helps.
    Regards,
    venkat.
    [Reward points if useful]

  • Exception:'NetworkAdapter fails'when connecting with oracle from web dynpro

    Hi,
    I am trying to run one of my application in SAP netweaver Studio(webdynpro).
    I want to connect to the oracle db on my local system.
    I wrote the code:
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection cn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:DSNname","UsrId","password");
    I am getting the following error in the connection statement
    Error:
    java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
    Oracle is 9.2.0.1.0  on windows XP platform.
    I can do an SQLPLUS and the connection is ok.
    I don't know were the problem is ?
    Can any body help me out.
    Thanks
    Smitha

    Hi,
    For the error "The Network Adapter could not establish the connection" check and do the following:
    In  the Computer Management - Services, check if the Oracle*TNSListener is started. If not, restart the listener  and set the Startup Type to "Automatic".
    Also check whether the port number in listener.ora is correct ($ORACLE_HOME\network\admin\listener.ora) and updated during the installation.
    For other details run through SAP Note 786673
    Hope this helps.
    Regards
    Srinivasan T

  • Calling Remote-Enabled JAVA Module from Web Dynpro Java

    Anyone have a clue how I can call a Remote-Enabled JAVA Module in ECC from a Web Dynpro Java app?  I'm on Portal 7.0.  When I try and create an Adaptive RFC model in NWDS and put in the Function Module name (CFG_API_FIND_KNOWLEDGEBASES) or its Function group, that RFC is not returned for me to import.  Can I not use this method to get at this function?
    (I CAN call this function module and run it from the old SAP Business Connector software.  That, however, does not help me get it into my Web Dynpro app.)

    If anyone stumbles upon this thread, the long and short answer is you can't call a Remote-Enabled JAVA module in SAP from Web Dynpro Java.....using Adaptive RFC.
    You can, however, if you create your own session and function call directly in Java code and give up on being able to use Adaptive RFC.

  • How to get the Response Code when a URL is launched from Web Dynpro

    Hello Experts,
    I have a Web Dynpro Application in which in one of its views i have an IFrame UI element in which i will show a resource stored somewhere ..
    But before showing it i want to check if the resource actually exists. For this i have to check the HTTP Response code from Web Dynpro Application without setting it in the Iframe..
    I am using the following code to get the Response Code:
    try{
    URL url = new URL("Some Url");
    HttpURLConnection.setFollowRedirects(false);
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
    connection.connect();
    wdComponentAPI.getMessageManager().reportSuccess("Response code ="+connection.getResponseCode());
    }catch(Exception e){
    wdComponentAPI.getMessageManager().reportSuccess("Exception");
    Now the Problem is whatever response Code occurs 403 (for No Proper Authorization), 404 (for Resource not found) etc..
    i always get Response Code=  500 (which is for Internal Server Error) shown in the messgae i have printed.
    Please let me know the correct way of getting the Response Code from Web Dynpro.
    Also my resource is lying on a SAP Portal 6.4
    Best Regards
    Sundeep
    Edited by: Sundeep Sethi on Feb 18, 2008 9:07 AM
    Edited by: Sundeep Sethi on Feb 18, 2008 10:23 AM

    Hi,
      Check this code from /thread/5242768 [original link is broken] if it works.
    try{
    URL myurl = new URL("http://calendar.google.com");
    URLConnection connection = myurl.openConnection();
    if(connection instanceof HttpURLConnection) {
    HttpURLConnection httpConnection = (HttpURLConnection) connection;
    HttpURLConnection.setFollowRedirects(true);
    httpConnection.setRequestMethod("HEAD");
    httpConnection.connect();
    System.out.println("Response = "+httpConnection.getResponseCode());
    catch(Exception e) {
    // print exception
    Regards,
    Harini S

  • Passing parameters to Transactions from Web dynpro Application through ITS

    Hi,
    i need to call a transaction from Web dynpro through ITS. On action from web dynpro application, i am concatenating the respective parameters mentioned below along with URL. The problem is one parameter(VARIANT) is being passed to the t-code CAT3 correctly. The next mandatory parameter(PERNR) is not passed to the respective field.Here is the URL Code:
    CONCATENATE 'http'
    '://' host ':' port
    '/sap/bc/gui/sap/its/webgui/?sap-client=&~transaction=' 'CAT3'
    '%20TCATST-VARIANT=' lv_name2 '&CATSFIELDS-PERNR=' lv_name1 INTO url.
    Called T-Code CAT3
    Passing Parameters are:
    Data Profile TCATST-VARIANT
    Pernr: CATSFIELDS-PERNR

    Pradeep,
    iam trying to pass values from webdynpro application to SAP GUI Transaction
    here is the sample code which iam using
    CONCATENATE  'http://s0164dep01.adta.uae:50000/irj/portal/interop?NavigationTarget=pcd:portal_content/Testing/trn_iw33?'
    '%20CAUFVD-AUFNR='
                 'ApplicationParameter=CAUFVD-AUFNR='
                  lv_workorder';'
              'DYNP_OKCODE=SHOW'
             INTO lv_url.
    i could'nt able to succed as its displaying page not found exception.
    Help me on this to proceed further
    Regards
    Jaipal.E

  • CAF DB Update for CAF Entity Service from Web Dynpro

    Hi all,
    I have created an entity service in CAF called “Contacts’ which contains the following attributes.
    phoneNo
    cellNo
    emailID.
    Another entity service called "Person" is created. This contains the following attributes.
    personId
    personName
    personAddr
    contactsRef. (Cardinality -> 0..n , Relational Type -> Composition)
    That means Contacts entity service is used within Person entity service. Now it is working fine within CAF service browser. Now the Web Dynpro DC of CAF application is used within another custom Web Dynpro DC project. I want to store data from Web Dynpro.
    Within the context of component controller of  Web Dynpro the structure is like
    APerson
         |_ personId
         |_ personName
         |_ personAddr
         |_ contactsRef       
                    |_ phoneNo (Under contactsRef)
                    |_ cellNo (Under contactsRef)
                    |_ emailID (Under contactsRef)
    So I have written the following code within web dynpro custom method.
    APerson person = PersonServiceProxy.create();
    java.util.List ls = new ArrayList();
    for(int i=0; i<4;i++)
    AContacts contact = ContactsServiceProxy.create();
    contact.setCellNo("9092130156");
    contact.setEmailID("[email protected]");
    contact.setPhoneNo("432258");
    contact.getAspect().sendChanges();
    ls.add(contact);
    person.setRelatedModelObjects("contactsRef",ls);
    person.setPersonID("9999");
    person.setPersonName("xyz");
    person.setPersonAddr("ABC, KOL");
    wdContext.nodeAPerson().bind(person);
    person.getAspect().sendChanges();
    CAFServiceFactory.getServiceFacade(idendityDefinition.class);
    After saving the data from Web Dynpro I am trying to test it from CAF service browser. But I am getting only the parent row. I mean only the value of personId, personName and personAddr fields which I have stored from Web Dynpro. But no value is coming within the table for Contacts entity service for composition relation.
    Could anybody help me how can I solve my problem?
    Thanks & Regards
    Chandan
    Message was edited by:
            Chandan Jash

    Hi Chandan,
    Can you do person.getRelatedModelObjects() and get the contact object, to check whether it is null, also check in the CAF DB whether the data you entered is present.
      I am not sure the code is actually adding the contact model object to person.
    Go thru this SDN Blog on usage of the CMI API's, there is a link for CMI documentation in it which might help you get the right code for adding the contact object.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/cef4f43e-0d01-0010-db84-ede25c874115.
    award points if  info is helpful
    Regards,
    Anish

  • Calling Batch input from Web Dynpro - any alternatives for table updates?

    Hi!
    I am asked to create a screen in Web Dynpro for the GJ30 transaction (JV Cutback mapping of WBS' elements). I created a remote enabled function module which call batch input for GJ30 . Testing the Function modules direclty goes fine, but not calling the function module from WD. then I get the same error message as when I once tried to call SAP GUI from Web Dynpro ( Call transaction /submit program).
    My next step is to try to create a batch input session (instead of call transaction) and run it using rsbdcsub, and then check the result of the run. But maybe this will fail of the same reason as well, and I suppose this will make the user waiting longer for the response .
    I read somewhere that Web Dynpro does not support batch Input. But what can you do when there are no standard BAPI's for the update you want to do in SAP ?  We are not supposed to do direct table updates.  
    Anyone who have struggled with the same issues and found a solution??
    regards, Tine

    Hi,
    as BDC is calling screens and in Webdynpro ABAP you cannot use SAP GUI sceeen, you are getting short dump.
    Refer CNTL_SYSTEM_ERROR in webservices from r/3 system
    Thanks,
    Chandra

  • Authorization error calling a XI web service from Web Dynpro

    Hi all,
    I'm trying to communicate to XI from a Web Dynpro application but I get an Unauthorization error (401).
    I've generated a WSDL in XI and import it to web dynpro as a new Model. But when a I call the web service, the exception "Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized." appears.
    I don't know how to pass the right user and password from Web Dynpro, I've tried the web service from SOAP client tools and it works fine.
    I'll apreciate any help.
    Regards,
    Diego.

    Hola mi  nombre es Luis,
    Creyendo que eres español te escribo en tal idioma.
    He visto que a ti también te devolvía un error de autentificación 401, y que lo subsanaste, pero a mi con la solución que te dieron no me vale, ya que implemento el código que te ofrecieron para arreglarlo y ahora me da un fallo de "Server Error" poniendo en usuario y password, los correspondientes a XI.
    +Request_MI_outTurnoverDetailsDisplay_MI_outTurnoverDetailsDisplay req=new Request_MI_outTurnoverDetailsDisplay_MI_outTurnoverDetailsDisplay();
    wdContext.nodeRequest_MI_outTurnoverDetailsDisplay_MI_outTurnoverDetailsDisplay().bind(req);
    req._setUser("username");
    req._setPassword("password");+
    No sé si es que ese usuario y contraseña son otros distintos.
    Si pudieras ayudarme, te lo agradecería.
    Un saludo, Luis

  • Portal dynamic iView from Web Dynpro ABAP?

    I wish to use a "Dynamic iView" from a Web Dynpro ABAP application, but it appears the API is only available in Web Dynpro Java.  Can this feature be used from Web Dynpro ABAP, or can this be accomplished in another way?
    Scenario: I have two iViews on a page, one Web Dynpro ABAP and another iView whose source I want to change dynamically based on something a user clicks in the Web Dynpro ABAP.
    Dynamic iView:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/44/a72c155df77038e10000000a422035/frameset.htm

    So you are suggesting the WDA fires an event to a new WDJ that we would need to create that would in turn use the Dynamic iView service mentioned in that help document?

  • SRM 7.0 find transparent table name from Web dynpro Component

    Hi ,
    I am trying to find the transparent table name from Web dynpro component dictionary structure. I am working in SRM 7.0. Please let me know how to find the transpartent table for a field.
    Thanks,
    Monica

    hi,
    your question is very unclear and does not relate to performance.
    SRM uses webdynpro ABAP so the recommendation will not help.
    Do you need a technical UI element?
    Or the application table where the business data of an UI is stored???
    If it is the later, then you can use the SQL trace, change to element you are interested in, and trace it. The table should appear in the trace in connection which an UPDATE command. Still a bit cimbersome.
    Siegfried

  • Insert multiple records from web dynpro

    Hi,
    How to insert multiple records from web dynpro applications to SAP backend system ?
    Thanks,
    sowmya

    Hi soumya..
       if want to multiple row selected  then save into the Sap back End..
       value node--table.
    Backend value node=table_bapi_input;
       back end internal table --tableback.
    int size=wdcontext.nodeTable().size();
    int lead=wdcontext.nodeTable().getLeadSelection();
    table_bapi_input in=new table_bapi_input();
    wdcontext.nodetable_bapi_input().bind(in);
       for(int i=size-1;i>0;i--){
    tableback set=new tableback()
    if(lead==i || wdcontext.nodeTable().ismultiSelection(i)){
    set.setName(wdContext.nodeTable().getTableElementAt(i).getName();
    in.addZc_input(set);
    wdContext.currenttable_bapi_inputElement().modelobject().excute();
    wdContext.nodeOutput().invalidate();
    thanks
    jati

  • HTTP form post from Web Dynpro Java Application without opening new window

    Hi Experts,
    We are trying to submit form data to an external URL from Web Dynpro Java application. We are achieving this with the following piece of code.
      try
       strPrintContent="<html>"+
         "<head>"+
         "<script type=\"text/javascript\">"+   
         "function myfunc () "+
         "{"+
         "var frm = document.getElementById(\"paymentForm\");"+
         "frm.submit();"+
         "}"+
         "</script>"+
         "</head>"+
         "<body onLoad=myfunc()>"+
         "<form id=paymentForm  method=post action=\""+merchantURLPart+"\">"+
         "<INPUT type=hidden name=username value="+userName+">"+
         "<INPUT type=hidden name=pass value="+passWord+">"+
         "<INPUT type=hidden name=senderid value="+senderID+">"+    
         "<INPUT type=hidden name=dest_mobileno value="+mobile+">"+
         "<INPUT type=hidden name=message value='"+msg+"'>"+
         "<INPUT type=hidden name=response value="+response+">"+
         "</form>"+
         "</body>"+
         "</html>";    
      IWDWebResource webResource = WDWebResource.getWebResource(strPrintContent.getBytes(),WDWebResourceType.HTML);
      IWDWindow window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(webResource.getAbsoluteURL(),"WBSEDCL");
      window.show();
      catch(Exception e)
      wdComponentAPI.getMessageManager().reportException("Error : "+e.toString(),false);
    But it opens another window. We dont need that. We have to stay on the same window.  Please suggest what can be done.

    Hi,
    You can create a HTML file with the request post parameters and the external URL something like this:
    public java.lang.String GetRedirecturl( )
    // External URL
    String html = "<html><head></head><body onload=\"load()\"> " +
    "<form id=\"form1\" action=\"https://www.abc.com/xyz.jsp\" method=\"POST\">" +
    // Post Parameters
    "<INPUT TYPE=\"HIDDEN\" NAME=\"Param1\"VALUE=\""+Param1Value+"\">"+
    "<input name=\"sap-wd-resumeurl\" type=\"hidden\"/>" +
    "</form> " +
    "" +
    "<script>" +
    "function load(){" +
    "var loc = window.location.search.substring(1);" +
    "var queryString = loc.split(\"sap-wd-resumeurl=\");" +
    "if(queryString.length > 0)" +
    "{" +
    "var resumeURL = queryString[1].split(\"&\");" +
    "if(resumeURL.length >= 0)" +
    "{" +
    " document.forms['form1'].elements['sap-wd-resumeurl'].value= unescape(resumeURL[0])" +
    "}" +
    "}" +
    "document.getElementById('form1').submit();" +
    "}" +
    "</script>" +
    "</body> </html>";
    String redirectUrl = "";
    byte[] byteArrayHtmlData = null;
    try {
      byteArrayHtmlData = html.getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
      wdComponentAPI.getMessageManager().reportException("Internal error occurred. Please try after some time",true);
    IWDResource htmlResource = WDResourceFactory.createCachedResource(new ByteArrayInputStream(byteArrayHtmlData), "Redirect.html", WDWebResourceType.HTML, true);
    redirectUrl = htmlResource.getUrl(WDFileDownloadBehaviour.AUTO.ordinal());
    return redirectUrl;
    Hope this will be helpful.
    Regards,
    Anurag

  • CAF DB update from Web Dynpro

    Hi all,
    I have created an entity service in CAF called “Contacts’ which contains the following attributes.
    phoneNo
    cellNo
    emailId.
    Another entity service called "Person" is created. This contains the following attributes.
    personId
    personName
    personAddr
    contactsRef. (Cardinality -> 0..n  , Relational Type -> Composition)
    That means Contacts entity service is used within Person entity service. Now it is working fine within CAF service browser. Now the Web Dynpro DC of CAF application is used within another custom Web Dynpro DC project. I want to store data from Web Dynpro. So I have written the following code within web dynpro custom method.
    APerson person = PersonServiceProxy.create();
         java.util.List ls = new ArrayList();
        for(int i=0; i<4;i++)
        AContacts contact = ContactsServiceProxy.create();
         contact.setCellNo("9092130156");
         contact.setEmailID("[email protected]");
         contact.setPhoneNo("432258");
         contact.getAspect().sendChanges();
        ls.add(contact);
         person.setRelatedModelObjects("contactRef",ls);
         person.setPersonID("9999");
         person.setPersonName("xyz");
         person.setPersonAddr("ABC, KOL");
         wdContext.nodeAPerson().bind(person);
         person.getAspect().sendChanges();
         CAFServiceFactory.getServiceFacade(idendityDefinition.class);
    After saving the data from Web Dynpro I am trying to test it from CAF service browser. But I am getting only the parent row. I mean only the value of  personId, personName and personAddr fields which I have stored from Web Dynpro. But no value is coming within the table for Contacts entity service for composition relation.
    Could anybody help me how can I solve my problem?
    Thanks & Regards
    Chandan

    Hi Chandan,
    Can you do person.getRelatedModelObjects() and get the contact object, to check whether it is null, also check in the CAF DB whether the data you entered is present.
      I am not sure the code is actually adding the contact model object to person.
    Go thru this SDN Blog on usage of the CMI API's, there is a link for CMI documentation in it which might help you get the right code for adding the contact object.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/cef4f43e-0d01-0010-db84-ede25c874115.
    award points if  info is helpful
    Regards,
    Anish

Maybe you are looking for

  • How to Install Plug-in for PS cs5 to open RAW (.NEF) file for Nikon D810 Camera

    I need someone to walk me through how to install a Plug-in for PS cs5 to open RAW (.NEF) file for Nikon D810 Camera. I haven't used photoshop in ages and I got a new camera. I have been on the phone with Adobe (no help) and spent a couple of hours on

  • Can't Update Software from the App Store

    The app store will not download any sort of update (iTunes or System Update). I click "install" and I have to "Agree" twice. Then I select "Download & Restart". The progress bar pops up and says "installing" then goes away. Under "Updates Installed i

  • Automatic Creation of Documents using Document Templates in UCM

    Hi, We need to cater following requirements in my project and we are using Oracle UCM 11g. 1. Can we create documents automatically using some document templates? i.e.     Auto-generation of documents based on message input and templates. 2. Can we e

  • I would like all links to open in the active tab, unless I command-click on the link.

    I've searched for answers to this question, and I was able to adjust the values for preferences in about:config so that all links open in the active tab, but after doing so I am unable to command-click to open a link in a new tab. Is there any way to

  • How to enable oci8 plugin in RHEL5.3

    Hi everyone, I'm quite new to Oracle in Linux and had a problem. Currently, I installed Oracle and PHP + Apache on my Red Hat Enterprise Linux 5.3 but I do not know how to enable oci extension for php. Please help me with the simplest way ! This proj