10 Replies Latest reply: Jan 23, 2013 4:31 AM by Srini-999 RSS

    issue when calling concurrent program

    san-717
      Hi,

      I'm trying to excute a concurrent program which is xml publisher report. I googled and i got the following code and I tried to execute xml report.

      public int submitCP(String planId, String scorecardId, OAApplicationModule oaam){
      int cpRequestId=0;
      Connection conn=oaam.getOADBTransaction().getJdbcConnection();
      ConcurrentRequest cr=new ConcurrentRequest(conn);
      String applShortName="PER";
      String cpName="XX_GOAL_SETTING_PRINT";
      String param=planId+":"+scorecardId;
      Vector args=new Vector();
      //args.addElement(param);
      args.addElement(planId);
      args.addElement(scorecardId);

      try{

      //cr.addLayout(applShortName,cpName, "en", "US", "PDF");


      cpRequestId=cr.submitRequest(applShortName, cpName, "", "", false, args);
      try{
      cr.addLayout(applShortName, cpName, "en", null, "RTF", "PDF");
      conn.commit();
      }catch(Exception e){
      throw new OAException("Add layout returns issue "+e.toString(), OAException.ERROR);
      }
      return cpRequestId;

      } catch (RequestSubmissionException e) {
      OAException oe = new OAException(e.getMessage());
      oe.setApplicationModule(oaam);
      throw oe;


      }
      }

      I tried without layout, I'm getting request Id but i can view that request in sysadministrator responsibility only. But I registered this report in HRMS Manager.

      But there is no out put becoz there is layout specified in the request.

      Please suggest me to solve this and also tell me how to open that output in another tab.

      Thanks,
      SAN
        • 1. Re: issue when calling concurrent program
          Sushant Sharma
          Hi,

          If you are able to submit the request successfully and able to generate the output, then the output file gets stored at some specific path on the server. You have to write some code to download the output file from that path.

          --Sushant                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
          • 2. Re: issue when calling concurrent program
            san-717
            Sushanth,

            I'm able to submit request without adding layout, but the report type is xml. So there is no output in the view requests.

            I think the parameters which is passing in add layout is wrong. I searched in forum also, all the posts are showing like this only.

            I need two things:

            1. is my add layout is correct
            2. sample code to open the xml report output in new tab


            Thanks,
            SAN
            • 3. Re: issue when calling concurrent program
              Sushant Sharma
              Hi,

              Check if below links help you:

              http://apps2fusion.com/at/51-ps/260-integrating-xml-publisher-and-oa-framework
              http://dineshnair.wordpress.com/2009/06/02/integration-of-xml-publisher-with-oafgenerating-output-in-pdf-msword-msexcel-and-html-format/
              http://www.apps2fusion.com/at/71-br/379-oa-framework-xmlp-bi-publisher-export-etext

              --Sushant                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
              • 4. Re: issue when calling concurrent program
                san-717
                Hi,

                I don't want to embed the XML publisher, but I want to execute concurrent which is xml report.

                I used the following code in my CO:

                public int submitCP(String planId, String scorecardId, OAApplicationModule oaam){
                int cpRequestId=0;
                Connection conn=oaam.getOADBTransaction().getJdbcConnection();
                ConcurrentRequest cr=new ConcurrentRequest(conn);
                String applShortName="PER";
                String cpName="XX_GOAL_SETTING_PRINT";
                String param=planId+":"+scorecardId;
                Vector args=new Vector();
                //args.addElement(param);
                args.addElement(planId);
                args.addElement(scorecardId);

                try{

                cpRequestId=cr.submitRequest(applShortName, cpName, "", "", false, args);
                cr.addLayout(applShortName, cpName, "en", "US", "PDF", null);
                conn.commit();
                return cpRequestId;

                } catch(Exception e)
                {
                OAException oe = new OAException(e.getMessage());
                oe.setApplicationModule(oaam);
                throw oe;
                }
                }

                After clicking the print button, i'm getting request id. This concurrent is executing in system administrator responsibility. but actually I registered this concurrent under HRMS Manager responsibility. I don't know then why it is executing in system administrator responsibility.

                Second, it completed normal but there is no out put because there is no layout picked up even I added layout.

                Please give me solution.

                Thanks in advance,
                SAN
                • 5. Re: issue when calling concurrent program
                  924022
                  Hi,

                  cr.addLayout(applShortName, cpName, "en", "US", "PDF", null);
                  cpRequestId=cr.submitRequest(applShortName, cpName, "", "", false, args);

                  Add Layout before submitting the report. Give addLayout before submitRequest.

                  this will pick up the layout.

                  --
                  niranj

                  Edited by: niranj.s on Jan 20, 2013 2:57 PM
                  • 6. Re: issue when calling concurrent program
                    san-717
                    Niranj,

                    Thanks your suggestion is working fine.. Now i can able to see the layout picked up by concurrent.

                    But still I have doubt,

                    1. I can able to see only the request in the system administrator responsibility not in other responsibility?


                    2. How do I open that output in new window.


                    Thanks a lot niranj.
                    • 7. Re: issue when calling concurrent program
                      924022
                      Hi,

                      *1. I can able to see only the request in the system administrator responsibility not in other responsibility?*

                      Have you added your concurrent program in the request group of the responsibility where you want to see the request?? If you have not done this step, then you can see the request only in System Administrator and not in any other responsibility.

                      Check the below link for this step: Assign this Concurrent Program to a request group:
                      http://erpschools.com/articles/concurrent-program-registration-and-add-it-to-request-group

                      *2. How do I open that output in new window.*

                      Where do you want to open the output, from oaf page or from forms some other responsibility?

                      --
                      niranj
                      • 8. Re: issue when calling concurrent program
                        san-717
                        Hi Niranj,

                        I already attached my concurrent under HRMS Manager(responsibility) request. I can able to run from HRMS manager normally through run request form.

                        I want to open the output from OAF once it completed normal.

                        Thanks,
                        SAN
                        • 9. Re: issue when calling concurrent program
                          924022
                          Hi,

                          I have not tried the following, but this is one of the approach to open output from OAF once it is completed.

                          http://docs.oracle.com/cd/B34956_01/current/acrobat/120xdoig.pdf

                          Check chapter 8 in the above PDF.

                          Re: Document Viewer region

                          check the above thread as well. I am not sure whether this is your requirement.

                          --
                          niranj

                          Edited by: niranj.s on Jan 21, 2013 11:17 AM
                          • 10. Re: issue when calling concurrent program
                            Srini-999
                            Hi SAN,

                            Use get getOutputURL method it's works.

                            public String getOutputURL(String requestId)
                            {

                            String s4=null;

                            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();
                            s4 = callablestatement.getString(1);

                            // throw new OAException(retrivePLSQLError());
                            //oadbtransactionimpl.putValue("OutputURL", s4);

                            }
                            catch(Exception exception1)
                            {
                            s4=exception1.toString();
                            }
                            finally
                            {
                            try
                            {
                            callablestatement.close();
                            }
                            catch(Exception exception2)
                            {
                            //throw OAException.wrapperException(exception2);
                            s4=exception2.toString();
                            }
                            }
                            return s4;
                            } else
                            {
                            s4="No request id passed";
                            return s4;
                            }

                            } // ends method getOutputURL()*/


                            Regards,
                            Srinivsa