Showing posts with label PA. Show all posts
Showing posts with label PA. Show all posts

Tuesday, 22 July 2025

Query to find customer number and name from project

 SELECT
    ppa.project_id,
    ppa.segment1,
    ppa.name,
    hp.party_name,
    hca.account_number,
    hcp.credit_checking,
    hcp.credit_hold
FROM
    pa_projects_all         ppa,
    pa_project_customers    ppc,
    hz_cust_accounts        hca,
    hz_customer_profiles    hcp,
    hz_cust_acct_sites_all  hcasa,
    hz_parties              hp
WHERE
        1 = 1
    AND ppa.project_id = ppc.project_id
    AND ppc.customer_id = hca.cust_account_id
    AND hp.party_id = hca.party_id
    AND hca.cust_account_id = hcp.cust_account_id
    AND ppc.bill_to_address_id = hcasa.cust_acct_site_id
    AND hcp.site_use_id IS NULL
    AND ppa.segment1 = '1111111';

Query to find customer information from PA Project

  SELECT
    ppa.project_id,
    ppa.segment1,
    ppa.name,
    hp.party_name,
    hca.account_number,
    hcp.credit_checking,
    hcp.credit_hold,
    hl_ship.address1               ship_address1,
    hl_ship.address2               ship_address2,
    hl_ship.address3               ship_address3,
    hl_ship.address4               ship_address4,
    hl_ship.postal_code          ship_postal_code,
    hl_ship.city                       ship_city,
    hl_ship.state                      ship_state,
    hl_ship.province               ship_province,
    hl_ship.county                  ship_county,
    hl_bill.address1                bill_address1,
    hl_bill.address2                bill_address2,
    hl_bill.address3                bill_address3,
    hl_bill.address4                bill_address4,
    hl_bill.postal_code           bill_postal_code,
    hl_bill.city                        bill_city,
    hl_bill.state                       bill_state,
    hl_bill.province                bill_province,
    hl_bill.county                   bill_county
FROM
    pa_projects_all                ppa,
    pa_project_customers     ppc,
    hz_cust_accounts            hca,
    hz_customer_profiles      hcp,
    hz_cust_acct_sites_all     hcasa_bill,
    hz_party_sites                  hps_bill,
    hz_locations                     hl_bill,
    hz_cust_acct_sites_all     hcasa_ship,
    hz_party_sites                  hps_ship,
    hz_locations                     hl_ship,
    hz_parties                         hp
WHERE
        1 = 1
    AND ppa.project_id = ppc.project_id
    AND ppc.customer_id = hca.cust_account_id
    AND hp.party_id = hca.party_id
    AND hca.cust_account_id = hcp.cust_account_id
    AND ppc.bill_to_address_id = hcasa_bill.cust_acct_site_id
    AND hcasa_bill.party_site_id = hps_bill.party_site_id
    AND hps_bill.location_id = hl_bill.location_id
    AND ppc.ship_to_address_id = hcasa_ship.cust_acct_site_id
    AND hcasa_ship.party_site_id = hps_ship.party_site_id
    AND hps_ship.location_id = hl_ship.location_id
    AND hcp.site_use_id IS NULL
    AND ppa.segment1 = '1111111';

Monday, 30 March 2020

Script to update pa deliverable action (pa_project_pub.update_deliverable_action)

DECLARE

l_api_version_number NUMBER := 1.0;
l_init_msg_list VARCHAR2 (1) := 'F';
l_commit VARCHAR2 (1) := 'F';
l_return_status VARCHAR2 (1);
l_action_out                pa_project_pub.action_out_tbl_type;
l_msg_count                 NUMBER := 0;
        l_msg_data                  VARCHAR2 (2000);
        l_msg_dummy                 VARCHAR2 (2000);

BEGIN

fnd_file.put_line (fnd_file.LOG,'nuan_deliverable_action_upd start');

pa_project_pub.update_deliverable_action (
  p_api_version => l_api_version_number
, p_init_msg_list => l_init_msg_list
, p_commit => l_commit
, x_return_status => l_return_status--l_return_status
, p_action_name => 'CTX Go Live'--action_rec.action_name  pa_dlvr_actions_v.element_name
, p_action_id => 4964902--action_rec.proj_element_id pa_dlvr_actions_v.proj_element_id
, p_pm_action_reference => 'PGL_CONVERSION'--action_rec.pm_source_reference--pa_deliverables_v.pm_source_reference
, p_action_owner_id => 19132--action_rec.manager_person_id pa_dlvr_actions_v.manager_person_id
, p_due_date => '26-MAR-2020'--l_due_date --pass due date
, p_completion_date => '26-MAR-2020' --pass completion_date
, p_deliverable_id => 4964900--action_rec.deliverable_id --pa_deliverables_v.proj_element_id
, p_project_id => 331512--action_rec.project_id --pa_dlvr_actions_v.project_id
, x_action_out => l_action_out--l_action_out
, p_pm_source_code => NULL--l_pm_product_code
, x_msg_count => l_msg_count--l_msg_count
, x_msg_data => l_msg_data--l_msg_data
);

COMMIT;

fnd_file.put_line (fnd_file.LOG,'pa_project_pub.update_deliverable_action return status:'||l_return_status);

IF l_return_status <> 'S'
THEN
--log_msg('deliverable_action api is in error');
FOR i IN 1 .. l_msg_count
LOOP
fnd_msg_pub.get (i,fnd_api.g_false,l_msg_data,l_msg_dummy );
--p_error_message :=v_msg_data;
   -- p_return_status :='E';
   -- log_msg(v_msg_data);
END LOOP;
fnd_file.put_line (fnd_file.LOG,'API Error for action :'||'Action_name :'||l_msg_data);
ELSE
fnd_file.put_line (fnd_file.LOG,'API is successfully updated for action :'||'CTX Go Live');
END IF;

fnd_file.put_line (fnd_file.LOG,'nuan_deliverable_action_upd start');

END;

Script to update pa deliverable (pa_project_pub.update_deliverable)

Declare

l_api_version_number          NUMBER := 1.0;
l_init_msg_list VARCHAR2 (1) := 'F';
l_commit VARCHAR2 (1) := 'F';
l_debug_mode VARCHAR2 (1) := 'N';
l_return_status                VARCHAR2 (1);
l_completion_date  DATE;
l_deliverable_id              NUMBER;
l_proj_source_reference        pa_proj_elements.pm_source_reference%TYPE  := 'PGL_CONVERSION'; --pa_deliverables_v.pm_source_reference
    l_action_in                    pa_project_pub.action_in_tbl_type;
    l_action_out                  pa_project_pub.action_out_tbl_type;
l_pm_source_code              pa_proj_elements.pm_source_code%TYPE := NULL;
l_msg_count                    NUMBER := 0;
l_msg_data                    VARCHAR2 (4000);
v_msg_data          VARCHAR2(4000);
l_pgld_error_count            NUMBER := 0;
    l_msg_dummy                    VARCHAR2 (4000);
g_enter                        VARCHAR2 (10) := CHR (10);


BEGIN

fnd_file.put_line (fnd_file.LOG,'nuan_deliverable_upd start');

l_deliverable_id := 4964900;--5103921; pa_deliverables_v.proj_element_id

        fnd_global.apps_initialize ( 120865--p_user_id
                                , 57461--l_resp_id
                                , 275--- l_appln_id
                                 );


fnd_file.put_line (fnd_file.LOG,'l_deliverable_id:'||l_deliverable_id);
fnd_file.put_line (fnd_file.LOG,'pa_project_pub.update_deliverable start');

pa_project_pub.update_deliverable (
  p_api_version                    => l_api_version_number
, p_init_msg_list                  => l_init_msg_list
, p_commit                        => l_commit
, p_debug_mode                    => l_debug_mode
, x_return_status                  => l_return_status
, p_deliverable_name              => 'Upgrade Provider sss test1'--c_project_rec.name  || l_prefix --pa_deliverables_v.element_name
, p_deliverable_short_name        => 'Training sss test1'--c_project_rec.short_name || l_prefix --pa_deliverables_v.element_number
, p_deliverable_type_id            => 10000--10020--v_deliverable_type_id_pgl --pa_deliverables_v.dlvr_type_id
, p_deliverable_owner_id          => 88733--c_project_rec.project_manager_id --pa_deliverables_v.manager_person_id
, p_description                    => 'QTY 70 days of Upgrade Provider Training @ $2,000 ea = $140,000 sss test1'--c_project_rec.description ----pa_deliverables_v.manager_person_id
, p_status_code                    => 'DLVR_IN_PROGRESS'--'DLVR_COMPLETED'--NULL -- c_project_rec.status_code --pa_deliverables_v.deliverable_system_status_code
, p_due_date                      => NULL--'23-MAR-2020'--l_completion_date
, p_completion_date                => NULL--'23-MAR-2020'--NULL
, px_deliverable_id                => l_deliverable_id
, p_pm_deliverable_reference      => l_proj_source_reference
, p_project_id                    => 331512--334827--c_project_rec.project_id --pa_deliverables_v.project_id
, p_action_in_tbl                  => l_action_in
, x_action_out_tbl                => l_action_out
, p_pm_source_code                => l_pm_source_code
, x_msg_count                      => l_msg_count
, x_msg_data                      => l_msg_data
);

commit;

fnd_file.put_line (fnd_file.LOG,'l_return_status:'||l_return_status);
fnd_file.put_line (fnd_file.LOG,'l_deliverable_id:'||l_deliverable_id);

IF l_return_status <> 'S' THEN
l_pgld_error_count :=   l_pgld_error_count + 1;

fnd_msg_pub.get (p_msg_index          => 1
, p_encoded            => 'F'
, p_data                => l_msg_data
, p_msg_index_out      => l_msg_dummy
);

l_msg_data := SUBSTR (l_msg_data, 1, 250);
fnd_file.put_line (fnd_file.LOG,'l_msg_data:'||l_msg_data);
v_msg_data := v_msg_data || g_enter || l_msg_data;
fnd_file.put_line (fnd_file.LOG,'v_msg_data:'||v_msg_data);
ELSE

fnd_file.put_line (fnd_file.LOG,'Deliverable updated successfully for deliverable_id:'||l_deliverable_id);
END IF;

END;