6 Replies Latest reply on Mar 14, 2019 1:19 PM by SHARAD KUMAR JAISWAL

    Issue with HFM JAVA API for running calculation

    SHARAD KUMAR JAISWAL

      Hello,

       

      I am trying to write an API which calculates an entity and change the review level. I was trying to achieve this using below mentioned method. it is failing by giving this exception. Does anyone has any code snippet to achieve this? We need this since it is critical part of our system.

       

      "oracle.epm.fm.common.exception.HFMException: EPMHFM-3037: Invalid Item ID."

       

      sample POV - S#BUDGET.Y#2018.P#12.E#0011

       

      dataOM.executeServerTask(WEBOMDATAGRIDTASKMASKENUM.WEBOM_DATAGRID_TASK_FORCECALCULATE, POV)

       

      FYI - If I will give all the dimension then it doesn't give me the above mentioned error. But it doesn't calculate that entity in HFM also.

       

      Let me know if you have any specific question related to this.

       

      Thanks,

      Sharad

        • 1. Re: Issue with HFM JAVA API for running calculation
          Jeo123

          There's a bunch of code that's unique to my application(UpdateResults being a clear one) but the below is my function for generically performing server tasks, whether it's a calculate, consolidate, etc. for a period range and a specific year.  My Entity and Scenario lists are global POV's.

           

          Hopefully comparing against this helps you determine what's causing your issue.  Let me know if there are parts you don't understand in my code.

           

           

           

          private void ExecServerTask(WEBOMDATAGRIDTASKMASKENUM Action, String sPer, String ePer, String cYear){

          try{

          DataOM dataOM;

          dataOM = new DataOM(sessionInfo);

           

          AdministrationOM adminOM;

          adminOM = new AdministrationOM(sessionInfo);

           

          String pov ="";

          String[] entities = Ent.split(";");

           

          String[] scenarios = Scen.split(";");

           

          List<String> POVs = new ArrayList<String>();

          for(int j = 0;j<scenarios.length;j++){

          for(int k = 0;k<entities.length;k++){

          for(int i = Periods.indexOf(sPer);i<=Periods.indexOf(ePer);i++){

          pov = "S#"+scenarios[j]+".Y#"+cYear+".P#"+Periods.get(i)+".E#"+entities[k];

          POVs.add(pov);

          }

          }

          }

           

          Long lStart = System.currentTimeMillis();

          ServerTaskInfo SvrTask;

          List<RunningTaskProgress> RTProgress = new ArrayList<RunningTaskProgress>();

          SvrTask = dataOM.executeServerTask(Action, POVs);

          RTProgress = adminOM.getCurrentTaskProgress(SvrTask.getTaskIDs());

           

          for(int i = 0;i<RTProgress.size();i++){

          while( (RTProgress.get(i).getTaskStatus() == USERACTIVITYSTATUS.USERACTIVITYSTATUS_SCHEDULED_START)

          || (RTProgress.get(i).getTaskStatus() == USERACTIVITYSTATUS.USERACTIVITYSTATUS_RUNNING)

          || (RTProgress.get(i).getTaskStatus() == USERACTIVITYSTATUS.USERACTIVITYSTATUS_STARTING)

          ){

          Thread.sleep(5000);

          RTProgress = adminOM.getCurrentTaskProgress(SvrTask.getTaskIDs());

          }

          }

                      Long lEnd = System.currentTimeMillis();

                      Time elapsedTime = new Time(lEnd-lStart);

                     

                      String res = "";

                      for(int i = 0;i<RTProgress.size();i++){

                      UpdateResults(GetTaskDesc(Action) +" for: " + RTProgress.get(i).getDescription() + " Returned: " + GetStatusDesc(RTProgress.get(i).getTaskStatus()) + "<p>");

                      }

           

                      UpdateResults("Time taken: " + sdfElapsed.format(elapsedTime)+"<p>");

           

           

           

          } catch (Exception e) {

          UpdateResults(e.toString());

          e.printStackTrace();

          }

          }

          • 2. Re: Issue with HFM JAVA API for running calculation
            SHARAD KUMAR JAISWAL

            Hello Jeo,

             

            Thanks for your response. I tried exactly the same but the action I selected was WEBOMDATAGRIDTASKMASKENUM.WEBOM_DATAGRID_TASK_CALCULATE. If I pass only 4 dimension which is year, period, scenario and entity then it fails saying invalid id (oracle.epm.fm.common.exception.HFMException: EPMHFM-3037: Invalid Item ID.). The moment I add Value Dimension then it stops throwing exception. But still doesn't calculate the entity. Consolidation is working with above mentioned code. Please let me know if I am doing something wrong.

             

            Also I am looking for something that promote the entity to next level like not started to first pass.

             

            Thanks,

            Sharad

            • 3. Re: Issue with HFM JAVA API for running calculation
              Jeo123

              My guess is that since you can technically calculate at several value levels, the application needs it defined.  I'm not sure why it wouldn't perform the actual calculation though.  I'll see if I can test the calculate a bit in my own program, but that's likely the cause of why you need a value defined.

               

              As for Process Management, that's under the executeServerPMTaskForPovs function found within the DataOM.  This allows you to execute a process management task from the list of actions in PROCESS_FLOW_ACTION.  There's a bit more information in the HFM Java doc.

               

              https://docs.oracle.com/cd/E57185_01/HFMJD/index.html

              • 4. Re: Issue with HFM JAVA API for running calculation
                CBarbieri

                Conceptually, the Calculate, Translate, and Consolidate options need the value dimension for the request to make sense. Calculate for example, cannot apply to parent entities. Instead, parent entities can only consolidate. If you choose any option above <Entity Curr Total> in the value dimension, you must specify the entity's parent in Parent.Child format, or else the request doesn't make sense.

                 

                I also suggest you keep in mind the difference between calculate/force calculate, translate/force translate, consolidate/consolidate all with data. If the user doesn't actually change data, and the calc status is "OK" or "NoData" a simple "calculate" doesn't do anything. I don't know if this is an issue for you, but wanted to remind you of this behavior.

                 

                - Chris

                • 5. Re: Issue with HFM JAVA API for running calculation
                  SHARAD KUMAR JAISWAL

                  Thanks a lot to you both. I am finally able to run the calculate. Here is the syntax which I used to run it.

                   

                  "S#"Scenario".Y#"Year".P#"Period".E#"Entity".V#<Entity Curr Total>"

                   

                  However I am not able to promote the entity yet. Can you please guide me how to use this to promote the entity. Some sample code can help me to achieve this. This is the last piece I am stuck with it and need to be done before this month end.

                   

                  what I was trying is this. Let me know if there is anything wrong with function which I am using.

                   

                  PMTaskOptions pm = new PMTaskOptions();

                  ServerPMTaskInfo taskinfophase = dataOM.executeServerPMTaskForPovs(PROCESS_FLOW_ACTION_PROMOTE,povs, pm);

                   

                  I am not sure what I need to set in PMTaskOptions.

                   

                  Thanks,

                  Sharad

                  • 6. Re: Issue with HFM JAVA API for running calculation
                    SHARAD KUMAR JAISWAL

                    Finally I am able to make it to promote the entity. Thanks a lot to you both for your help.