Tuesday, January 13, 2015

To update the Project Task through API - PA_PROJECT_PUB.UPDATE_TASK


DECLARE
   l_msg_count               NUMBER;
   l_msg_data                VARCHAR2 (2000);
   l_return_status           VARCHAR2 (1);
   l_out_pa_task_id          NUMBER;
   l_out_pm_task_reference   VARCHAR2 (2000);
   l_output                  VARCHAR2 (2000);
   l_msg_dummy               VARCHAR2 (2000);
   n                         NUMBER := 0;
   l_pm_product_code         VARCHAR2 (10):= 'GMS';
   l_pa_project_id           NUMBER := 3432;
   l_task_id                 NUMBER := 23432;
  
   --> variables needed for Oracle Project specific parameters
   l_user_id                   NUMBER;
   l_responsibility_id         NUMBER;
  
BEGIN
   --> SET GLOBAL INFO
   SELECT user_id,
          responsibility_id
     INTO l_user_id,
          l_responsibility_id
     FROM pa_user_resp_v
    WHERE 1=1
    and user_name = 'OPERATIONS'
    and RESPONSIBILITY_name  = 'Project Billing Super User'
    ;

   PA_INTERFACE_UTILS_PUB.SET_GLOBAL_INFO ( p_api_version_number      => 1.0
                                           ,p_responsibility_id       => l_responsibility_id
                                           ,p_user_id                 => l_user_id
                                           ,p_msg_count               => l_msg_count
                                           ,p_msg_data                => l_msg_data
                                           ,p_return_status           => l_return_status
                                          );
   
   ---->>=============================================================================================
   PA_PROJECT_PUB.UPDATE_TASK
   (
      p_api_version_number      => '1.0',
      p_commit                  => 'F',
      p_init_msg_list           => 'T',
      p_msg_count               => l_msg_count,
      p_msg_data                => l_msg_data,
      p_return_status           => l_return_status,
      p_pm_product_code         => l_pm_product_code,
      p_pa_project_id           => l_pa_project_id,
      p_pa_task_id              => l_task_id,
      p_tasks_dff               => 'Y',
      p_attribute3              => TO_DATE (SYSDATE, 'YYYY/MM/DD HH24:MI:SS'),
      p_attribute4              => TO_DATE (SYSDATE, 'YYYY/MM/DD HH24:MI:SS'),
      p_out_pa_task_id          => l_out_pa_task_id,
      p_out_pm_task_reference   => l_out_pm_task_reference
   );

   IF l_return_status <> 'S'
   THEN
      FOR n IN 1 .. l_msg_count
      LOOP
         FND_MSG_PUB.GET (n,
                          fnd_api.g_false,
                          l_msg_data,
                          l_msg_dummy);
         l_output := (TO_CHAR (n) || ': ' || l_msg_data);
         DBMS_OUTPUT.put_line ('Error while updating the Task : ' || l_output);
      END LOOP;
   ELSE
      DBMS_OUTPUT.put_line ('Sucessfully Update the task, Task ID is : '|| l_out_pa_task_id);
      COMMIT;
   END IF;
  
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Other Error in Project: ' || SQLERRM);
END;


No comments:

Post a Comment

Best Blogger TipsGet Flower Effect