1 2 Previous Next 25 Replies Latest reply: Jun 28, 2010 2:05 AM by harikumarmpl RSS

    concurrentRequest from OAF page, runs but doesnt pick the layout template.

    636775
      I went through a lot of threads and oaf dev guide and I handeled the concurrentrequest from controller of my custom page.
      but when I view the output, it errors out saying the output was not generated for this request.

      details of conc program - its an oracle report that user can run when needed or he should be able to invoke it from oaf pages.
      report is tied to rtf template which opens the report in pdf format.
      If I run the report from conc Prog...it works fine, but not from oaf page.

      here is the code :
      CO :
       if( pageContext.getParameter("concurrentprogram") != null)
       {
          Serializable[] p = {modelid};
          int reqId =  ((Integer)am.invokeMethod("submitCPRequest", p)).intValue();
      
          String url="OA.jsp?akRegionApplicationId=0&akRegionCode=FNDCPREQUESTVIEWPAGE";
          pageContext.setForwardURL(url,
                                    null,
                                    OAWebBeanConstants.KEEP_MENU_CONTEXT,
                                    null,
                                    null,
                                    true,
                                    OAWebBeanConstants.ADD_BREAD_CRUMB_NO,
                                    OAWebBeanConstants.IGNORE_MESSAGES);
        }
      AM :
        public int submitCPRequest(String s1)
       {
          try {
               OADBTransaction tx = (OADBTransaction)getDBTransaction();
               java.sql.Connection pConncection = tx.getJdbcConnection();
              ConcurrentRequest cr = new ConcurrentRequest(pConncection);
              String applnName = "MAC"; //Application that contains the concurrent program
              String cpName = "MACZMDLRL"; //Concurrent program name
              Vector cpParameters = new Vector(); 
              cpParameters.addElement(s1);        
              int requestId = cr.submitRequest(applnName, cpName, "", "", false, cpParameters);
              tx.commit();
              return requestId;
          } 
          catch (RequestSubmissionException e) 
          {
          throw new OAException(e.toString(),OAException.ERROR);
          }
        } 
      its not picking the template from xml publisher. ... any ideas ?
        • 1. Re: concurrentRequest from OAF page, runs but doesnt pick the layout template.
          Reetesh Sharma
          Hi OAF Dev,

          You need to attach template with concurrent request to run it from OAF page. One method is available in class ConcurrentRequest.

          Sometimes back Parag Narkhede mentioned the the code for that please try to find that thread, I will ask him to update this thread once he will be online, meanwhile you can search his thread.

          Regards,
          Reetesh Sharma
          • 2. Re: concurrentRequest from OAF page, runs but doesnt pick the layout template.
            Parag Narkhede
            Use following while submitting request addition to what you are doing now,

            ConcurrentRequest cr = new ConcurrentRequest(pConncection);
            cr.addLayout('XXEGA','XXEGA_IBR_BOM_EXPORT','en','US','PDF');
            • 3. Re: concurrentRequest from OAF page, runs but doesnt pick the layout template.
              636775
              thanks reetesh and parag. it was right at spot.
              Also
              I read about the ConcurrentRequest api more and I was able to set the printer assigned to the user also. (which was the next requirement....)
              cr.addLayout(applnName,cpName,"en","US","PDF");
              cr.addPrinter(printer, 1);
              thanks for the help.
              • 4. Re: concurrentRequest from OAF page, runs but doesnt pick the layout template.
                778517
                Hi,
                When i use the similar code in my AM, I'm getting the following error. can you please help me how to resolve it please.

                Error(303,12): class RequestSubmissionException not found in class xxafp.oracle.apps.qp.pricelistrebate.server.PricelistrebateAMImpl


                But instead of RequestSubmissionException if i pass Exception it compiling, can u please let me know what is the issue?

                And also in you CO code what is {modelid} means? is it a variable or is it a form value?? please let me know.

                Thanks,
                Mahesh

                Edited by: user8996062 on Jun 10, 2010 6:27 AM
                • 5. Re: concurrentRequest from OAF page, runs but doesnt pick the layout template.
                  636775
                  modelid is the parameter that I needed to pass to the concurrent program...which in your case would be contract_number.
                  read other thread in reply to your post and try the sample code....
                  • 6. Re: concurrentRequest from OAF page, runs but doesnt pick the layout template.
                    778517
                    Hi OAFDEV,

                    Ya got it..I did that.. thanks...

                    I have two open questions ..

                    1)Do you have any idea how to change CSS Class dynamically

                    2) Any sample code for file upload?

                    Thanks,
                    Mahesh
                    • 7. Re: concurrentRequest from OAF page, runs but doesnt pick the layout template.
                      636775
                      1)Do you have any idea how to change CSS Class dynamically
                      I had a minor requirement of entering the text in upper case form the logic and i used this import in CO:

                      import oracle.cabo.style.CSSStyle;

                      in process request-

                      cellUpperCase = new CSSStyle();
                      cellUpperCase.setProperty("text-transform","uppercase");
                      OAMessageTextInputBean msgbean=(OAMessageTextInputBean)webBean.findChildRecursive("textBox");
                      if (msgbean != null)
                      {
                      msgbean.setInlineStyle(cellUpperCase);
                      }
                      you can do a lot of things based on your requirement ...search the forum...youll find a lot of stuff...
                      2) Any sample code for file upload?
                      what do you mean ? you want attachments feature ?
                      open a new thread as this is unrelated to the above.
                      • 9. Re: concurrentRequest from OAF page, runs but doesnt pick the layout template.
                        636775
                        Hi
                        Here on click of a sumbit button on custom oaf page - I launched concurrent request and fwded the page to 'FNDCPREQUESTVIEWPAGE'
                        so that user can see the status of the report and open the output.

                        But user doesnt want to see this view request page,
                        Is there any way that he sees only the PDF output of the concurrent report after he clicks the submit button in my oaf page ?

                        thanks
                        • 10. Re: concurrentRequest from OAF page, runs but doesnt pick the layout template.
                          636775
                          Hi
                          Here on click of a sumbit button on custom oaf page - I launched concurrent request and fwded the page to 'FNDCPREQUESTVIEWPAGE'
                          so that user can see the status of the report and open the output.

                          But user doesnt want to see this view request page,
                          Is there any way that he sees only the PDF output of the concurrent report after he clicks the submit button in my oaf page ?

                          thanks
                          • 11. Re: concurrentRequest from OAF page, runs but doesnt pick the layout template.
                            harikumarmpl
                            Hi



                            In the page

                            to get the url of the output use the following method in your AM:
                            public void getOutputURL(String requestId)
                              {
                                  OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl)getDBTransaction();
                                  String s1 = oadbtransactionimpl.getAppsContext().getEnvStore().getEnv("TWO_TASK");
                                  String s2 = oadbtransactionimpl.getAppsContext().getEnvStore().getEnv("GWYUID");
                                  String s3 = "BEGIN :1 := fnd_webfile.get_url(fnd_webfile.request_out, :2, :3, :4, 1); end;";
                                  CallableStatement callablestatement = getOADBTransaction().createCallableStatement(s3, 1);
                                  if(requestId != null)
                                  {
                                      try
                                      {
                                          Number number = new Number(requestId);
                                          callablestatement.registerOutParameter(1, 12);
                                          callablestatement.setInt(2, number.intValue());
                                          callablestatement.setString(3, s2);
                                          callablestatement.setString(4, s1);
                                          callablestatement.execute();
                                          String s4 = callablestatement.getString(1);
                                          if(s4 == null || s4.equals(""))
                                              throw new OAException(retrivePLSQLError());
                                          oadbtransactionimpl.putValue("OutputURL", s4);
                                      }
                                      catch(Exception exception1)
                                      {
                                          throw OAException.wrapperException(exception1);
                                      }
                                      finally
                                      {
                                          try
                                          {
                                              callablestatement.close();
                                          }
                                          catch(Exception exception2)
                                          {
                                              throw OAException.wrapperException(exception2);
                                          }
                                      }
                                      return;
                                  } else
                                  {
                                      return;
                                  }
                              } // ends method getOutputURL()
                            upon click of the button in your controller in processFormRequest or in processRequest as per your requirement do the following:
                                  Serializable params[] = {
                                      "requestId"
                                  };
                                  pageContext.getApplicationModule(webBean).invokeMethod("getOutputURL", params);
                                  String outputURL = (String)pageContext.getTransactionValue("OutputURL");
                                  try
                                  {
                                      pageContext.sendRedirect(outputURL);
                                      return;
                                  }
                                  catch(Exception exception)
                                  {
                                      throw new OAException(exception.getMessage());
                                  }
                            if you want output to open in a new popup window:

                            1) Create Item of type link
                            2) Set the Destination URI as the current page with the parameters to identify
                            3) Set the Target Frame as _new
                            4) call the above mentioned controller code

                            I hope this helps if i did understand correctly.

                            Thanks,
                            Hari
                            • 13. Re: concurrentRequest from OAF page, runs but doesnt pick the layout template.
                              636775
                              Hari , url prints out to be null whereas when i login to apps and check the output ..its there...
                              any clues ?
                              thanks --


                              public void getOutputURL(String requestId)
                              {
                              System.out.println("AM - request id - " +requestId );
                              OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl)getDBTransaction();
                              String s1 = oadbtransactionimpl.getAppsContext().getEnvStore().getEnv("TWO_TASK");
                              System.out.println("s1 = " + s1);

                              String s2 = oadbtransactionimpl.getAppsContext().getEnvStore().getEnv("GWYUID");
                              System.out.println("s2 = " + s2);
                              String s3 = "BEGIN :1 := fnd_webfile.get_url(fnd_webfile.request_out, :2, :3, :4, 1); end;";
                              System.out.println("s3 = " + s3);
                              CallableStatement callablestatement = getOADBTransaction().createCallableStatement(s3, 1);
                              if(requestId != null)
                              {
                              try
                              {
                              Number number = new Number(requestId);
                              callablestatement.registerOutParameter(1, 12);
                              callablestatement.setInt(2, number.intValue());
                              callablestatement.setString(3, s2);
                              callablestatement.setString(4, s1);
                              callablestatement.execute();
                              String s4 = callablestatement.getString(1);
                              if(s4 == null || s4.equals(""))

                              // throw new OAException(retrivePLSQLError()); //what is the import of this function ...i got an error saying could not find it.
                              System.out.println("URL is null");
                              oadbtransactionimpl.putValue("OutputURL", s4);
                              System.out.println("inside AM - print ouput url - " + s4 );

                              }
                              catch(Exception exception1)
                              {
                              throw OAException.wrapperException(exception1);
                              }
                              finally
                              {
                              try
                              {
                              callablestatement.close();
                              }
                              catch(Exception exception2)
                              {
                              throw OAException.wrapperException(exception2);
                              }
                              }
                              return;
                              } else
                              {
                              return;
                              }
                              } // ends method getOutputURL()


                              console prints ---

                              CO - print requestID - 43492508
                              AM - request id - 43492508
                              s1 = MACB
                              s2 = APPLSYSPUB/PUB
                              s3 = BEGIN :1 := fnd_webfile.get_url(fnd_webfile.request_out, :2, :3, :4, 1); end;
                              URL is null
                              inside AM - print ouput url - null
                              CO - print url - null
                              • 14. Re: concurrentRequest from OAF page, runs but doesnt pick the layout template.
                                harikumarmpl
                                Hi,

                                For me it is working fine.

                                I will send you the code for retrivePLSQLError() tomorrow. check what the error it throws?

                                Regards,
                                Hari
                                1 2 Previous Next