Find session id from Webdynpro in 04s?

Do you know how to find the j2ee session id from webdynpro?
In NW 2004, we used this code:
          HttpServletRequest request = ((IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest();
          HttpSession session = request.getSession();
          String sessionId = session.getId();
How can you find this using 2004s with the IWDProtocolAdapter class??

Hi,
   Modifying your posted code a bit:
HttpServletRequest request = (HttpServletRequest) WDProtocolAdapter.getProtocolAdapter().getRequestObject().getProtocolRequest();
HttpSession session = request.getSession();
String sessionId = session.getId();
Regards,
Satyajit.

Similar Messages

  • Call stateless session bean EJB 2.0 from Webdynpro Java UI

    Hello,
    Can someone please tell me asto how to call a stateless session bean EJB 2.0 from Webdynpro Java UI?
    The NWDS version is 7.0.
    Thanks and Regards,
    Arya

    Hi Aryadipta
    Please check this pdfs
    https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b00917dc-ead4-2910-3ebb-b0a63e49ef10&overridelayout=true
    Steps for calling stateless session bean in Webdynpro java
    Go to NWDS -> open perspective ->j2ee
    select EJB Module Project ->create a project with name
    Open the Project -->RC on ejb-jar.xml -> Select new --> EJB
    Give name to EJB Bean (First letter should be in capital letters)
    select the type of bean as Stateless session bean and give the package name to store that EJB bean.
    After that Expand ejb-jar.xml and then select the <projectEJB> 
    Double click on this on method  tab double click you will get business method where we will create the methods for business logic
    Double click on projectEJB and then RC on bean tab and write required business logic in bean window as follows(based on requirement we will design a business logic).
    After writing the business logic go to project -> rebuild
    Till now we have created one EJB jar file
    then go to File-->Enterprise Application Project -->create a project (projectEAR)
    After creating a project click on next-> here we will have ear projects and then we select specific project required for our application.(here select projectEJB)
    After that Calculate EAR project will be available on j2ee explorer.
    Right click on <Bean> here
    select New->Web Service->give a name to webservice and select Default configuration type as simple SOAP
    -->click next -> Finish.
    That webservice and related are created in ejb-jar.xml .
    Expand the ejb-jar.xml.and double click on < webservice>
    RC ProjectEJB -> Build EJB Archive RC on CalculateEAR ->Build applicationarchive.
    Expand the projectEAR->RC on CalculateEAR.ear->Deploy to J2EE Engine
    Double click on calculateEAR.ear ->Webservice navigator tab ->we eill servers expand the node
    select the specific WebService  
    Here we test the webservice by click on Test and test it.
    After that go to Web dynpro perspective ->create one webdynpro Project and one component
    RC on model> Select import Web Service model(last)>give model name and package
    and select radio button as local file system or URL
    Go to WSnavigator->copy the WSDL path and paste it in model WSDL path and click on finish.
    from here onwards steps are same as that adaptive RFC model
    Hope it helps
    Thanks
    Tulasi Palnati
    Edited by: Tulasi Palnati on Aug 26, 2009 12:15 PM
    Edited by: Tulasi Palnati on Aug 26, 2009 12:43 PM

  • Capturing session id in WEBDYNPRO environment

    Hi Friends,
    I am trying to pass the parameters from webdynpro to BSP using the set server cookies technique.  Initially i did it through the same technique from BSP to Webdynpro and i am successful in it.  However i am unable to apply the same from webdynpro to BSP. 
    Below is the one i am using.
    CALL METHOD cl_bsp_server_side_cookie=>set_server_cookie
        EXPORTING
          name                  = 'modeldata2'
          application_name      = application_name
          application_namespace = application_namespace
          username              = username
          session_id            = session_id
          data_name             = 'modeldata2'
        importing
          data_value            = ostream.
    Here the parameter 'session_id' is picked up from the available RUNTIME object of BSP.  And rest of all parameters are some string constants which i could find out. 
    What is the equivalent object for RUNTIME in webdynpro?
    And how do i get the session id in the webdynpro environment.
    Any inputs on this?
    regards
    Nalinikanth.

    Thanks for all tthe people who took a look at my question patiently.  I got the resolution for the question.  I missed out putting the cookie retention time while setting the cookie.

  • Servlet from Webdynpro

    Hi,
    Anyone tried launching a servlet from a webdynpro application.
    Were you able to manage the session in both the applications?

    We are using similar kind of application where we are lauching a servlet from WebDynpro application. But our application was not required to maintain common session.
    But I guess its possible to do so, you can try this:
    String servURL = WDWebContextAdapter.getWebContextAdapter().encodeRedirectURL("/applicationcontext/servletalias?requestparameters");
    IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow(servURL,"Title here",false);
    window.setWindowSize(1024,640);
    window.setWindowPosition(WDWindowPos.CENTER);     
    window.open();
    You can find documentation for
    <a href="https://help.sap.com/javadocs/NW04/current/wd/com/sap/tc/webdynpro/services/sal/adapter/api/IWDWebContextAdapter.html#encodeRedirectURL(java.lang.String)">WDWebContextAdapter.getWebContextAdapter().encodeRedirectURL</a>
    Regards
    Abhilash

  • Error when Interative Adobe Form is called from Webdynpro ABAP.

    Hi Experts,
    I trying to call a Interactive adobe form from ABAP Webdynpro application but I am facing the below error.
    Line: -
    The following error text was processed in the system GJD : User session (HTTP/SMTP/..) closed after timeout
    The error occurred on the application server az18u021_GJD_01 and in the work process 0 .
    The termination type was: ERROR_MESSAGE_STATE
    The ABAP call stack was:
    Method: PREPROCESS_REQUEST of program CL_WDR_CLIENT_ABSTRACT_HTTP===CP
    Method: IF_HTTP_EXTENSION~HANDLE_REQUEST of program CL_WDR_MAIN_TASK==============CP
    Method: EXECUTE_REQUEST_FROM_MEMORY of program CL_HTTP_SERVER================CP
    Function: HTTP_DISPATCH_REQUEST of program SAPLHTTP_RUNTIME
    Module: %_HTTP_START of program SAPMHTTP
    Line: -
    When I uncheck the enabled property of the Interactive From in the Page of the WebDynpro I am able to execute the application successfully.But the Adobe form behaves as a Static Form when I uncheck the enabled property.
    So kindly provide your valuable suggestions to avoid the above error when I am calling a Interactive adobe form from Webdynpro ABAP.
    Thanks in Advance.
    Regards,
    Arun.

    Hello,
    Hello, are you sure you have your ADS credentials configured correctly and valid? I guess you know that is the only difference between clicking enabled on true or false. If you are not sure, you can use SE38, search for FP_* and pick some reports to check the licencing. The names of the reports are good enough to recognize the right one.
    Or maybe that is a security problem? Have you checked the ADS_ERROR string? Did you use the ADS trace?
    check: http://help.sap.com/saphelp_nw70/helpdata/en/2c/241a427ff6db2ce10000000a1550b0/content.htm
    and especially note 999998
    Regards, Otto

  • Re: [iPlanet-JATO] Re: onBeforeRequest(); Finding requested view from requestContext

    If you want to stop a JATO request in its tracks, you have a little black
    magic at your disposal: you can throw a CompleteRequestException. This
    indicates to the JATO infrastructure that it should immeditately stop
    handling the request, but not generate an error, as the develper has taken
    full control. You can generally throw this error from anywhere, at any
    point--it is a RuntimeException, and is "tunneled" through other exception
    handlers where appropriate.
    In your scenario, you want to check if the user is logged in, and if not,
    save the target URL using the parsePathInfo() method. Then, forward to the
    login page and then throw a CompleteRequestException.
    Todd
    ----- Original Message -----
    From: "nickmalthus" <nickmalthus@h...>
    Sent: Monday, January 07, 2002 3:05 PM
    Subject: [iPlanet-JATO] Re: onBeforeRequest(); Finding requested view from
    requestContext
    I guess what I am thinking about doing is capturing the requested URL,
    i.e. /appname/modulename/RequestName. In the onBeforeRequest(). I
    would then check to see if the user is logged in, and if not, set the
    URL in the session(or page session of the Login bean) and forward to
    the Login viewbean using the viewbean manager. Inside the login view
    in the handleSubmit() method I would authenticate the user and then
    get the URL out of the session (or pagesession). I would then
    magically get the ViewBean/Command object for the URL or otherwise
    "forward the request" as if the user had typed in
    /appname/modulename/RequestName, which is the behavior I am trying to
    acheive.
    It turns out I cannot forward in the onBeforeRequest() as it will
    output the viewbean and then continue to process the request which in
    turn trys to do a RequestDispatcher().forward after data has been
    written to the stream which does not bode well with the servlet
    container. Thus, it appears I have no control of the request in the
    onBeforeRequest() method. Is this correct?
    In light of this new observation I am now going to create a base view
    class that all views will extend from and override the
    onSecurityCheck() method to forward to my login bean. If I can't find
    any other way, I will get the URL from the page session and do a
    response.sendRedirect() to the URL.
    Thanks for the help!
    --- In iPlanet-JATO@y..., "Craig V. Conover" <craig.conover@s...> wrote:
    The problem is that you don't know what the target view is until it has
    been forwarded to.
    Think about it... the request handling view bean (or command object)has
    the request handler that has the code that will ultimately forward to
    another view bean. This is code that you have written. So, until that
    forwardTo() is invoked, there is no notion of a "target page".
    What you do know is which "page" (view bean) the request is coming from
    (the handling view bean or command class). You can get this from the
    HttpServletRequest. The attribute name is "viewBean".
    So you can get the view bean name by doing the following inonBeforeRequest:
    <HttpServletRequest>.getAttribute("viewBean");
    But I suspect this is not going to solve your current issue.
    You could add the target page name to the page session. If there ismore
    than one possible target page, it might get a little more involved.
    Let me know if the use of page session needs further explanation.
    c
    For more information about JATO, including download information, pleasevisit:
    http://developer.iplanet.com/tech/appserver/framework/index.jsp

    If you want to stop a JATO request in its tracks, you have a little black
    magic at your disposal: you can throw a CompleteRequestException. This
    indicates to the JATO infrastructure that it should immeditately stop
    handling the request, but not generate an error, as the develper has taken
    full control. You can generally throw this error from anywhere, at any
    point--it is a RuntimeException, and is "tunneled" through other exception
    handlers where appropriate.
    In your scenario, you want to check if the user is logged in, and if not,
    save the target URL using the parsePathInfo() method. Then, forward to the
    login page and then throw a CompleteRequestException.
    Todd
    ----- Original Message -----
    From: "nickmalthus" <nickmalthus@h...>
    Sent: Monday, January 07, 2002 3:05 PM
    Subject: [iPlanet-JATO] Re: onBeforeRequest(); Finding requested view from
    requestContext
    I guess what I am thinking about doing is capturing the requested URL,
    i.e. /appname/modulename/RequestName. In the onBeforeRequest(). I
    would then check to see if the user is logged in, and if not, set the
    URL in the session(or page session of the Login bean) and forward to
    the Login viewbean using the viewbean manager. Inside the login view
    in the handleSubmit() method I would authenticate the user and then
    get the URL out of the session (or pagesession). I would then
    magically get the ViewBean/Command object for the URL or otherwise
    "forward the request" as if the user had typed in
    /appname/modulename/RequestName, which is the behavior I am trying to
    acheive.
    It turns out I cannot forward in the onBeforeRequest() as it will
    output the viewbean and then continue to process the request which in
    turn trys to do a RequestDispatcher().forward after data has been
    written to the stream which does not bode well with the servlet
    container. Thus, it appears I have no control of the request in the
    onBeforeRequest() method. Is this correct?
    In light of this new observation I am now going to create a base view
    class that all views will extend from and override the
    onSecurityCheck() method to forward to my login bean. If I can't find
    any other way, I will get the URL from the page session and do a
    response.sendRedirect() to the URL.
    Thanks for the help!
    --- In iPlanet-JATO@y..., "Craig V. Conover" <craig.conover@s...> wrote:
    The problem is that you don't know what the target view is until it has
    been forwarded to.
    Think about it... the request handling view bean (or command object)has
    the request handler that has the code that will ultimately forward to
    another view bean. This is code that you have written. So, until that
    forwardTo() is invoked, there is no notion of a "target page".
    What you do know is which "page" (view bean) the request is coming from
    (the handling view bean or command class). You can get this from the
    HttpServletRequest. The attribute name is "viewBean".
    So you can get the view bean name by doing the following inonBeforeRequest:
    <HttpServletRequest>.getAttribute("viewBean");
    But I suspect this is not going to solve your current issue.
    You could add the target page name to the page session. If there ismore
    than one possible target page, it might get a little more involved.
    Let me know if the use of page session needs further explanation.
    c
    For more information about JATO, including download information, pleasevisit:
    http://developer.iplanet.com/tech/appserver/framework/index.jsp

  • Passing Parameters via Post Method from Webdynpro Java to a web application

    Hello Experts,
    I want to pass few parameters from a web dynpro application to an external web application.
    In order to achieve this, I am referring to the below thread:
    HTTP Post
    As mentioned in the thread, I am trying to create an additional Suspend Plug parameter (besides 'Url' of type String) with name 'postParams' and of type Map.
    But when I build my DC, I am getting the same error which most of the people in the thread have mentioned:
    Controller XXXCompInterfaceView [Suspend]: Outbound plug (of type 'Suspend') 'Suspend' may have at most two parameters: 'Url' of type 'string' and 'postParams' of type 'Map'.
    I am using SAP NetWeaver Developer Studio Version: 7.01.00
    Kindly suggest if this is the NWDS version issue or is it something else that I am missing out.
    Also, if it is the NWDS version issue please let me know the NWDS version that I can use to avoid this error.
    Any other suggestion/alternative approach to pass the parameters via POST method from webdynpro java to an external web application apart from the one which is mentioned in the above thread is most welcome.
    Thanks & Regards,
    Anurag

    Hi,
    This is purely a java approach, even you can try this for your requirement.
    There are two types of http calls synchronous call or Asynchronous call. So you have to choose the way to pass parameters in post method based on the http call.
    if it is synchronous means, collect all the values from users/parameters using UI element eg: form and pass all the values via form to the next page is nothing but your web application url.
    If it is Asynchronous  means, write a http client in java and integrate the same with your custom code and you can find an option for sending parameters in post method.
    here you go and find the way to implement Asynchronous  scenario,
    http://www.theserverside.com/news/1365153/HttpClient-and-FileUpload
    http://download.oracle.com/javase/tutorial/networking/urls/readingWriting.html
    http://digiassn.blogspot.com/2008/10/java-simple-httpurlconnection-example.html
    Thanks & Regards
    Rajesh A

  • Where to find 'com.sap.tc.webdynpro.repository.api' file in EP server

    Hi All,
    I am getting below exception while deploying a custom component in sand-box server.
    Failed to deploy application freescale.com/c_uwl for deployment state listener com.sap.tc.webdynpro.serverimpl.wdc.repository.RepositoryContainerHook.
    [EXCEPTION]
    com.sap.tc.webdynpro.repository.RepositoryRuntimeException: Failed to deploy the file '/usr/sap/RIA/JC30/j2ee/cluster/server0/./temp/webdynpro/public/freescale.com/c_uwl/webdynpro/ComponentInterfaces/com.sap.netweaver.bc.uwl.ui.UWLCustomDetail/UWLCustomDetail.xml' into the database. Reason: Development Object 'sap.com/tckmcbc.uwl.ui~wd_ui' contains already same repository content. Hint: fully qualified name of the repository VMO must be globally unique.
            at com.sap.tc.webdynpro.repository.deploy.RepositoryUpdateManager.checkVMOsExistInOtherDC(RepositoryUpdateManager.java:504)
            at com.sap.tc.webdynpro.repository.deploy.RepositoryUpdateManager.deployRepositoryContent(RepositoryUpdateManager.java:98)
            at com.sap.tc.webdynpro.serverimpl.wdc.repository.RepositoryContainerHook.onDeploy(RepositoryContainerHook.java:232)
    It seems it is using checkVMOsExistInOtherDC method from RepositoryUpdateManager.java file.
    I want to remove this method from that java file.
    Can any one please tell me at which location in server i can find that RepositoryUpdateManager.java file.
    Or from where i can find 'com.sap.tc.webdynpro.repository.api'  file, so that i can trace that jave file.
    Regards,
    Sambaran Chakraborty

    Jiandong,
    Add the required jar webdynprobasesvrc.jar file from follwoing path and check if the imports are added correctly.
    C:\Program Files\SAP\IDE\CE\eclipse\plugins\com.sap.tc_.wd_.basesrvc_1.0.0.071030103936\lib
    Chintan

  • How to find session of process executed

    Hello
    I want to find out particular session from where process is running. My procedure is running from java application. I want to find out which session has generated/called process. i.e If user U1 and U2 has running process from screen, then in process logs i m not able to idenitfy which session has geneated what logs.
    My requirement is i want to find out logs with user or session information. This is required to find out concurrency issues of process.
    I have tried with v$session, however from that table i m not able to find out particular session. Please help.
    Thanks in advance

    In a 3 tier architecture the database tier sees the application tier as the client - not the presentation layer user. The data tier has no idea what is beyond the application tier.
    If you want the data tier to know who/what the presentation tier client is, the application tier has to pass that data to the data tier.
    One method in Oracle is for the application tier to use the [SET_CLIENT_INFO|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_appinf.htm#CHEJCFGG] call of the DBMS_APPLICATION_INFO PL/SQL package.
    Another method is to use a CONTEXT to set name-space variables in that Oracle session equal to end-user details.

  • How to Execute the Business objects created in ABAP from webDynpro applicat

    Wht is the steps , or where the help documents are available for accessing the Business objects created in ABAP or R/3 systems from webDynpro project.

    Hello Vishal,
    I couldn't find any useful documents for your purpose.
    However i had a similar requirement and had implemented the same using GCP APIs. But before i send you the code help, i would like to know your exact requirement. What are you trying to achieve? Are you just wanting to execute the BO and get the result? Or is your requirement has got something more to do?
    Regards,
    Sudeep.

  • Open DMS from webdynpro

    Hi all!.
    How can I open an attachment (file) from DMS (document management services)  txn: CV02N  in R/3 from webdynpro abap application??.
    Thanks in advance.
    Ana

    Ana,
    I solve the problem.
    I use 2 RFC's. In the first one I use a join with DRAD, DRAT and DRAW to show in me WD app what's the documents attached. fallow the code.
    function yone.
    ""Interface local:
    *"  IMPORTING
    *"     VALUE(NR_CONTRATO) TYPE  VBELN_VA
    *"  TABLES
    *"      TDOCANEX STRUCTURE  YSWSD014
    *"      TRETORNO STRUCTURE  BAPIRETURN
      tables: vbap.
      types: begin of s_objky,
             sign   type c length 1,
             option type c length 2,
             low    type objky,
             high   type objky,
             end of s_objky.
      data: begin of it_teste occurs 0,
        var1 type i,
        var2 type c,
        var3 type char4,
      end of it_teste.
      data:  v_item type posnr_va,
             qtdlin type i,
             teste type range of drad-objky,
             teste_line like line of teste.
    "UNPACK preenche com ZERO a esquerda com o tamanho do campo
      unpack nr_contrato to nr_contrato.
    "joga o campo POSNR da tabela VBAP em v_item se o campo vbeln for igual ao nr. do contrato
      select posnr
      from vbap
      into v_item
      where vbeln = nr_contrato.
        unpack v_item to v_item.
    "cria uma tabela  teste com os campos sign, option e low. Joga sempre I e EQ nos 2 primeiros e
    "mescla nr_contrato com v_item e joga no campo low. Atualiza (APPEND a tabela teste).
        teste_line-sign = 'I'.
        teste_line-option = 'EQ'.
        concatenate nr_contrato v_item into teste_line-low.
        append teste_line to teste.
      endselect.
    "pega alguns campos das tabelas drad, drat e draw (a, b e c) e joga tudo (INNER JOIN) em teste.
      select adoknr bdktxt cadatum cdappl
       into corresponding fields of table tdocanex
       from ( drad as a inner join drat as b on bdoknr = adoknr )
       inner join draw as c on cdoknr = adoknr
       where a~objky in teste.
    "varre a tabela  tdocanex, atribui o campo  vbeln  o nr. do contrato  e
    "modifica a tabela levando em conta o indice superior.
      loop at tdocanex.
        tdocanex-vbeln = nr_contrato.
        modify tdocanex index sy-tabix.
      endloop.
    "pega a quantidade de linhas em  tdocanex.
    "se for 0, joga E e Erro nos campos  type  e  message.
    "atualiza (APPEND) a tabela  tretorno.
      describe table tdocanex lines qtdlin.
      if qtdlin = 0.
        tretorno-type = 'E'.
        tretorno-message = 'Erro'.
      else.
        tretorno-type = 'S'.
        tretorno-message = 'Sucesso'.
      endif.
      append tretorno.
    endfunction.
    The another finds the bite array of the document.
    function ytwo.
    ""Interface local:
    *"  IMPORTING
    *"     VALUE(SISTEMA) TYPE  DTTRG DEFAULT 'PORTAL'
    *"     VALUE(ARQUIVO) TYPE  FILEP OPTIONAL
    *"     VALUE(DOKAR) TYPE  DOKAR OPTIONAL
    *"     VALUE(DOKNR) TYPE  DOKNR OPTIONAL
    *"     VALUE(DOKVR) TYPE  DOKVR OPTIONAL
    *"     VALUE(DOKTL) TYPE  DOKTL_D OPTIONAL
    *"  TABLES
    *"      PTX_DATA STRUCTURE  DRAO OPTIONAL
    *"      RETORNO STRUCTURE  BAPIRETURN OPTIONAL
      data: v_dms type draw-filep,
        v_caminho type draw-filep,
        lf_file_size type drao-orln,
        v_ip   type ni_nodeaddr,
        v_rows type i.
    DATA: ptx_data TYPE TABLE OF drao WITH HEADER LINE.
      if arquivo is initial.
        select single filep
          from draw
          into arquivo
          where dokar eq dokar and
          doknr eq doknr and
          dokvr eq dokvr and
          doktl eq doktl.
      endif.
      check not arquivo is initial.
    Seleciona caminho do servidor do Portal
      select single serverpath
        into v_dms
        from tdwd
        where dttrg = sistema.
      check sy-subrc eq 0.
      concatenate v_dms arquivo into v_caminho.
    Lê código armazenado da figura
      call function 'CV120_READ_FILE2TABLE'
        exporting
          pf_file    = v_caminho
        importing:
          pfx_file_size = lf_file_size
        tables
          ptx_data   = ptx_data
        exceptions
          read_error = 1
          others     = 2.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
              with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 into retorno-message.
      endif.
    Rotina para preenchimento de tabela retornada
      if lf_file_size is initial.
        describe table ptx_data lines v_rows.
        read table ptx_data index v_rows.
        lf_file_size = ptx_data-orln.
      endif.
    update table drao:
    documentkeys, counter, appl-no, sizes
      loop at ptx_data.
        ptx_data-mandt = sy-mandt.
        ptx_data-dokar = dokar.
        ptx_data-doknr = doknr.
        ptx_data-dokvr = dokvr.
        ptx_data-doktl = doktl.
        ptx_data-zaehl = sy-tabix.
        ptx_data-orln  = lf_file_size.
        modify ptx_data index sy-tabix.
      endloop.
    Seleciona Informação mais recente do usuário no mandante
      call function 'TH_USER_INFO'
        exporting
          client    = sy-mandt
          user      = sy-uname
          check_gui = 0
        importing
          addrstr   = v_ip.
      clear v_caminho.
      concatenate '
    ' v_ip 'SAPTEMPIMG.JPG' into v_caminho.
    Grava dados como arquivo em diretório compartilhado
      call function 'CV120_WRITE_TABLE2FILE'
        exporting
          pf_file    = v_caminho
        tables
          pt_data    = ptx_data
        exceptions
          open_error = 1
          others     = 2.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 into retorno-message.
      endif.
    DATA: it_frontend TYPE TABLE OF dms_frontend_data WITH HEADER LINE.
    MOVE 'PC' TO it_frontend-frontend_type.
    MOVE 'DEFAULT' TO it_frontend-hostname.
    MOVE 'WN32' TO it_frontend-winsys.
    CALL FUNCTION 'CV120_START_APPLICATION'
       EXPORTING
         pf_dappl       = 'JPG'
         pf_apptp       = '1'
         pf_file        = v_caminho
         pf_check_file  = 'X'
         ps_frontend    = it_frontend
       EXCEPTIONS
         error          = 1
         file_not_found = 2
         OTHERS         = 3.
    IF sy-subrc <> 0.
       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO retorno-message.
    ENDIF.
    Caso não haja nenhum erro
      commit work.
      wait up to 2 seconds.
      if retorno-message is initial.
        move 'Sucesso.' to retorno-message.
      endif.
      append retorno.
    endfunction.
    in my WD app I use the UI File download toh show the document in another window.
    I will send th main code.
      public void carregaDocumentosAnexos( )
        //@@begin carregaDocumentosAnexos()
         wdContext.currentYone_InputElement().setNr_Contrato(wdContext.currentContratoElement().getNroDocumento());
         esvaziarDocumentos();
         if(wdThis.executeRFC_Yone()){
                   IPrivateContratoDeAluguelComp.IAnexosNode soNode = wdContext.nodeAnexos();
                        for (int i = 0; i < wdContext.nodeTdocanex().size(); i++) {
                                  IPrivateContratoDeAluguelComp.IAnexosElement soElem = wdContext.createAnexosElement();
                                  soNode.addElement(soElem);
                                  soElem.setNroContrato(wdContext.nodeTdocanex().getTdocanexElementAt(i).getVbeln());
                                  soElem.setNroDocumento(wdContext.nodeTdocanex().getTdocanexElementAt(i).getDoknr());
                                  soElem.setDescricao(wdContext.nodeTdocanex().getTdocanexElementAt(i).getDktxt());
                                  soElem.setTipoArquivo(wdContext.nodeTdocanex().getTdocanexElementAt(i).getDappl());
                                  soElem.setData(wdContext.nodeTdocanex().getTdocanexElementAt(i).getAdatum());               
                                  soElem.setFileId(wdContext.nodeTdocanex().getTdocanexElementAt(i).getDoknr());
                                  soElem.setFileName(wdContext.nodeTdocanex().getTdocanexElementAt(i).getDktxt());
                                  soElem.setFileType(wdContext.nodeTdocanex().getTdocanexElementAt(i).getDappl());               
                             String fileExtension = null;
                             if ("WRD".equalsIgnoreCase(soElem.getTipoArquivo())) {
                                  resourceType = WDWebResourceType.DOC;
                                  fileExtension = ".doc";
                             }else if("JPG".equalsIgnoreCase(soElem.getTipoArquivo())){
                                  resourceType = WDWebResourceType.JPG_IMAGE;
                                  fileExtension = ".jpg";
                             }else if("PDF".equalsIgnoreCase(soElem.getTipoArquivo())){
                                  resourceType = WDWebResourceType.PDF;
                                  fileExtension = ".pdf";
                             }else if("GIF".equalsIgnoreCase(soElem.getTipoArquivo())){
                                  resourceType = WDWebResourceType.GIF_IMAGE;
                                  fileExtension = ".gif";          
                             }else {
                                  resourceType = WDWebResourceType.XLS;
                                  fileExtension = ".xls";                    
                             soElem.setDwldImgOnDemResource(this.create0ByteResource(soElem, calcAttrName, "documento"+fileExtension, resourceType));               
      public com.sap.tc.webdynpro.progmodel.api.IWDInputStream getAnexosDwldImgOnDemStreamCalc(IPrivateContratoDeAluguelComp.IAnexosElement element)
        //@@begin getAnexosDwldImgOnDemStreamCalc(IPrivateContratoDeAluguelComp.IAnexosElement)
         IWDInputStream onDemandStream = null;
         onDemandStream = WDResourceFactory.createInputStream(carregaImagem(element.getFileId()));
         return onDemandStream;
        //@@end
      //@@begin others
    final String CRIAR_CONTRATO = "1";
    final String CONVERTER_CONTRATO = "2";
    final String MODIFICAR_CONTRATO = "3";
    final String VISUALIZAR_CONTRATO = "4";
    final String SUBSTITUIR_CONTRATO = "5";
    final String SUBSTITUIR_PASSO2 = "5b";
    final String FECHAR_CONTRATO = "6";
    final String CONTRATO = "YCON";
    boolean validaDiarias = false;
    String ITEMDOGRUPO = "";
    BigDecimal VALORTARIFAACORDO = BigDecimal.valueOf(Integer.parseInt("0"));
    IUser sapUser = null;
    String roleName = null;
    private byte[] imageData;
    private String calcAttrName =
         IPrivateContratoDeAluguelComp.IAnexosElement.DWLD_IMG_ON_DEM_STREAM_CALC;
    private IPrivateContratoDeAluguelComp.IAnexosNode resourceNode;
    private IPrivateContratoDeAluguelComp.IAnexosElement resourceElement;
    private WDWebResourceType resourceType;
    Appends two bytes array into one.
    append src to end of dest array
    private static byte[] byteArrayAppend(byte[] src, byte[] dest) {
         byte[] z = new byte[src.length + dest.length];
         int pos = 0;
         if (dest.length == 0) {
              pos = 0;
         } else {
              pos = dest.length;
         System.arraycopy(dest, 0, z, 0, dest.length);
         System.arraycopy(src, 0, z, pos, src.length);
         return z;
    private IWDResource create0ByteResource( IWDNodeElement dataNodeElement, String calcAttrName, String resourceName, WDWebResourceType resourceType) {
         return WDResourceFactory.createResource(
              dataNodeElement.getAttributePointer(calcAttrName),
              resourceName,
              resourceType);
    private byte[] carregaImagem(String nroDocumento) {
         imageData = new byte[0];
         if (executeRFC_Ytwo(nroDocumento)) {
              IPrivateContratoDeAluguelComp.IPtx_DataNode ptx_DataNode =
                   wdContext.nodePtx_Data();
              for (int i = 0; i < ptx_DataNode.size(); i++) {
                   IPrivateContratoDeAluguelComp.IPtx_DataElement Ptx_DataElement =
                        ptx_DataNode.getPtx_DataElementAt(i);
                   //     get the image data from SAP
                   byte[] imgData = new byte[Ptx_DataElement.getOrblk().length];
                   imgData = Ptx_DataElement.getOrblk();
                   imageData = byteArrayAppend(imgData, imageData);
         return imageData;
      //@@end
    If you have any doubt pls write me!
    Best regards.

  • How to call session EJB from EP service in EP 7.0?

    Hi,
    I am trying to invoke stateless session EJB from my portal service. Both the service and EJB are deployed on the same server which is EP 7.0.
    I found [this|http://help.sap.com/saphelp_nw70/helpdata/EN/42/9ddcc9bb211d72e10000000a1553f6/frameset.htm] in SAP help and tried to implement it (added PrivateSharingReference to portalapp.xml and implemented the code), but everytime I try to lookup the session bean and cast it using P4ObjectBroker.narrow() method, I get java.lang.ClassCastException. The object found in JNDI and my portal service have different classloaders, so I suppose this is the problem, but I don't know how to handle it...
    Can anyone please help me?
    Regards,
    Tomas

    Hi Satya ,
              please go though following blog for used DC concept.
    Componentization of Webdynpro Application in CE7.1
    In netweaver 7.1 interface controler is abstract and component controller is implementing interface controller so the context data and methods have to be implemented by component controller

  • Problem in connecting to database from webdynpro for java

    Hi
    I have a problem in connecting to database from webdynpro application
    I am using oracle 10 express edition as database and was able to connect to database from a java application.But  was unable to connect from a webdynpro for java.
    <b>I guess webdynpro for java uses open sql instead of vendor sql(I looked in the visual admin ,DB is using open sql) so unable to connect to database.Am i right.?</b>
    Do i need to make any settings in the visual admin to make it work?
    How to solve this problem.Please give me pointers
    Thanks
    Bala

    Hi,
    For connecting to Oracle, either you can use the normal JDBC connectivty code directly which is given below :
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@Oracle_server_ip:Oracle port:SID of the Database","user_name","password");
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("your query");
    In case you want to fetch data through ejbs, these are the steps to be followed :
    1) Open the J2EE perspective
    2) Create an EJB Module project
    3) Right click on ejbModule, create a new EJB (select your EJB type)
    4) While creating the ejb itself, you can add business methods by clicking ‘Next’ in the UI. Another option is after creating the ejb, write the method in the bean, then select the method from ejb-jar.xml -> <bean name> ->method. Right click and select ‘propogate to local & remote’.
    5) Double click on ejb-j2ee-engine.xml. select your bean and specify a Jndi name for eg: “MyJndi”.
    6) Right click on the EJB project and add ‘classes12.zip’ file (provided by Oracle) to it’s build path. (under libraries tab). Also check the same file under ‘Order & Export’.
    7) Create an Enterprise Application project.
    8) Right click on the EJB module project and select add to EAR project, then select the created EAR project.
    9) Right click on the EJB project, select ‘Build EJB Archive’
    10) Right click on the EAR project, select ‘Build Application Archive’
    11) Open the WebDynpro perspective, open a new project, right click on the project ->properties. Do the following configurations :-
    • Java Build path - select the EJB project from ‘projects’ , check the selected project under ‘Order & Export’
    • Project references – select the EAR project
    • WebDynpro references – select ‘sharing references’ tab, click add & make an entry as : <vendor>/<EAR project name without .ear extension>
    You can find the vendor name under ‘application-j2ee-engine.xml’ file of the EAR project. By default it is ‘sap.com’. So if my EAR project’s name is ABC, my entry would look like ‘sap.com/ABC’
    12) Now the configurations are over and the EJB can be invoked by writing the client code inside the webdynpro component. Like:
    InitialContext context = new InitialContext();
    Object obj = context.lookup("MyJndi");
    MyEJBHome home = MyEJBHome)PortableRemoteObject.narrow(obj,MyEJBHome.class);
    MyEJB mybean = home.create();
    int a = 0;
    a= mybean.add(10,15);
    wdContext.currentContextElement().setSum(a);
    where ‘MyEJB’ is my EJB name and ‘MyJndi’ is my JNDI name
    To connect to Oracle , you can write the usual Java code (given below) as a business methos of the ejb (similar to add() method in the example). And access it like mybean.<businessMethodName>().
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@Oracle_server_ip:Oracle port:SID of the Database","user_name","password");
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("your query");
    Extracted from Re: Webdynpro and Oracle
    http://help.sap.com/saphelp_webas630/helpdata/en/b0/6e62f30cbe9e44977c78dbdc7a6b27/frameset.htm
    May be of use to understand the VA Conf /people/varadharajan.krishnasamy/blog/2007/02/27/configuring-jdbc-connector-service-to-perform-database-lookups
    Regards
    Ayyapparaj

  • Problem when calling session bean from main.

    Hi everyone
    I get the following error when calling a session bean from main(String args[]).
    Sep 3, 2008 9:11:13 AM com.sun.enterprise.appclient.MainWithModuleSupport <init>
    WARNING: ACC003: Application threw an exception.
    java.lang.NullPointerException
    at databasetest.Main.main(Main.java:26)
    Here is my code beneath.
    I'm using netbeans and glassfish application server.
    Everything is in the same project, called DatabaseTest, I also have deployed the application before running the client.
    I'm running the client as follows, right click on the DatabaseTest-app-client and select run.
    The client:
    package databasetest;
    import com.test.UsersFacadeRemote;
    import javax.ejb.EJB;
    import com.test.Users;
    public class Main {
        @EJB
        private static UsersFacadeRemote usersFacade;
        public static void main(String[] args) {
            Users users = new Users(12, 34);
            usersFacade.create(users);
    }The remote facade I'm calling:
    package com.test;
    import java.util.List;
    import javax.ejb.Remote;
    @Remote
    public interface UsersFacadeRemote {
        void create(Users users);
        void edit(Users users);
        void remove(Users users);
        Users find(Object id);
        List<Users> findAll();
    }The stateless bean:
    package com.test;
    import java.util.List;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    @Stateless
    public class UsersFacade implements UsersFacadeRemote {
        @PersistenceContext
        private EntityManager em;
        public void create(Users users) {
            em.persist(users);
        public void edit(Users users) {
            em.merge(users);
        public void remove(Users users) {
            em.remove(em.merge(users));
        public Users find(Object id) {
            return em.find(com.test.Users.class, id);
        public List<Users> findAll() {
            return em.createQuery("select object(o) from Users as o").getResultList();
    }

    looks like you're banging your head against the same brick wall as [I have done|http://forums.sun.com/thread.jspa?forumID=13&threadID=5317110] and [others have in the past|http://forums.sun.com/thread.jspa?forumID=136&threadID=5259913] if that's any consolation.
    Funny thing is, mine did actually work in the debugger but not when running!
    Strange thing that.
    I did initially interest someone from the developers but they couldn't really help, ended up saying : try instantiating your beans the EJB 2.1 way and see where that gets you. Yes that works but they promised us "hey no more dopey xml deployment descriptors just some cool annotations" didn't they?
    I've got the feeling were' missing something really obvious!
    Edited by: sebthebike on 03-Sep-2008 12:21

  • Looking up of a stateless session bean from an MDB

    Hi,
    I have been trying to invoke a method on a stateless session bean from an MDB on receipt of a message from a queue. The bean receives the message. Then it gets the initial context, but after this the following message appears:
    javax.naming.NamingException: Error instantation environment context for Message DrivenBean MyMDB: No location specified and no suitable instance of the type 'MySessionRemote' found for the ejb-ref <mySessionBean> at com.evermind.server.ejb.MessageDrivenHome.getEnvironmentContext(MessageDrivenHome.java:559)
    The session bean is in a seperate ear file. These are the deployment descriptors of the MDB:
    ejb-jar:
    <ejb-jar>
         <description>A Message-Driven Beans</description>
         <enterprise-beans>
         <message-driven>
              <description></description>
              <ejb-name>MyMDB</ejb-name>
              <ejbclass>MyMDB</ejb-class>
              <message-driven-destination>
              <jms-destination-type>javax.jms.Queue</jms-destination-type>
              </message-driven-destination>
              <ejb-ref>
              <ejb-ref-name>MySessionEJB</ejb-ref-name>
              <ejb-ref-type>Session</ejb-ref-type>
              <home>MySessionEJBHome</home>
              <remote>MySessionRemote</remote>
              </ejb-ref>
         </message-driven>
         </enterprise-beans>
         <assembly-descriptor>
         </assembly-descriptor>
    </ejb-jar>
    orion-ejb-jar
    <orion-ejb-jar>
    <enterprise-beans>
              <message-driven-deployment name="QueueProcessor" destination-location="jms/theQueue" connection-factory-location="jms/theQueueConnectionFactory">
              </message-driven-deployment>
         </enterprise-beans>
         <assembly-descriptor>
         </assembly-descriptor>
    </orion-ejb-jar>
    The lookup name which I give in MDB is:
    java:comp/env/MySessionEJB

    Hi,
        Thanks for your replies.I did as you had suggested.I added ejb-local-ref to the ejb-jar.xml and i provided ejb-ref as MyBean.
    My lookup code uses the string
    ctxt.lookup("localejbs\MyBean");
    But still i get Naming Exception.
    I tried something different yesterday.
    I changed the code to use
    InitialContext ctxt = new InitialContext();
    ctxt.lookup("localejbs/"+ pathfromJNDIRegistry);
    and this time i did not get Naming exception but i got RemoteException saying there was error loading the class.
    Is there something i need to add somewhere for the classloader to be able to find and load this class in the second scenario.
    Please suggest me which method to go for amongst the two and what is the missing information i need to add.
    Thanks
    Priya

Maybe you are looking for

  • Cost Center Authorization

    Dear Friends / Experts We have around 10 HR (BW/BO) reports. All are woking fine. Now the users wants to restrict the report based on cost center. Hence, I have created one DSO with relevent information and extracted the data from ECC ( Used id, Cost

  • Export to ProRes problem. Please help!

    I am getting very strange results when exporting to ProRes from Shake (Just "snow" on all frames). Export to uncompressed, DV etc works fine. Is there something I can do to fix this? Exporting to ProRes from FCP works fine.

  • Keyboard not working after water spill

    Ok, so a while back I spilt some water on my MBP and I shut it off immediately and took it in to have it looked at.  I was told it was pretty much hopeless and that it'd be cheaper to buy a new one. So I just left it alone and would periodically test

  • Migration Problem in 2lis_11_vaitm for info cube 0SD_C03(Sales Overview)

    Dear Experts I am facing an issue for the data source 2lis_11_vaitm and 2lis_11_vcitm for info cube 0SD_C03. When i create transformation on update rule, it gets created with warnings but no issues. When i try making a transformation on update rule i

  • Non working keys

    i have n 8800 and keys to the right of rows (and including T, G and V) T, G and V do not work.  All keys to the left do work.  is there something i can do to restore there use?  It seems that when my sim card is inserted into the 8800 the right side