How to assign project specific task with the newly created projects ?

Hi All,
I need help. I need to assign project specific tasks (which i will be taking from staging table) other than the default task which are assigned during project creation. How do I proceed with this within same package. I am attaching the code of my package below...
CREATE OR REPLACE PACKAGE body xxpa_proj_conv_pkg as
PROCEDURE xxpa_create_project_proc(O_ERRBUF OUT VARCHAR2,O_RETCODE OUT VARCHAR2)
is
variables need to derive global parameters
v_responsibility_id NUMBER; --- PA Supervisor responsibility id
v_user_id NUMBER;
deriving global parameters-
-- Variables needed for API standard parameters
v_api_version_number NUMBER := 1.0;
v_commit VARCHAR2(1) := 'F';
v_return_status VARCHAR2(1);
v_init_msg_list VARCHAR2(1) := 'F';
v_msg_count NUMBER;
v_msg_index_out NUMBER;
v_msg_data VARCHAR2(2000);
v_data VARCHAR2(2000);
v_workflow_started VARCHAR2(1) := 'Y';
v_pm_product_code VARCHAR2(10);
---variables for catching errors---
v_error_flag number:=0;
-- Predefined Composite data types
v_project_in PA_PROJECT_PUB.PROJECT_IN_REC_TYPE;
v_project_out PA_PROJECT_PUB.PROJECT_OUT_REC_TYPE;
v_key_members PA_PROJECT_PUB.PROJECT_ROLE_TBL_TYPE;
v_class_categories PA_PROJECT_PUB.CLASS_CATEGORY_TBL_TYPE;
v_tasks_in_rec PA_PROJECT_PUB.TASK_IN_REC_TYPE;
v_tasks_in PA_PROJECT_PUB.TASK_IN_TBL_TYPE;
v_tasks_out_rec PA_PROJECT_PUB.TASK_OUT_REC_TYPE;
v_tasks_out PA_PROJECT_PUB.TASK_OUT_TBL_TYPE;
v_CREATED_FROM_PROJECT_ID varchar2(20);
v_CARRYING_OUT_ORGANIZATION_ID varchar2(20);
v_person_id NUMBER;
v_project_role_type VARCHAR2(20);
API_ERROR EXCEPTION;
v_a NUMBER;
cursor for project in data
CURSOR cur_project_in_data IS SELECT * FROM XXPA_PROJECT_IN_STG;
cursor for task data
CURSOR cur_task_in_data IS SELECT * FROM XXPA_TASK_IN_STG;
------------------------Cursors used for validations----------------------------------
cursor for product code used for validation
cursor cprc is select distinct PROJECT_RELATIONSHIP_CODE from PA_PROJECT_CUSTOMERS;
cursor for distribution rule-
cursor cdr is select DISTRIBUTION_RULE from PA_DISTRIBUTION_RULES;
cursor for project status code
cursor cpsc is SELECT PROJECT_STATUS_CODE, PROJECT_STATUS_NAME FROM PA_PROJECT_STATUSES WHERE STATUS_TYPE = 'PROJECT';
cursor for template/created from project id
cursor ccpid is select project_id from pa_projects where template_flag='Y';
BEGIN
select user_id, responsibility_id into v_user_id, v_responsibility_id
from PA_USER_RESP_V
where user_name like 'amit_kumar%'
and responsibility_name like'PA SupervisorS';
-- --Fnd_global.apps_initialize(user_id,resp_id, resp_appl_id);
-- Fnd_global.apps_initialize(v_user_id,v_responsibility_id,275);
-- -------calling global parameters---
pa_interface_utils_pub.set_global_info
p_api_version_number =>v_api_version_number,
p_responsibility_id =>v_responsibility_id,
p_user_id =>v_user_id,
p_msg_count =>v_msg_count,
p_msg_data =>v_msg_data,
p_return_status =>v_return_status
dbms_output.put_line ('Set Global status ->' || v_return_status);
----Cursor for PRODUCT RELATED DATA-----------
FOR REC IN cur_project_in_data LOOP
-----PASSING VALUES TO THE COMPOSITE DATA TYPE(PROJECT_IN_REC_TYPE)-------
----retrieving product code-----
select lookup_code into v_pm_product_code
from pa_lookups
where lookup_type = 'PM_PRODUCT_CODE'
and meaning = 'Oracle Project Manufacturing';
-----retrieving and validating created from project id----
BEGIN
select project_id
into v_CREATED_FROM_PROJECT_ID
from pa_projects_all
where name=rec.created_from_project_name;
EXCEPTION
when others then
O_Retcode := '1';
O_Errbuf :='Incorrent CREATED_FROM_PROJECT_NAME';
Fnd_File.Put_Line (Fnd_File.LOG, O_Errbuf);
UPDATE XXPA.XXPA_PROJECT_IN_STG
SET ERROR_FLAG ='1' ,last_updation_date='sysdate' where created_from_project_name = rec.CREATED_FROM_PROJECT_NAME;
END;
-----retrieving & validating carrying out organization id-----
BEGIN
select distinct(CARRYING_OUT_ORGANIZATION_ID)
into v_CARRYING_OUT_ORGANIZATION_ID
from pa_projects_prm_v
where CARRYING_OUT_ORGANIZATION_NAME=rec.carrying_out_organization_name;
EXCEPTION
when others then
O_Retcode := '1';
O_Errbuf :='Incorrent Carrying Out Organization name';
Fnd_File.Put_Line (Fnd_File.LOG, O_Errbuf);
UPDATE XXPA.XXPA_PROJECT_IN_STG
SET ERROR_FLAG ='1' ,last_updation_date='sysdate' where carrying_out_organization_name = rec.carrying_out_organization_name;
END ;
v_project_in.pm_project_reference := rec.segment1;
v_project_in.project_name := rec.PROJECT_NAME;
v_project_in.created_from_project_id := v_CREATED_FROM_PROJECT_ID;
v_project_in.carrying_out_organization_id := v_CARRYING_OUT_ORGANIZATION_ID;
v_project_in.project_status_code := rec.PROJECT_STATUS_CODE;
v_project_in.description := rec.PROJECT_DESCRIPTION;
v_project_in.start_date := rec.PROJECT_START_DATE;
v_project_in.completion_date := rec.PROJECT_COMPLETION_DATE;
v_project_in.distribution_rule := rec.DISTRIBUTION_RULE;
v_project_in.project_relationship_code := rec.PROJECT_RELATIONSHIP_CODE;
-------------------------Validation of incoming project data--------------------------------
v_error_flag := 1;
project relationship code validation
BEGIN
for prc in cprc
loop
if (rec.PROJECT_RELATIONSHIP_CODE=prc.PROJECT_RELATIONSHIP_CODE) or (rec.PROJECT_RELATIONSHIP_CODE is null)--can be overridden from template
then
v_error_flag :=0;
else null;
end if;
end loop;
END;
project distribution rule validation
BEGIN
for dr in cdr
loop
if (rec.DISTRIBUTION_RULE=dr.DISTRIBUTION_RULE) or (rec.DISTRIBUTION_RULE is null) null since the value can be taken from template too
then
v_error_flag :=0;
else null;
end if;
end loop;
END;
project status code validation
BEGIN
for sc in cpsc
loop
if (rec.PROJECT_STATUS_CODE=sc.PROJECT_STATUS_CODE) or (rec.PROJECT_STATUS_CODE is null) null since the value can be taken from template too
then
v_error_flag :=0;
else null;
end if;
end loop;
END;
dbms_output.put_line ('Error at PROJECT_STATUS_CODE>' ||v_error_flag);
validation logic for project start date
BEGIN
if TRUNC(rec.PROJECT_START_DATE) >= TRUNC(rec.PROJECT_COMPLETION_DATE)
THEN
v_error_flag := 1;
O_Retcode := '1';
O_Errbuf :='Project start date cannnot be greater than completion date';
Fnd_File.Put_Line (Fnd_File.LOG, O_Errbuf);
END IF;
END;
validation logic for project completion date
BEGIN
if (TRUNC(rec.PROJECT_COMPLETION_DATE)<=TRUNC(rec.PROJECT_START_DATE))
then
if ( rec.PROJECT_STATUS_CODE='CLOSED' and rec.PROJECT_COMPLETION_DATE>sysdate)
THEN
v_error_flag := 1;
O_Retcode := '1';
O_Errbuf :='completion date cannot be greater than sysdate for closed projects';
Fnd_File.Put_Line (Fnd_File.LOG, O_Errbuf);
END IF;
v_error_flag := 1;
O_Retcode := '1';
O_Errbuf :='Project closed date cannot be less than start date';
end if;
END;
--------Update staging table for the error records--------
BEGIN
if v_error_flag =1
then
O_Retcode := '1';
O_Errbuf :='Incorrect project relationship code';
Fnd_File.Put_Line (Fnd_File.LOG, O_Errbuf);
UPDATE XXPA.XXPA_PROJECT_IN_STG
SET ERROR_FLAG ='1' ,last_updation_date='sysdate' where PROJECT_RELATIONSHIP_CODE = rec.PROJECT_RELATIONSHIP_CODE;
end if;
END;
-----------------------End of validation of incoming project data----------------------------------
---------------Project Task DATA-----------------
v_a:=0;
FOR tsk IN cur_task_in_data LOOP
v_tasks_in_rec.pm_task_reference :=tsk.task_reference ;
v_tasks_in_rec.task_name :=tsk.task_name;
v_tasks_in_rec.pm_parent_task_reference :=tsk.parent_task_reference ;
v_tasks_in_rec.task_start_date :=tsk.task_start_date ;
v_tasks_in_rec.task_completion_date :=tsk.task_completion_date ;
v_tasks_in(v_a) := v_tasks_in_rec;
v_a:=v_a+1;
end loop;
---------------end of task details------------------
--INIT_CREATE_PROJECT
pa_project_pub.init_project;
---------------------CREATE_PROJECT--------------------------
pa_project_pub.create_project(
p_api_version_number=> v_api_version_number,
p_commit => v_commit,
p_init_msg_list => v_init_msg_list,
p_msg_count => v_msg_count,
p_msg_data => v_msg_data,
p_return_status => v_return_status,
p_workflow_started => v_workflow_started,
p_pm_product_code => v_pm_product_code,
p_project_in => v_project_in,
p_project_out => v_project_out,
p_key_members => v_key_members,
p_class_categories => v_class_categories,
p_tasks_in => v_tasks_in,
p_tasks_out => v_tasks_out);
if v_return_status = 'S'
then
UPDATE XXPA.XXPA_PROJECT_IN_STG
SET INTERFACE_STATUS ='Success' where segment1 = v_project_out.pa_project_number; ---P->pending & S-> Success
dbms_output.put_line('New Project Id: ' || v_project_out.pa_project_id);
dbms_output.put_line('New Project Number: ' || v_project_out.pa_project_number);
else
UPDATE XXPA.XXPA_PROJECT_IN_STG
SET INTERFACE_STATUS ='Pending' where segment1 = v_project_out.pa_project_number;
raise API_ERROR;
end if;
END LOOP;
Commit;
------Handling Exception--------
EXCEPTION
WHEN api_error THEN
dbms_output.put_line('An error occured during project creation');
IF (v_msg_count > 0 ) THEN
FOR i IN 1..v_msg_count LOOP
apps.PA_INTERFACE_UTILS_PUB.get_messages(
p_msg_count => v_msg_count,
p_encoded => 'F',
p_msg_index => i,
p_msg_data => v_msg_data,
p_data => v_data,
p_msg_index_out => v_msg_index_out);
dbms_output.put_line('Error message v_data ->'||v_data);
dbms_output.put_line('Error message v_msg_data ->'||v_msg_data);
dbms_output.put_line('Error message v_msg_index_out ->'||v_msg_index_out);
dbms_output.put_line('Error message p_msg_index ->'||i);
APPS.fnd_file.put_line(APPS.FND_FILE.LOG,v_data);
END LOOP;
END IF;
WHEN OTHERS THEN
dbms_output.put_line('An error occured during conversion, SQLCODE ->'|| SQLERRM);
IF (v_msg_count >=1 ) THEN
FOR i IN 1..v_msg_count LOOP
PA_INTERFACE_UTILS_PUB.get_messages(
p_msg_count => v_msg_count,
p_msg_index => i,
p_encoded => 'F',
p_msg_data => v_msg_data,
p_data => v_data,
p_msg_index_out => v_msg_index_out);
dbms_output.put_line('Error message ->'||v_data);
APPS.fnd_file.put_line(APPS.FND_FILE.LOG,v_data);
END LOOP;
END IF;
end; --end procedure
END xxpa_proj_conv_pkg;
* Please tell me how to assign project specific task with the newly created projects??? *
Also please tell me how to assign multiple * Project_Relationship_Code * (ex: END CLIENT, GENERAL CONTRACTOR, PRIMARY) for a particular project during project creation?

Are you not storing the project number in the staging table designed for storing the task data? You can use create_project API to create the project and tasks at the same time with one single call. You may want to try that option

Similar Messages

  • How to get a specific layout with the available layout managers?

    Hi
    Not done java GUI's (approximately 5 and a half years) for a while (I havn't even touched java for ages until a few months ago), and I am a little embarrased by how much I have forgotten.
    After tring unsuccessfully several times with TableLayouts and GridBagLayouts to produce this [ [http://i32.tinypic.com/fl94kp.png] ] sort of layout, I have decided I am either being incredibly stupid, or It's a rather difficult thing to do.
    (Sorry about the crudeness of the drawing)
    Please can someone point me on the right track as to what combination of layout managers + components I should be using to achive this, or even be super kind and post a code snippet for it.
    Preferably, I would like to use just the default layout manages / components that come with java, which will allow me to continue working on the GUI in netbeans without it complaining, but I'll use external libraries if absolutely nesecarry.
    Thanks
    A completely unrelated side note, but where the heck have all my past posts and dukes gone. :(
    Edited by: DarthCrap on Aug 2, 2010 5:14 PM

    Yes, A BorderLayout did solve my problems. It appears I was being stupid after all. :)
    @Encephalopathic. Using a gridbaglayout does indeed help with the centering issue for the smaller panel on the right. I had just worked that out myself when you posted. I had been reluctant to try the gridbaglayout for that, because it caused me a load of pain when I tried using it for the original problem.
    Thanks

  • HT1386 How do you sync specific songs with the NEW iTunes?

    I have a large music library and my iPhone is only 16GB. This limits the amount of songs i can put on it. In the previous iTunes it was possible to remove a song by simply un-ticking it. I've tried that in the current version of iTunes but when i sync, the songs still end up on my iPhone.
    What can I do to stop certain songs from syncing (whitout having to create a million playlists)?

    Make sure that the "Sync Music" option from the Music tab in your iTunes is checked but not the "Entire music library" underneath the "Entire music library" option you can select which parts of you iTunes library to sync with your iPhone.

  • How to attach an existing OD to the newly created OD ?

    I have created new OD. Now i want to copy the existing OD to newer one.
    How to do this?
    Regards,
    Amit

    Hi,
    If you want to copy an OD into a new OD, you can just copy the code and paste it in the new OD right?. If there are many lines, use CTRL+Y select all the lines, copy it.
    now create a new dependency in CU01 or locally. then in the dependency editor, paste what you copied and save it.
    Regards,
    Ashok

  • How to cause a form to reload with a newly created record?

    I hope this is easy and I'm just missing it.
    I have a form based on a table (a "parent" table.). The parent table uses a trigger to generate the PK.
    When a new parent record is created with the form, I want the page to reload with the newly created record still in the form. Then some conditional regions based upon child-tables would appear, with options to populate the detail records.
    My problem is simple: how can I access the value of the primary key of the newly created record once it is submitted to the database, so I can use it to reload that record into the form?
    Thanks very much for your help!

    John - The DML process (Automatic Row Processing) has a Return Key Into Item option. That's what you need.
    Scott

  • How can I assign a ringtone to a specific contact with the iphone4 ios7

    How can I assign a ringtone to a specific contact with the iphone4 ios7?

    From the home screen, tap on Contacts, tap on the contact you'd like to edit.
    In the top right, tap the , scroll down, for Ringtone, tap on Default, select the desired ringtone.

  • How do I revert to replaced audio files being saved with the project file, *not* with the original audio files?

    In the latest release, when you send an audio clip to Audition, the newly created audio clip - which was previously saved in the same folder as the project file - is saved next to the original audio file.
    Makes sense, but for reasons to boring to go into, it's a major headache for my workflow, because it means combing through folders to find the files, instead of having them all in once place.
    So how to I turn this off and revert to those files being saved next to the project file?

    Hey Steve,
    You'll want to connect your phone to your computer and sync it in iTunes. You can read more about it here:
    iOS: Syncing your data with iTunes
    http://support.apple.com/kb/HT1386
    Welcome to Apple Support Communities!
    Have a good one,
    Delgadoh

  • Problem with the% deviation from Project Server 2010 field

    hello
    I have a problem with the% deviation from Project Server 2010 field.
    Within a file or project, this project contains tasks.
    Each task has completed the field% deviation.
    Within the row "Summary" in the field of% deviation does not perform the sum of all fields of tasks.
    Only occurs on certain projects, these projects have the view of PR Progress Report
    Anyone know happens?
    thank you very much

    Hi
    Sorry, I'll be more specific now.
    Within the field% deviation. Your settings in PWA is:
    The formula for field% Deviation:
    Str (IIf ([Job baseline] = 0; IIf ([Working] = 0, 0, 100); IIf ([Working] = 0; -100; Int (100 * ([Job] - [Work Online base]) / [Working baseline])))) + "%"
    Under the heading rows Calculation Summary:
    > Use formula.
    Within the field Allocation Calculation of rows:
    > It is labeled the "Apply unless you manually specify".
    The field [Job] and field [Job baseline] are fields Pack project server.
    The error is in project, in the list of tasks.
    In the top row, this row summary makes the sum of the ranks of the tasks of the file.
    But in my case only in the summary field the same value appears in the tasks.
    In all the cells in column% deviation appears the same value.
    I hope it helps.
    thank you very much

  • How can I gift a playlist, with the songs in the order I choose?

    How can I gift a playlist, with the songs in the order I choose, to a bunch of other people? Since iTunes won't allow me to burn a song more than a few times to disc, and I have to share playlists with my cover band (so we can learn songs), I need the capability to do this.

    Drag them from where? I've tried to drag them from windows explorer and it won't allow me. It seems the only place I can drag files from is from the iTunes library list. The problem is there is no way that I can find to just see the songs from a specific folder on my drive in the iTunes library list. It sorts them by artist, album, genre, etc....but not by folder.

  • I imported a video I make in another program and I played it back in the video editor and I like the pan and zoom that was added by the program how do I save a copy with the effect of Premiere elements 12

    I imported a video I make in movie maker program and I played it back in the premiere video editor and I like the pan and zoom that was added by the program how do I save a copy with the effect of Premiere elements 12
    all I did was played it back how do I save that and make a new version of the video beacause when I save a copy the effect look I was trying to save was not there.
    Rodney
    [personal information removed... Mod - https://forums.adobe.com/docs/DOC-3731]
    [This is an open forum, not Adobe support, please do not post personal information]
    [If you are posting using email, please turn your 'sig file' function OFF for posting]

    silkman1
    I would be glad for the opportunity to customize a Premiere Elements 12 answer to your Premiere Elements 12 issue.
    But, I want to make sure that we are together on the details. This is my understanding of what you have written. Please review and let me
    know if I am misinterpreting anything that you have written.
    You have a video created in Windows Movie Maker.
    How did you output the video from Windows Movie Maker...wmv or mp4, what was the frame size and frame rate of that export?
    Next you import that video into Premiere Elements 12 (can we assume that this is on Windows 7, 8, or 8.1 64 bit?)
    From what you wrote, you have applied a pan and zoom effect to your video in Premiere Elements.
    Now you go to export the Premiere Elements 12 Timeline content with your video with the pan and zoom applied.
    But, the pan and zoom effect is not seen in playback of the export.
    Is all of the above correct so far?
    If so....we are going to need some more details from you...
    a. What is the project preset that you or the project are setting to match the properties of the video coming from Movie maker? See Edit Menu/Project Settings/General and the readings for Editing Mode, Timebase, Frame Rate, and Pixel Aspect Ratio even if the fields look grayed out.
    b. Are you applying the pan and zoom effect with the Pan and Zoom Tool, fx Effects Presets, or keyframing the Scale (for Zoom) and
    Position (for Pan) in the Motion Panel expanded?
    c. What are you selecting as your export in Publish+Share/. Please give details...are you using default settings or customizing the export
    setting under the Advanced Button/Video Tab and Audio Tab of the preset selected?
    I am suspecting some sort of mismatch of your project settings or some problems with working with the Pan and Zoom tool. I need
    your answers to help me help you. If I have written anything that you do not understand, please let me know. I will re-write if necessary
    so that we are in sync to resolve the issue.
    Thanks.
    ATR

  • How to assign a pricing type to the pricing procedure ?

    Business Scenario : When the prices change from the time the order is taken to the time the invoice is created, how can setup the system to  handle the changes automatically ? 
    I would like to know How to create a pricing type and How to assign a pricing type to the pricing procedure so that I can use the 'new pricing document' function in the sales document and 'Update prices' on the condition screens in the Billing document.
    Thanks for your input in advance.
    Oscar

    Hi !! Oscar,
    1) For pricing type definition you would require the help of a developer.
    2) However, most of the commonly occuring requirements are supplied with  standard SAP.
    You can assign a pricing type to pricing procedure as follows:-
    IMG>S & D >Basic Functions>Pricing>Pricing Control>Define & Assign pricing procedures>Maintain pricing procedure> Here, locate your pricing procedure , in the fourth coloumn using the drop down list, you can assign a pricing type to the pricing procedure.
    Now you can use the 'new pricing document' function in the sales document and 'Update prices' on the condition screens in the Billing document !
    Regards,
    PATHIK
    Message was edited by:
            Pathik Pandya

  • I am using i 4 phone. recently I had a problem with my lap top and had formatted hard disk of it. Now I want to use sync data in my iphone back to itune n my lap top. how can I perform this task with out loosing data in my i phone.

    I am using i 4 phone. recently I had a problem with my lap top and had formatted hard disk of it. Now I want to sync data in my iphone back to itune on my lap top. how can I perform this task with out loosing data in my i phone.

    Hey floridiansue,
    Do you have an installed email program such as Microsoft Outlook?  If your email is through an online login, such as Gmail, etc, then one will have to create an email association with a program such as Microsoft Outlook on the PC for this Scan to Email system to function.
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------
    I am not an HP employee.

  • My computer was reimaged and iTunes was deleted, now when I try to sync my ipad it says it is synced with another library?  How do I sync with the newly installed iTunes without losing all of my data on my ipad?

    My computer was reimaged and iTunes was deleted, now when I try to sync my ipad it says it is synced with another library?  How do I sync with the newly installed iTunes without losing all of my data on my ipad?

    Copy all the content on your iPod back to your PC and into iTunes. Then go ahead and sync the iPod with your new library.
    See this older post from another forum member Zevoneer covering the different methods and software available to assist you with the task of copying content from your iPod back to your PC and into iTunes.
    https://discussions.apple.com/thread/2452022?start=0&tstart=0
    B-rock

  • How to pass username and password with the portal url

    i want to access portal from my web site. i have created username and password fields in my web page. when submited , my portal page should open. so how to pass username and password with the portal url.

    This is not straightforward; but it is doable.
    First tell us about your portal version; portal 10.1.4 has a slightly different method of doing it and the pre-10g portals were completely different animals.
    And if you are in AS Rel 2, then the most important document for you would probably be the following:
    [Creating Deployment Specific Pages| http://download-west.oracle.com/docs/cd/B14099_19/idmanage.1012/b14078/custom.htm#i1015535]
    You might want to use it in conjunction with some metalink notes about your portal version and such a login page.
    hope that helps!
    AMN

  • How do I allow network volumes with the latest iMovie 10.0?

    How do I allow network volumes with the latest iMovie 10.0? The old "defaults write -app iMovie allowNV -bool true" doesn't work anymore.

    So, apparently, while iMovie is open, I have to EJECT the Net Drive.  When I remount it, iMovie immediately picks it up.
    That said... the update leaves much to be desired.  Many of the Projects have unlinked video (even though the same update using a Firewire HD shows the video linked).
    Message was edited by: BradNet

Maybe you are looking for