Sunday, July 18, 2021

Customer Credit Limits API in Oracle Apps

DECLARE 

l_cust_prof_amt_rec hz_customer_profile_v2pub.cust_profile_amt_rec_type;

l_version_num NUMBER;

l_return_status     VARCHAR2(1);

l_msg_count NUMBER;

l_msg_data VARCHAR2(4000);

BEGIN

l_cust_prof_amt_rec.cust_acct_profile_amt_id :=hz_cust_profile_amts.cust_acct_pr ofile_amt_id;

l_cust_prof_amt_rec.trx_credit_limit := 0; 

l_cust_prof_amt_rec.overall_credit_limit :=1000; 

l_version_num := l_cbd_rec (l_cbd).object_version_number; 

hz_customer_profile_v2pub.update_cust_profile_amt(

'T'

,l_cust_prof_amt_rec

,l_version_num

,l_return_status

,l_msg_count

,l_msg_data 

); 

EXCEPTION

WHEN OTHERS THEN

dbms_output.put_line('Main Exception '||SQLERRM);

END;


How to set the Profile Option value using API (backend)

DECLARE

   xx_api_return_value   BOOLEAN;

BEGIN

   xx_api_return_value := fnd_profile.SAVE ('CONC_REPORT_ACCESS_LEVEL'

                        , 'R'

                        , 'USER'

                        , 'ABCDE'

                        , NULL

                        , NULL

                         );


   IF xx_api_return_value THEN

      DBMS_OUTPUT.put_line ('Profile value set successfully');

      COMMIT;

   ELSE

      DBMS_OUTPUT.put_line ('Error occured while setting profile value');

   END IF;

EXCEPTION

    WHEN OTHERS THEN

    DBMS_OUTPUT.put_line ('Main Exception. Error occured while setting profile value');

END;


  • FND_PROFILE.SAVE Function can be used to set the value of any profile option at any level i.e. Site Level, Application Level, Responsibility Level, User Level.


How to get URL Link for the attachments in Oracle Apps

 FUNCTION xx_attachment_url(p_po_header_id IN NUMBER

  ,p_vendor_id    IN NUMBER

  )

RETURN CHAR 

IS 

ln_gfm_id NUMBER; 

lc_gfm_agent VARCHAR2 (250); 

lc_url VARCHAR2 (2000); 

ln_media_id  NUMBER; 

begin 

SELECT DISTINCT dt.media_id 

  INTO ln_media_id 

  FROM fnd_attached_documents ad

      ,fnd_documents_tl dt 

WHERE(

(entity_name = 'PO_HEADER' 

AND pk1_value = :p_po_header_id 

AND pk2_value = '1'

) 

OR (entity_name = 'PO_HEADERS' 

AND pk1_value = :p_po_header_id

    ) 

OR (entity_name = 'PO_VENDORS' 

AND pk1_value = :p_vendor_id)) 

   AND ad.document_id=dt.document_id 

   AND dt.language = USERENV('LANG') 

   AND ROWNUM<2

   ; 

lc_gfm_agent := fnd_web_config.gfm_agent; 

ln_gfm_id := ln_media_id;

lc_url := fnd_gfm.construct_download_url (lc_gfm_agent, ln_gfm_id, FALSE); 

RETURN lc_url; 

EXCEPTION 

WHEN OTHERS THEN 

RETURN(NULL); 

END;


Friday, July 16, 2021

API to create Bank and Bank Branch in Oracle Apps

IBY_EXT_BANKACCT_PUB.create_ext_bank:

  • It is used to create the External Bank, please note that the Bank name and Home Country Name are mandatory for creating an External Bank. 
  • Once you create the Bank, Bank Party ID gets created and you can check it from IBY_EXT_BANKS_V view.

        IBY_EXT_BANKACCT_PUB.create_ext_bank (

p_api_version => 1.0 

,p_init_msg_list => FND_API.G_TRUE 

,p_ext_bank_rec => x_bank_rec 

,x_bank_id => x_bank_id 

,x_return_status => x_return_status 

,x_msg_count => x_msg_count 

,x_msg_data => x_msg_data 

,x_response => x_response_rec 

); 

IBY_EXT_BANKACCT_PUB.create_ext_bank_branch: 

  • It is used to create a Bank Branch, so that an account could be created in the same branch. 
  • Once a Bank Branch is created, a record gets inserted into IBY_EXT_B ANK_BRANCHES_V view. 

    IBY_EXT_BANKACCT_PUB.create_ext_bank_branch(

p_api_version => 1.0 

,p_init_msg_list => FND_API.G_TRUE 

,p_ext_bank_branch_rec => x_bank_branch_rec 

,x_branch_id => x_branch_id 

,x_return_status => x_return_status 

,x_msg_count => x_msg_count 

,x_msg_data => x_msg_data 

,x_response => x_response_rec 

); 

  • After the bank and branches are created, the table iby_temp_ext_bank_accounts can be populated to create the bank accounts and associate to the supplier or supplier site 
  • Please Note that table must be populated prior to running the supplier interface 
  • Below API's are used internally by oracle to create payee and associate bank acc ount to supplier or supplier site.

        IBY_EXT_BANKACCT_PUB.create_ext_bank_acct (

p_api_version => 1.0 

,p_init_msg_list => FND_API.G_TRUE 

,p_ext_bank_acct_rec => x_bank_acct_rec 

,x_acct_id => x_acct_id 

,x_return_status => x_return_status 

,x_msg_count => x_msg_count 

,x_msg_data => x_msg_data 

,x_response => x_response_rec 

); 

IBY_DISBURSEMENT_SETUP_PUB.Create_External_Payee (

p_api_version => 1.0

,p_init_msg_list => FND_API.G_TRUE

,p_ext_payee_tab => v_external_payee_tab_type

,x_return_status => v_return_status

,x_msg_count => v_msg_count

,x_msg_data => v_msg_data

,x_ext_payee_id_tab => x_ext_payee_id_tab

,x_ext_payee_status_tab => x_ext_payee_status_tab

);


IBY_DISBURSEMENT_SETUP_PUB.Set_Payee_Instr_Assignment (

p_api_version => 1.0 

,p_init_msg_list => FND_API.G_TRUE 

,p_payee => x_rec 

,p_assignment_attribs => x_assign 

,x_assign_id => x_assign_id 

,x_return_status => x_return_status 

,x_msg_count => x_msg_count 

,x_msg_data => x_msg_data 

,x_response => x_response_rec

);

Query to display Security Rule details in General Ledger

 SELECT fif.id_flex_name

      ,fifs.id_flex_structure_name

      ,ffksv.parent_segment_name

      ,ffvrv.flex_value_rule_name

      ,ffvrv.description

      ,ffvrv.error_message

      ,DECODE(ffvrl.include_exclude_indicator, 'I','Include'

                                         , 'E','Exclude')

      ,ffvrl.flex_value_low

      ,ffvrl.flex_value_high

      ,fav.application_name

      ,frv.responsibility_name

      ,ffvrv2.flex_value_rule_name

  FROM fnd_id_flexs fif

      ,fnd_id_flex_structures_tl fifs

      ,fnd_flex_key_seg_vset_v ffksv

      ,fnd_flex_value_rules_vl ffvrv

      ,fnd_flex_value_rule_lines ffvrl

      ,fnd_flex_value_rule_usages ffvru

      ,fnd_application_vl fav

      ,fnd_responsibility_vl frv

      ,fnd_flex_value_rules_vl ffvrv2

 WHERE fif.id_flex_name ='Accounting Flexfield'

   AND fif.id_flex_code = fifs.id_flex_code

   AND ffksv.id_flex_name = fif.id_flex_name

   AND ffksv.id_flex_structure_name = fifs.id_flex_structure_name

   AND ffvrv.flex_value_set_id = ffksv.flex_value_set_id

   AND ffvrl.flex_value_set_id = ffksv.flex_value_set_id

   AND ffvrl.flex_value_rule_id = ffvrv.flex_value_rule_id

   AND ffvru.flex_value_set_id = ffksv.flex_value_set_id

   AND fav.application_id = ffvru.application_id

   AND frv.responsibility_id = ffvru.responsibility_id

   AND ffvrv2.flex_value_set_id = ffvru.flex_value_set_id

   AND ffvrv2.flex_value_rule_id = ffvru.flex_value_rule_id

Query to display Transaction Type Details In Oracle Receivables

SELECT hou.name operating_unit      

      ,xep.name legal_entity

      ,rctta.name      

      ,rctta.description

      ,al.meaning class

      ,al2.meaning creation_sign

      ,al3.meaning transaction_status

      ,al4.meaning printing_option

      ,null invoice_type

      ,rctt2.name credit_memo_type

      ,aars.rule_set_name application_rule_set

      ,aat.payment_term_name terms

      ,rctta.start_date

      ,rctta.end_date      

      ,rctta.accounting_affect_flag open_receivable

      ,rctta.adj_post_to_gl allow_adjustment_posting

      ,rctta.post_to_gl post_to_gl

      ,rctta.allow_freight_flag allow_freight

      ,rctta.natural_application_only_flag natural_application_only

      ,rctta.tax_calculation_flag default_tax_classification

      ,rctta.exclude_from_late_charges exclude_from_late_charges_cal

      ,rctta.allow_overapplication_flag allow_over_application

      ,gcck.concatenated_segments receivable_account

      ,gcck3.concatenated_segments freight_account

      ,gcck2.concatenated_segments revenue_account

      ,gcck4.concatenated_segments clearing_account

      ,gcck5.concatenated_segments unbilled_receivable_account

      ,gcck6.concatenated_segments unearned_revenue_account

      ,gcck7.concatenated_segments tax_account

  FROM ra_cust_trx_types_all rctta

      ,hr_operating_units hou

      ,xle_entity_profiles xep

      ,ar_lookups al

      ,ar_lookups al2

      ,ar_lookups al3

      ,ar_lookups al4

      ,ra_cust_trx_types_all rctta2

      ,ar_app_rule_sets aars

      ,arfv_ar_terms aat

      ,gl_code_combinations_kfv gcck

      ,gl_code_combinations_kfv gcck2

      ,gl_code_combinations_kfv gcck3

      ,gl_code_combinations_kfv gcck4

      ,gl_code_combinations_kfv gcck5

      ,gl_code_combinations_kfv gcck6

      ,gl_code_combinations_kfv gcck7

 WHERE 1=1

   AND rctta.org_id= hou.organization_id

   AND xep.legal_entity_id(+)=rctta.legal_entity_id

   AND al.lookup_type='INV/CM'

   AND al.lookup_code=rctta.type

   AND al2.lookup_type='SIGN'

   AND al2.lookup_code=rctta.creation_sign

   AND al3.lookup_type='INVOICE_TRX_STATUS'

   AND al3.lookup_code=rctta.default_status

   AND al4.lookup_type='INVOICE_PRINT_OPTIONS'

   AND al4.lookup_code=rctta.default_printing_option

   AND rctta.credit_memo_type_id=rctta2.cust_trx_type_id(+)

   AND rctta.org_id=rctta2.org_id(+)

   AND rctta.rule_set_id=aars.rule_set_id(+)

   AND rctta.default_term=aat.term_id(+)

   AND gcck.code_combination_id(+)=rctta.gl_id_rec

   AND gcck2.code_combination_id(+)=rctta.gl_id_rev

   AND gcck3.code_combination_id(+)=rctta.gl_id_freight

   AND gcck4.code_combination_id(+)=rctta.gl_id_clearing

   AND gcck5.code_combination_id(+)=rctta.gl_id_unbilled

   AND gcck6.code_combination_id(+)=rctta.gl_id_unearned

   AND gcck7.code_combination_id(+)=rctta.gl_id_tax

;


Thursday, July 15, 2021

Query to find the Schemas and the status of the products in Oracle Applications.

 SELECT fou.oracle_id

      ,fou.oracle_username ora_schema_name

  ,fa.application_short_name 

  ,ft.application_name

  ,fa.product_code

  ,fpi.product_version

  ,DECODE (fpi.status, 'I', 'Installed', 'N', 'Not Installed', 'S', 'Shared Install') installation_status

  ,NVL (fpi.patch_level, '-- Not Available --') patch_level

  ,TO_CHAR (fpi.last_update_date, 'DD-MON-RRRR') update_date 

  FROM fnd_oracle_userid fou

      ,fnd_application fa

      ,fnd_product_installations fpi

  ,dba_users du, fnd_application_tl ft 

 WHERE fpi.application_id = fa.application_id(+) 

   AND fpi.oracle_id(+) = fou.oracle_id 

   AND du.username(+) = fou.oracle_username 

   AND ft.language(+) = USERENV('LANG')

   AND ft.application_id(+) = fa.application_id 

ORDER BY fou.oracle_username

Wednesday, July 14, 2021

Employee Supervisor Update API in Oracle Apps

PROCEDURE emp_supervisor_update_p(errbuf IN VARCHAR2

                                 ,retcode  IN NUMBER

) 

IS

l_person_id NUMBER;

l_assignment_id NUMBER;

l_effective_date DATE:= NULL;

l_supervisor_id NUMBER;

lb_correction BOOLEAN;

lb_update BOOLEAN;

lb_update_override BOOLEAN;

lb_update_change_insert BOOLEAN;

lc_dt_ud_mode VARCHAR2(100):= NULL;

l_obj_version_num NUMBER;

l_soft_coding_keyflex_id hr_soft_coding_keyflex.soft_coding_keyflex_id%TYPE;

l_concatenated_segments VARCHAR2(2000);

l_comment_id per_all_assignments_f.comment_id%TYPE;

l_effective_start_date per_all_assignments_f.effective_start_date%TYPE;

l_effective_end_date per_all_assignments_f.effective_end_date%TYPE;

l_no_managers_warning BOOLEAN;

l_other_manager_warning BOOLEAN;

err_msg         VARCHAR2(4000):= NULL;

current_records NUMBER;

total_records NUMBER;

error_records NUMBER;

l_effective_date_valid NUMBER;

error_msg          VARCHAR2(4000):= NULL;


CURSOR cur_emp_supervisor_upd 

IS

SELECT ROWID, stg.*

  FROM xx_emp_sup_update_stg stg 

WHERE stg.update_status IS NULL OR stg.update_status = 'E';


BEGIN

SELECT COUNT(*) 

  INTO current_records 

  FROM xx_emp_sup_update_stg stg 

WHERE stg.update_status IS NULL OR stg.update_status = 'E';


FOR rec_emp_supervisor_upd IN cur_emp_supervisor_upd 

LOOP

l_soft_coding_keyflex_id := NULL;

l_obj_version_num := NULL;


BEGIN

SELECT person_id 

  INTO l_person_id

  FROM per_all_people_f

WHERE employee_number =rec_emp_supervisor_upd.employee_id 

   AND SYSDATE BETWEEN effective_start_date

   AND effective_end_date;


dbms_output.put_line(l_person_id);


EXCEPTION 

WHEN OTHERS THEN

err_msg1 := err_msg1||SQLERRM||'.';

END;


BEGIN

SELECT MAX(object_version_number) 

  INTO l_obj_version_num

  FROM per_all_assignments_f

WHERE person_id = l_person_id

   AND SYSDATE BETWEEN effective_start_date AND effective_end_date;

EXCEPTION 

WHEN OTHERS THEN

err_msg1 := err_msg1||SQLERRM||' *';

END;


BEGIN

SELECT assignment_id

      ,effective_start_date

  INTO l_assignment_id

      ,l_effective_date         

  FROM per_all_assignments_f

WHERE person_id = l_person_id

   AND SYSDATE BETWEEN effective_start_date AND effective_end_date

   AND object_version_number = l_obj_version_num;

EXCEPTION 

WHEN OTHERS THEN

err_msg1 := err_msg1||SQLERRM||'.';

END;


IF rec_emp_supervisor_upd.effective_date >= l_effective_date THEN

l_effective_date_valid := 1;

ELSE

l_effective_date_valid := NULL;

END IF;


BEGIN


SELECT person_id 


  INTO l_supervisor_id


  FROM per_all_people_f


WHERE employee_number = rec_emp_supervisor_upd.new_manager_id


   AND SYSDATE BETWEEN effective_start_date


   AND effective_end_date;


dbms_output.put_line(l_supervisor_id);


EXCEPTION 


WHEN OTHERS THEN


err_msg1 := err_msg1||SQLERRM||' *';


END;


IF l_person_id IS NOT NULL 


AND l_assignment_id IS NOT NULL 


AND rec_emp_supervisor_upd.effective_date IS NOT NULL 


AND l_supervisor_id IS NOT NULL 


AND l_obj_version_num IS NOT NULL 


AND l_effective_date_valid IS NOT NULL 


THEN


BEGIN


dt_api.find_dt_upd_modes

    (p_effective_date         => (rec_emp_supervisor_upd.effective_date)

,p_base_table_name        => 'PER_ALL_ASSIGNMENTS_F'

,p_base_key_column        => 'ASSIGNMENT_ID'

,p_base_key_value         => l_assignment_id

,p_correction             => lb_correction

,p_update                 => lb_update

,p_update_override        => lb_update_override

,p_update_change_insert   => lb_update_change_insert

);


IF ( lb_update_override = TRUE OR lb_update_change_insert = TRUE )

THEN

lc_dt_ud_mode := 'UPDATE_OVERRIDE';

END IF;


IF lb_correction = TRUE

THEN

lc_dt_ud_mode := 'CORRECTION';

END IF;


IF lb_update = TRUE

THEN

lc_dt_ud_mode := 'UPDATE';

END IF;


hr_assignment_api.update_emp_asg

(

   p_effective_date             => rec_emp_supervisor_upd.effective_date

  ,p_datetrack_update_mode      => lc_dt_ud_mode

  ,p_assignment_id              => l_assignment_id

  ,p_supervisor_id              => l_supervisor_id

  ,p_change_reason              => NULL

  ,p_object_version_number      => l_obj_version_num

  ,p_soft_coding_keyflex_id     => l_soft_coding_keyflex_id

  ,p_concatenated_segments      => l_concatenated_segments

  ,p_comment_id                 => l_comment_id

  ,p_effective_start_date       => l_effective_start_date

  ,p_effective_end_date         => l_effective_end_date

  ,p_no_managers_warning        => l_no_managers_warning

  ,p_other_manager_warning      => l_other_manager_warning

);


IF l_effective_start_date IS NOT NULL THEN

UPDATE xx_emp_sup_update_stg 

   SET update_status = 'S' 

WHERE ROWID = rec_emp_supervisor_upd.ROWID;

dbms_output.put_line('employee_id: '||rec_emp_supervisor_upd.employee_id||' start date'||l_effective_start_date);

COMMIT;

ELSE

UPDATE xx_emp_sup_update_stg 

   SET update_status = 'E'

  ,err_msg = 'record not inserted due to api issue.' 

WHERE ROWID = rec_emp_supervisor_upd.ROWID;

dbms_output.put_line('employee_id: '||rec_emp_supervisor_upd.employee_id||' has failed to update.');

END IF;


EXCEPTION 

WHEN OTHERS THEN

error_msg := error_msg||SQLERRM||'..';

UPDATE xx_emp_sup_update_stg 

   SET update_status = 'E'

      ,err_msg = error_msg 

WHERE ROWID = rec_emp_supervisor_upd.ROWID;

COMMIT;

END;


ELSE 

IF l_person_id IS NULL THEN

err_msg:= err_msg||'no such employee exists.'; 

END IF;


IF l_assignment_id IS NULL THEN

err_msg:= err_msg||'no such assignment exists.'; 

END IF;


IF rec_emp_supervisor_upd.effective_date IS NULL THEN

err_msg:= err_msg||'please provide correct effective date.'; 

END IF;


IF l_supervisor_id IS NULL THEN

err_msg:= err_msg||'no such supervisor exists.'; 

END IF;


UPDATE xx_emp_sup_update_stg 

   SET update_status = 'E'

      ,err_msg = err_msg 

WHERE ROWID = rec_emp_supervisor_upd.ROWID;


COMMIT;


END IF;

END LOOP;


SELECT COUNT(1) 

  INTO total_records 

  FROM xx_emp_sup_update_stg;


SELECT COUNT(1) 

  INTO error_records 

  FROM xx_emp_sup_update_stg 

WHERE update_status = 'E';


fnd_file.put_line(fnd_file.log, '---------------RECORD VALIDATION STATS-------------------');

fnd_file.put_line(fnd_file.log,'total no. of records : '||total_records);

fnd_file.put_line(fnd_file.log,'current no. of records to insert : '||current_records);

fnd_file.put_line(fnd_file.log,'no. of records inserted : '||(current_records-error_records));

fnd_file.put_line(fnd_file.log,'no. of records failed to insert : '||error_records);

fnd_file.put_line(fnd_file.log, '---------------------------------------------------------');


fnd_file.put_line(fnd_file.output, '---------------record validation stats-------------------');

fnd_file.put_line(fnd_file.output,'total no. of records : '||total_records);  

fnd_file.put_line(fnd_file.output,'current no. of records to insert : '||(total_records-error_records));

fnd_file.put_line(fnd_file.output,'no. of records failed to insert : '||error_records);

fnd_file.put_line(fnd_file.output, '---------------------------------------------------------');

EXCEPTION 

WHEN OTHERS THEN

dbms_output.put_line(SQLERRM);

END;


/


Data Base Link creation and deletion

  • To check the existing Database Links

        SELECT * 

          FROM USER_DB_LINKS;

  • To create Database Link

        CREATE DATABASE LINK xx_db_link

        CONNECT TO apps IDENTIFIED BY apps

        USING '(DESCRIPTION=

        (ADDRESS=(PROTOCOL=tcp)(HOST=<<XX_HOST>>)(PORT=1234))

        (CONNECT_DATA=

        (SID=ABC)

        )

        )';

  • To Drop the Database Link

        DROP DATABASE LINK xx_db_link;

Query to get Date and Day from Given Date

 SELECT TO_CHAR(SYSDATE-TO_CHAR(SYSDATE,'dd')+LEVEL,'DD-Mon-YYYY')"DATE" 

      ,TO_CHAR(SYSDATE-TO_CHAR(SYSDATE,'dd')+LEVEL,'fmDay') "WEEK" 

  FROM dual 

 WHERE TO_CHAR(SYSDATE-TO_CHAR(SYSDATE,'dd')+LEVEL,'fmDAY') = UPPER('&DAY') 

       CONNECT BY LEVEL<=TO_CHAR(LAST_DAY(SYSDATE),'dd');

Query to get Workflow Status in Oracle Apps

SELECT TO_CHAR(ias.begin_date,'DD-MON-RR HH24:MI:SS') begin_date

      ,TO_CHAR(ias.end_date,'DD-MON-RR HH24:MI:SS') end_date

  ,ap.display_name||'/'||pa.instance_label activity

  ,ias.activity_status activity_status

  ,ias.activity_result_code result

  ,ias.assigned_user assigned_user

  ,ias.notification_id notification_id

  ,ntf.status status

  ,ias.action

  ,ias.performed_by

  ,ias.due_date

  ,ias.error_name

  ,ias.error_message 

  from apps.wf_item_activity_statuses ias

      ,apps.wf_process_activities pa

  ,apps.wf_activities ac

  ,apps.wf_activities_vl ap

  ,apps.wf_items i

  ,apps.wf_notifications ntf 

 WHERE ias.process_activity = pa.instance_id 

   AND pa.activity_name = ac.name 

   AND pa.activity_item_type = ac.item_type 

   AND pa.process_name = ap.name 

   AND pa.process_item_type = ap.item_type 

   AND pa.process_version = ap.version 

   AND i.item_type = ias.item_type 

   AND i.item_key = ias.item_key 

   AND i.begin_date >= ac.begin_date 

   AND i.begin_date < NVL(ac.end_date, i.begin_date+1) 

   AND ntf.notification_id(+) = ias.notification_id 

   AND language = USERENV('LANG')

   AND ias.item_type = <<XX_ITEM_TYPE>>

   AND ias.item_key = <<XX_ITEM_KEY>> 

Contracts Query in Oracle APPS

 SELECT DISTINCT okh.contract_number

      ,okh.id contract_id

  ,okh.cust_po_number

  ,okl.bi ll_to_site_use_id 

  ,okl.ship_to_site_use_id

  ,okl.dnz_chr_id

  ,ldi.id line_id 

  ,ldi.cle_i d line_detail_id 

  ,lite.part_number service_part

  ,lite.inventory_item_id service_ite m_id

  ,lite.service_level 

  ,mld.part_number scanner_part

  ,mld.inventory_item_id scanner_item_ id

  ,mld.organization_id 

  ,ldi.start_date

  ,ldi.end_date

  ,c.serial_number

  ,c.instance_id

  ,c.inv_organization_id 

  ,hz.party_id

  ,hz.cust_account_id

  ,hcas.party_site_id

  ,hp.party_name

  ,hl.address1

  ,hl.address2 

  ,hl.address3

  ,hl.address4

  ,hl.city

  ,hl.state

  ,hl.county

  ,hl.postal_cod e

  ,hl.country

  ,pmr.service_group

  ,pmr.sr_status

  ,pmr.sr_issue

  ,pmr.problem_categor y

  ,pmr.problem_description 

  ,pmr.operating_system

  ,pmr.status_id

  ,pmr.servi ce_group_id

  ,pmr.urgency_id 

  ,pmr.rule_id

  ,pmr.pm_type

  ,(SELECT cip.party_id 

          FROM csi_i_parties cip 

         WHERE cip.instance_id = c.instance_ id 

           AND cip.relationship_type_code = 'SHIP_TO' 

           AND ROWNUM = 1) ib_party_id 

  FROM okc_k_headers_all_b okh

      ,okc_k_lines_b okl

  ,okc_k_items lni

  ,inf_item_categories_mv lite

  ,okc_k_lines_b ldi

  ,okc_k_items ild

  ,inf_item_categories_mv mld

  ,csi_item_instances c

  ,oksf_pm_rule_headers pmr

  ,okc_k_party_roles_b pr

  ,hz_cust_accounts hz

  ,hz_cust_acct_sites_all hcas

  ,hz_cust_site_uses_all hcsu

  ,hz_parties hp

  ,hz_party_sites hps

  ,hz_locations hl 

 WHERE okh.id = okl.dnz_chr_id 

   AND okh.scs_code = 'SERVICE' 

   AND ldi.lse_id = 9 

   AND okl.lse_id = 1 

   AND okh.sts_code = 'ACTIVE' 

   AND okl.sts_code = 'ACTIVE' 

   AND okl.id = ldi.cle_id 

   AND lni.cle_id = okl.id 

   AND lni.jtot_object1_code = 'OKX_SERVICE' 

   AND lite.inventory_item_id = lni.object1_id1 

   AND ldi.sts_code = 'ACTIVE'

   AND ild.cle_id = ldi.id 

   AND ild.jtot_object1_code = 'OKX_CUSTPROD' 

   AND ild.object1_id1 = TO_CHAR(c.instance_id) 

   AND c.inventory_item_id = mld.inventory_item_id 

   AND pr.dnz_chr_id(+) = okh.id 

   AND hz.party_id(+) = pr.object1_id1 

   AND pr.cle_id IS NULL

   AND pr.rle_code = 'CUSTOMER' 

   AND pr.jtot_object1_code = 'OKX_PARTY' 

   AND okl.ship_to_site_use_id = hcsu.site_use_id 

   AND hcsu.cust_acct_site_id = hcas.cust_acct_site_id 

   AND hcas.cust_account_id = hz.cust_account_id 

   AND hz.party_id = hp.party_id 

   AND hl.location_id = hps.location_id 

   AND hps.party_site_id = hcas.party_site_id 

   AND hp.party_id = hps.party_id 

   AND okh.contract_number = NVL(pmr.contract_number,okh.contract_number)

   AND lite.inventory_item_id = pmr.service_item_id 

   AND NVL(pmr.active_flag,'N') = 'Y' 

   AND NVL (pmr.end_date, SYSDATE + 1) >= SYSDATE 

   AND okh.contract_number = '1234567890'

AP SLA GL Link Query in Oracle Apps

SELECT aia.invoice_id "Invoice Id"

      ,aia.invoice_num "Invoice Number"

  ,aia.invoice_date "Invoice Date"

  ,aia.invoice_amount "Amount"

  ,xal.entered_dr "Entered DR in SLA"

  ,xal.entered_cr "Entered CR in SLA"

  ,xal.accounted_dr "Accounted DR in SLA"

  ,xal.accounted_cr "Accounted CR in SLA"

  ,gjl.entered_dr "Entered DR in GL"

  ,gjl.accounted_dr "Accounted DR in GL"

  ,xal.accounting_class_code "Accounting Class"

  ,gcc.segment1 || '.' || gcc.segment2 || '.' || gcc.segment3 || '.' || gcc.segment4 || '.' || gcc.segment5 || '.' || gcc.segment6 || '.' || gcc.segment7 "Code Combination"

  ,aia.invoice_currency_code "Inv Curr Code"

  ,aia.payment_currency_code "Pay Curr Code"

  ,aia.gl_date "GL Date",xah.period_name "Period",aia.payment_method_code "Payment Method",aia.vendor_id "Vendor Id",aps.vendor_name "Vendor Name",xah.je_category_name "JE Category Name" 

  FROM apps.ap_invoices_all aia

      ,xla.xla_transaction_entities xte

  ,apps.xla_events xev

  ,apps.xla_ae_headers xah

  ,apps.xla_ae_lines xal

  ,apps.gl_import_references gir

  ,apps.gl_je_headers gjh

  ,apps.gl_je_lines gjl

  ,apps.gl_code_combinations gcc

  ,apps.ap_suppliers aps

  ,(SELECT aid1.invoice_id 

          ,pa.project_id

  ,NVL (pa.segment1, 'NO PROJECT') project 

      FROM apps.ap_invoice_distributions_all aid1

      ,apps.pa_projects_all pa 

WHERE aid1.ROWID IN (SELECT MAX (ROWID) 

                        FROM apps.ap_invoice_distributions_all aid2 

   WHERE aid1.invoice_id = aid2.invoice_id 

    GROUP BY aid1.invoice_id) 

           AND aid1.project_id = pa.project_id(+)) sql1

      ,(SELECT aid1.invoice_id, pt.task_id

          ,NVL (pt.task_number, 'NO TASK') task 

  FROM apps.ap_invoice_distributions_all aid1

      ,apps.pa_tasks pt 

     WHERE aid1.ROWID IN (SELECT MAX (ROWID) 

                        FROM apps.ap_invoice_distributions_all aid2 

   WHERE aid1.invoice_id = aid2.invoice_id 

   GROUP BY aid1.invoice_id) 

  AND aid1.task_id = pt.task_id(+)) sql2 

 WHERE aia.invoice_id = xte.source_id_int_1 

   AND aia.invoice_id = sql1.invoice_id 

   AND aia.invoice_id = sql2.invoice_id 

   AND xev.entity_id = xte.entity_id 

   AND xah.entity_id = xte.entity_id 

   AND xah.event_id = xev.event_id 

   AND xah.ae_header_id = xal.ae_header_id

   AND xah.je_category_name = 'Purchase Invoices' 

   AND xah.gl_transfer_status_code = 'Y' 

   AND xal.gl_sl_link_id = gir.gl_sl_link_id 

   AND gir.gl_sl_link_table = xal.gl_sl_link_table 

   AND gjl.je_header_id = gjh.je_header_id 

   AND gjh.je_header_id = gir.je_header_id 

   AND gjl.je_header_id = gir.je_header_id 

   AND gir.je_line_num = gjl.je_line_num 

   AND gcc.code_combination_id = xal.code_combination_id 

   AND gcc.code_combination_id = gjl.code_combination_id 

   AND aia.vendor_id = aps.vendor_id 

   AND gjh.status = 'P' 

   AND gjh.actual_flag = 'A' 

   AND gjh.currency_code = 'USD' 

   AND aia.invoice_id = :p_invoice_id;

DBMS_XMLGEN procedure in Oracle

 The dbms_xmlgen procedure can be extremely useful for quick retrieval of Oracle records, formatted for web browser display. With the formatting procedures you can display the output of any query directly to the screen, and you have an easy XML display program. The best part comes with easily formatting Oracle reports. XML Publisher is made to accept XML that looks just like this and form extremely detailed reports using templates made in Microsoft Word. 

With queries such as these and XML Publisher you can have a full reporting suite that easily pulls data, forms it into a PDF, DOC, XLS, or HTML report, and distributes it anywhere you would like it to go.


Generating formatted XML From Oracle

SQL> SELECT EMP_ID, FIRSTNAME, LASTNAME, PHONENUMBER FROM EMP WHERE ROWNUM <= 5


To transform this Oracle output into properly formatted XML.  All we do is change the SQL to embed the requested columns into a call to the dbms_xmlgen.getxml procedure:

set pages 0

set linesize 150

set long 9999999

set head off

SQL> select dbms_xmlgen.getxml('select EMP_ID, FIRSTNAME, LASTNAME, PHONENUMBER from employees where rownum < 6') xml from dual


OUTPUT

=======================

<?xml version="1.0"?>

<ROWSET>

 <ROW>

  <EMP_ID>100</EMP_ID>

  <FIRSTNAME>Steven</FIRSTNAME>

  <LASTNAME>King</LASTNAME>

  <PHONENUMBER>515.123.4567</PHONENUMBER>

 </ROW>

 <ROW>

  <EMP_ID>101</EMP_ID>

  <FIRSTNAME>Neena</FIRSTNAME>

  <LASTNAME>Kochhar</LASTNAME>

  <PHONENUMBER>515.123.4568</PHONENUMBER>

 </ROW>

 <ROW>

  <EMP_ID>102</EMP_ID>

  <FIRSTNAME>Lex</FIRSTNAME>

  <LASTNAME>De Haan</LASTNAME>

  <PHONENUMBER>515.123.4569</PHONENUMBER>

 </ROW>

 <ROW>

  <EMP_ID>103</EMP_ID>

  <FIRSTNAME>Alexander</FIRSTNAME>

  <LASTNAME>Hunold</LASTNAME>

  <PHONENUMBER>590.423.4567</PHONENUMBER>

 </ROW>

 <ROW>

  <EMP_ID>104</EMP_ID>

  <FIRSTNAME>Bruce</FIRSTNAME>

  <LASTNAME>Ernst</LASTNAME>

  <PHONENUMBER>590.423.4568</PHONENUMBER>

 </ROW>

</ROWSET>

XML can be easily integrated into any application, with ROWSET and ROW tags in place to identify nodes, and tags for each column you pulled out of the database. 


read DBMS_XMLGEN

Wednesday, June 16, 2021

Query to get Legal Entity, Operating Unit, Inventory Org details in Oracle Apps

 SELECT xep.name legal_entity_name

      ,gl.name  ledger_name

  ,hou.name operating_unit

  ,hou.short_code

  ,hou.organization_id org_id

  ,hou.set_of_books_id

  ,hou.business_group_id

  ,ood.organization_name inventory_organization_name

  ,ood.organization_code inv_organization_code

  ,ood.organization_id   inv_organization_id

  ,ood.chart_of_accounts_id

FROM hr_operating_units hou

    ,org_organization_definitions ood

,gl_ledgers gl

,xle_entity_profiles xep

WHERE hou.organization_id(+) = ood.operating_unit

  AND ood.set_of_books_id = gl.ledger_id

  AND ood.legal_entity = xep.legal_entity_id

ORDER BY hou.organization_id;

Query to get Patch Details in Oracle Apps

 SELECT DISTINCT RPAD(a.bug_number,

11)|| RPAD(e.patch_name,

11)|| RPAD(TRUNC(c.end_date),

12)|| RPAD(b.applied_flag, 4)  bug_applied

FROM apps.ad_bugs a,

     apps.ad_patch_run_bugs b,

     apps.ad_patch_runs c,

     apps.ad_patch_drivers d ,

     apps.ad_applied_patches e

WHERE a.bug_id = b.bug_id 

  AND b.patch_run_id = c.patch_run_id 

  AND c.patch_driver_id = d.patch_driver_id 

  AND d.applied_patch_id = e.applied_patch_id

  AND c.end_date > '01-JAN-21';

ORDER BY 1 DESC;

Query to get Customer Related Information in Oracle Apps R12

 SELECT party.party_id

      ,cust_acct.cust_account_id

  ,party_site.party_site_id

  ,party_site.location_id

  ,cust_acct_site.cust_acct_site_id

  ,cust_site_use.site_use_id

  ,cust_site_use.site_use_code

  ,party.party_name

  ,location.address1

  ,location.address2

  ,location.city

  ,location.state

  ,location.postal_code

  FROM hz_parties party

      ,hz_cust_accounts cust_acct

  ,hz_party_sites party_site

  ,hz_cust_acct_sites_all cust_acct_site

  ,hz_cust_site_uses_all cust_site_use

  ,hz_locations location

 WHERE party.party_id = cust_acct.party_id

   AND party_site.party_id = party.party_id

   AND party_site.party_site_id = cust_acct_site.party_site_id

   AND cust_acct_site.cust_account_id = cust_acct.cust_account_id

   AND cust_site_use.cust_acct_site_id = cust_acct_site.cust_acct_site_id

   AND cust_site_use.site_use_code = 'BILL_TO'

   AND party_site.location_id = location.location_id

   AND cust_acct.account_number = '123456789'

Query to get Supplier Contacts in Oracle Apps R12

 SELECT DISTINCT

asu.party_id

,asu.segment1 vendor_number

,asu.vendor_name 

,hpc.party_name contact_name 

,hpr.primary_phone_country_code 

,hpr.primary_phone_area_code 

,hpr.primary_phone_number 

,assa.vendor_site_code 

,assa.vendor_site_id 

,asco.vendor_contact_id 

,assa.party_site_id

    ,asco.org_party_site_id

FROM apps.hz_relationships hr 

    ,apps.ap_suppliers asu 

,apps.ap_supplier_sites_all assa 

,apps.ap_supplier_contacts asco 

,apps.hz_org_contacts hoc 

,apps.hz_parties hpc 

,apps.hz_parties hpr 

,apps.hz_contact_points hpcp

WHERE hoc.party_relationship_id = hr.relationship_id

  AND hr.subject_id         = asu.party_id

  AND hr.relationship_code  = 'CONTACT'

  AND hr.object_table_name  = 'HZ_PARTIES'

  AND asu.vendor_id         = assa.vendor_id

  AND hr.object_id          = hpc.party_id

  AND hr.party_id           = hpr.party_id

  AND asco.relationship_id  = hoc.party_relationship_id

  AND assa.party_site_id    = asco.org_party_site_id

  AND hpr.party_type        ='PARTY_RELATIONSHIP'

  AND hpr.party_id          = hpcp.owner_table_id

  AND hpcp.owner_table_name = 'HZ_PARTIES'

  AND assa.vendor_site_id   = asco.vendor_site_id

  AND asu.vendor_name       = 'XX_VENDOR_NAME'

Commonly asked D2K Interview Questions

  • Which triggers are created when Master-Detail Relationship?
    • Master Delete Property
      • NON-ISOLATED (by default)
        1. On Check Delete Master
        2. On Clear Details
        3. On Populate Details
      •  ISOLATED
        1. On Clear Details
        2. On Populate Details
      • CASCADE
        1. Pre-Delete
        2. On Clear Details
        3. On Populate Details
  • What are the System variables can be set by users?
    • SYSTEM.MESSAGE_LEVEL
    • SYSTEM.DATE_THRESHOLD
    • SYSTEM.EFFECTIVE_DATE
    • SYSTEM.SUPPRESS_WORKING 
  • What is Object Group?
    • An Object Group is a container for a group of objects. 
    • You define an object group when you want package related objects so that you can copy or reference them in another module. 
  • What are referenced objects?
    • Referencing allows you to create objects that inherit their functionality and appearance from other objects. 
    • Referencing an object is similar to copying an object, except that the resulting reference object maintains a link to its source object. 
    • A reference object automatically inherits any changes that have been made to the source object when you open or regenerate the module that contains the reference object. 
  • Can you issue DDL Statement in forms?
    • We can issue DDL statement in Forms by using FORMS_DDL.
    • Any string expression up to 32K. A literal an expression or a variable representing the text of a block of dynamically created PL/SQL code DML statement or a DDL statement.
    • Restrictions:-
      • The statement you pass to FORMS_DDL may not contain bind variable references in the string, but the values of bind variables can be concatenated into the string before passing the result to FORMS_DDL.  
  • What is secure property?
    • Hides characters that the operator types into the text item.  
    • This setting is typically used for  password protection. 
  • What are the types of triggers and how the sequence of firing in text item?
    • Triggers can be classified as Key Triggers, Mouse Triggers ,Navigational Triggers. 
    • Key Triggers:
      • Key Triggers are fired as a result of Key actions.
      • Ex:   
        • Key-next-field
        • Key-up
        • Key-Down, etc
    • Mouse Triggers:
      • Mouse Triggers are fired as a result of the mouse navigation.
      • Ex:
        • When-mouse-button-pressed
        • when-mouse-double-clicked, etc
    • Navigational Triggers:
      • These Triggers are fired as a result of Navigation. 
      • Ex:
        • Post-Text-item
        • Pre-text-item.
    • We also have event triggers like when –new-form-instance and when-new-block-instance.
    • We cannot call restricted procedures like go_to(‘my_block.first_item’) in the Navigational triggers but can use them in the Key-next-item.
    • The Difference between Key-next and Post-Text is an very important question. 
    • The key-next is fired as a result of the key action while the post text  is fired as a result of the mouse movement. 
    • Key next will not fire unless there is a key event.
    • The sequence of firing in a text item are as follows:
      • pre-text
      • when new item 
      • key-next
      • when validate 
      • post text
  • What are Property Classes?
    • Property class inheritance is a powerful feature that allows you to quickly define objects that conform to your own interface and functionality standards. 
    • Property classes also allow you to make global changes to applications quickly.  
    • By simply changing the definition of a property class, you can change the definition of all objects that inherit properties from that class.
    • Property Classes have all type of triggers.
  • If you have property class attached to an Item and you have same trigger written for the item. Which will fire first?
    • If item level trigger fires, property level trigger won't fire. 
    • Triggers at the lowest level are always given the first preference. 
    • The item level trigger fires first and then the block and then the Form level trigger.
  • What are Record Groups? Can record groups create at run-time?
    • A record group is an internal Oracle Forms data structure that has a column/row framework similar to a database table.  
    • However, unlike database tables, record groups are separate objects that belong to the form module in which they are defined.  
    • A record group can have an unlimited number of columns of type CHAR, LONG, NUMBER, or DATE provided that the total number of columns does not exceed 64K.  
    • Record group column names cannot exceed 30 characters. 
    • Programmatically Record Groups can be used whenever the functionality offered by a two-dimensional array of multiple data types is desirable. 
  • Types of Record groups?
    • Query Record Group: 
      • A query record group is a record group that has an associated SELECT statement.
      • The columns in a query record group derive their default names, data types, and lengths from the database  columns referenced in the SELECT statement.  
      • The records in a query record group are the rows retrieved by the query associated with that record group. 
    • Non-query Record Group:
      • A non-query record group is a group that does not have an associated query, but whose structure and values can be modified programmatically at runtime.
    • Static Record Group:
      • A static record group is not associated with a query; rather, you define its structure and row values at design time, and they remain fixed at runtime.
  • What are ALERT? 
    • An Alert is a modal window that displays a message notifying operator of some application condition.
  • What is mouse navigate property of button?
    • When Mouse Navigate is True (the default), Oracle Forms performs standard navigation to move the focus to the item when the operator activates the item with the mouse.  
    • When Mouse Navigate is set to False, Oracle Forms does not perform navigation (and the resulting validation) to move to the item when an operator activates the item with the mouse. 
  • What is FORMS_MDI_WINDOW?
    • Forms run inside the MDI application window. This property is useful for calling a form from another one.
  • When When-Timer-Expired does not fire?
    •  The When-Timer-Expired trigger can not fire during trigger, navigation, or transaction processing.
  • Can object group have a block?
    • Yes , object group can have block as well as program units.
  

Tuesday, June 15, 2021

Query to view all Form Personalizations in Oracle Apps

 SELECT fp.application_id

       ,fp.application_short_name

   ,fpt.application_name

   ,ff.form_name

   ,fft.user_form_name

   ,fft.description

   ,fff.function_name

   ,ffft.user_function_name

   ,ffft.description

   ,ffcr.function_name

   ,ffcr.description

   ,ffcr.trigger_event

   ,ffcr.trigger_object

   ,ffcr.condition

   ,ffcr.sequence

   ,ffcr.enabled

   ,frt.responsibility_name

   ,frt.description

   ,fu.user_id

   ,fu.user_name

   FROM fnd_application fp

       ,fnd_application_tl fpt

       ,fnd_form ff

       ,fnd_form_tl fft

       ,fnd_form_functions fff

       ,fnd_form_functions_tl ffft

       ,fnd_form_custom_rules ffcr

       ,fnd_form_custom_scopes ffcs

       ,fnd_responsibility_tl frt

       ,fnd_user fu

       ,fnd_form_custom_actions ffca

       ,fnd_form_custom_prop_list ffcpl

 WHERE fp.application_id = fpt.application_id

   AND fpt.application_id = ff.application_id

   AND ff.form_id = fft.form_id

   AND ff.form_id = fff.form_id 

   AND fff.function_id = ffft.function_id

   AND ff.form_name = ffcr.form_name

   AND ffcr.function_name = fff.function_name

   AND ffcr.id = ffcs.rule_id

   AND ffcs.created_by = fu.user_id

   and ffcr.last_updated_by = fu.user_id

   and ff.last_updated_by = fu.user_id

Query to get the Request Groups & Request Sets in Oracle Apps

 SELECT *

  FROM (SELECT frg.request_group_name

, (CASE

WHEN (NVL (frg.created_by, 0) > 99) THEN 'Y'

ELSE 'N'

END) custom_request_group

, (SELECT user_name

  FROM fnd_user

WHERE user_id = frg.created_by) req_group_owner

, fcpt.user_concurrent_program_name

, fcpt.concurrent_program_name

, (SELECT application_name

  FROM fnd_application_vl

WHERE application_id = fcpt.application_id) program_appl_name

, (SELECT application_short_name

  FROM fnd_application_vl

WHERE application_id = fcpt.application_id) program_appl_short_name

, (SELECT user_name

  FROM fnd_user

WHERE user_id = fcpt.created_by) program_created_by

, (CASE

WHEN (NVL (fcpt.created_by, 0) > 99) THEN 'Y'

ELSE 'N'

END)

custom_program_unit

FROM fnd_request_groups frg

,fnd_request_group_units frgu

,fnd_concurrent_programs_vl fcpt

WHERE frgu.request_group_id = frg.request_group_id

  AND fcpt.concurrent_program_id = frgu.request_unit_id

  AND NVL (fcpt.enabled_flag, 'Y') = 'Y')

 WHERE custom_program_unit = 'Y'

UNION

SELECT *

  FROM (SELECT frg.request_group_name

, (CASE

WHEN (NVL (frg.created_by, 0) > 99) THEN 'Y'

ELSE 'N'

END) custom_request_group

, (SELECT user_name

  FROM fnd_user

WHERE user_id = frg.created_by) req_group_owner

, fcpt.user_request_set_name

, fcpt.request_set_name

, (SELECT application_name

  FROM fnd_application_vl

WHERE application_id = fcpt.application_id) req_set_appl_name

, (SELECT application_short_name

  FROM fnd_application_vl

WHERE application_id = fcpt.application_id) req_set_appl_short_name

, (SELECT user_name

  FROM fnd_user

WHERE user_id = fcpt.created_by)

req_set_created_by

, (CASE

WHEN (NVL (fcpt.created_by, 0) > 99) THEN 'Y'

ELSE 'N'

END)

custom_request_set

FROM fnd_request_groups frg

,fnd_request_group_units frgu

,fnd_request_sets_vl fcpt

WHERE frgu.request_group_id = frg.request_group_id

  AND fcpt.request_set_id = frgu.request_unit_id

  AND NVL (fcpt.end_date_active, SYSDATE) >= SYSDATE)

 WHERE custom_request_set = 'Y'

ORDER BY 1

,2

,3

,4;


Sample code to create Project Deliverable Action in Oracle Apps

 DECLARE

   l_action           pa_project_pub.action_out_tbl_type;

   l_return_status    VARCHAR2 (100);

   l_return_status1   VARCHAR2 (100);

   l_msg_count        NUMBER;

   l_msg_data         VARCHAR2 (2000);

   l_msg_data1        VARCHAR2 (2000);

   l_msg_index_out    NUMBER;

BEGIN

   pa_interface_utils_pub.set_global_info

      (p_api_version_number      => 1.0

      ,p_responsibility_id       => 12345 --Replace p_responsibility_id with valid projects responsilbility

      ,p_user_id                 => 12345 --Replace p_user_id with valid user_id having the above responsilbility

      ,p_msg_count               => l_msg_count

      ,p_msg_data                => l_msg_data

      ,p_return_status           => l_return_status

      );

   

dbms_output.put_line ('l_return_status' || l_return_status);

   

pa_project_pub.create_deliverable_action

      (p_api_version              => '1.0'

      ,p_init_msg_list            => 'F'

      ,p_debug_mode               => 'N'

      ,p_commit                   => 'F'

      ,p_action_name              => 'Invoice/Revenue Action'

      ,p_action_owner_id          => 12345 --Replace p_action_owner_id

      ,p_function_code            => 'BILLING'

      ,p_event_type               => 'Product'

      ,p_event_number             => 1

      ,p_description              => '-- Pass Description Here --'

      ,p_pm_source_code           => 'ABC'

      ,p_pm_action_reference      => '12345' --Replace Element Number from PA_PROJ_ELEMENT

      ,p_currency                 => 'USD'

      ,p_deliverable_id           => 12345 --Replace 

      ,p_organization_id          => 12345 --Replace 

      ,p_project_id               => 12345 --Replace 

      ,p_invoice_amount           => 55555 --Replace 

      ,p_revenue_amount           => 55555 --Replace 

      ,x_action_out               => l_action 

      ,x_return_status            => l_return_status1

      ,p_pm_event_reference       => 'ABC-XYZ-123' --Replace

      ,x_msg_count                => l_msg_count

      ,x_msg_data                 => l_msg_data1

      );

      

   dbms_output.put_line (   'Status :'

                         || l_return_status1

                         || '    Message   : '

                         || l_msg_data1);

                         

IF l_msg_count >= 1 THEN

FOR i IN 1..l_msg_count 

LOOP

pa_interface_utils_pub.get_messages(

p_msg_data => l_msg_data

   ,p_encoded  => 'F'

   ,p_data => l_msg_data

   ,p_msg_count => l_msg_count

   ,p_msg_index => l_msg_count

   ,p_msg_index_out => l_msg_index_out

   );

dbms_output.put_line('Error Message :' || l_msg_data|| ' Status '     || l_return_status1);

END LOOP;           

ROLLBACK;

END IF;           

EXCEPTION

   WHEN OTHERS THEN

      dbms_output.put_line ('Error occured in Main Exception. Error Message: ' || SQLERRM);

END;


  

Query to get E-Biz Tax Details in Oracle Apps

 SELECT xep.name entity_name

      ,ledger.name                  ledger

  ,hou.name                     operating_unit

  ,zxr.tax_regime_code          tax_regime_code

  ,zxr.tax                      tax_code

  ,zxr.inclusive_tax_flag       inclusive_tax_flag

  ,zxr.tax_status_code          tax_status_code

  ,zxr.tax_rate_code            tax_rate_code

  ,zxr.tax_jurisdiction_code    tax_jurisdiction_code

  ,zxr.rate_type_code           rate_type_code

  ,zxr.percentage_rate          percentage_rate

  ,zxr.effective_from           rate_effective_from

  ,zxr.effective_to             rate_effective_to   

  ,account.tax_account_ccid     tax_account_ccid

  ,gcc.concatenated_segments    tax_account

  FROM zx_rates_vl    zxr

      ,zx_accounts         account

  ,hr_operating_units  hou

  ,gl_ledgers          ledger

  ,gl_code_combinations_kfv  gcc

  ,xle_entity_profiles xep

 WHERE account.tax_account_entity_code = 'RATES'

   AND zxr.active_flag = 'Y'

   AND TRUNC (SYSDATE) BETWEEN TRUNC (zxr.effective_from) AND NVL (TRUNC (zxr.effective_to), TRUNC (SYSDATE) + 1)

   AND ledger.ledger_id = hou.set_of_books_id

   AND gcc.code_combination_id = account.tax_account_ccid

   AND hou.organization_id = account.internal_organization_id

   AND account.tax_account_entity_id = zxr.tax_rate_id

   and hou.default_legal_context_id = xep.legal_entity_id

   --AND zxr.tax_regime_code = 'TAX_REGIME_CODE'

   --AND zxr.tax_rate_code = 'TAX_RATE_CODE'

Profile Options Specific to Operating Units in Oracle Apps

  • Profile Options, AR: Receipt Batch Source and AR: Transaction Batch Source, reference data that is secured by operating unit. You must set these profile options at the responsibility level. You should choose a value corresponding to the operating unit of the responsibility.


  •  The following profile options need to be set for each responsibility for each operating unit where applicable:
    • HR: Business Group
    • HR: User Type
      • The HR: User Type profile option limits field access on windows shared between Oracle Human Resources and other applications. If you do not use Oracle Payroll, it must be to HR User for all responsibilities that use tables from Oracle Human Resources. For example, responsibilities used to define employees and organizations.

    • GL: Set of Books Name
      • Oracle General Ledger forms use the GL: Set of Books profile option to determine your current set of books. 
      • If you have different sets of books for your operating units, you should set the GL: Set of Books profile option for each responsibility that uses Oracle General Ledger forms.
    • OM: Item Validation Organization
    • INV: Inter company Currency Conversion
    • Tax: Allow Override of Tax Code
    • Tax: Invoice Freight as Revenue
    • Tax: Inventory Item for Freight
    • Sequential Numbering

The Advantages of Moving to Multi-Org in Oracle Apps

  • Product Integration
  • Global Enterprise Management and Visibility
  • Cross-Organization Features
  • Multiple Sets of Accounting Books 
  • Application Administration 
  • Reduction in support and maintenance costs 
  • Data Security 
  • Inventory Organization Security by Responsibility 
  • Reporting  

Few R12 Inventory Interview Questions in Oracle Apps

  1. What is Master Item? 
  2. What is Onhand quantity and Available quantity?
  3. What is Move Orders? 
  4. What are the Inventory Organizations, Name few Sub-Inventories?
  5. What is KFF? Name few KFF's.
  6. Tell some of the base tables in Inventory Module? 
  7. In which column item will be stored?
  8. What is the Primary key in MTL_SYSTEM_ITEMS_B table?
  9. In which table we an find out Master Organizations?
  10. In which table we can find out Sub-inventories?
  11. In which column we can find out Item category name?
  12. What is ABC analysis and ATP date? 
  13. What are the Item Transactions we have?
  14. What are the reports you have developed or Customized in Inventory Module?
  15. What is min-max planning?

Query to get Element Advance Salary in Oracle Apps

 SELECT prrv.result_value

      ,paa.assignment_id

  ,paaf.assignment_id

  ,papf.employee_number

 FROM pay_run_results prr1

     ,pay_element_types_f petf

,pay_run_result_values prrv

,pay_input_values_f piv

,pay_assignment_actions paa

,pay_payroll_actions ppa

,per_all_assignments_f paaf

,per_all_people_f papf

WHERE prr1.element_type_id = petf.element_type_id

  AND prr1.run_result_id = prrv.run_result_id

  AND prrv.input_value_id = piv.input_value_id

  AND prr1.assignment_action_id = paa.assignment_action_id

  AND paaf.assignment_id = paa.assignment_id

  and paaf.person_id = papf.person_id

  AND element_name = 'Advance Salary'

  AND piv.name = 'Pay Value'

  AND ppa.payroll_action_id = paa.payroll_action_id                         

  AND ppa.action_type IN ('Q', 'R')

  AND SYSDATE BETWEEN piv.effective_start_date AND  piv.effective_end_date

  AND SYSDATE BETWEEN petf.effective_start_date AND  petf.effective_end_date

  AND SYSDATE BETWEEN paaf.effective_start_date AND  paaf.effective_end_date

  AND SYSDATE BETWEEN papf.effective_start_date AND papf.effective_end_date

  and prrv.result_value > '0'

  AND ppa.effective_date='31-DEC-2020'

Saturday, June 12, 2021

Oracle Process Manufacturing General API GMP_CALENDAR_API

  • Public level package used for fetching data from the OPM Shop Calendar. 
  • These APIs are used by OPM Process Execution


Oracle Process Manufacturing Resources API GMP_RSRC_AVL_PKG

  • Public level package used for resource availability calculations.
  • Oracle Process Manufacturing Resources API GMP_RESOURCE_DTL_PUB

    • Public level package used for creating, updating, and deleting plant resources in OPM.

    Oracle Process Manufacturing Resources API GMP_RESOURCES_PUB

    • Public level package used for creating, updating, and deleting generic resources in OPM.

    Oracle Process Manufacturing Status API GMD_STATUS_PUB

    • Public API that modifies the status for routings, recipes, operations, and validity rules

    Oracle Process Manufacturing Activities API GMD_ACTIVITY_PUB

    • Public Activity package that the user defined function calls. 
    • The business API is used for creating, modifying, or deleting activity information.

    Oracle Process Manufacturing Operation Resources GMD_OPERATION_RESOURCES_PUB

    • Public Operation Resources package that the wrapper or user defined function calls. 
    • The business API is used for creating, modifying, or deleting operation resources.

    Oracle Process Manufacturing Operation Activities GMD_OPERATION_ACTIVITIES_PUB

    • Public Operation Activities package that the wrapper or user defined function calls. 
    • The business API is used for creating, modifying, or deleting operation activities. 
    • When creating an operation activity, the API also creates operation resources associated with this operation activity.

    Oracle Process Manufacturing Operations GMD_OPERATIONS_PUB

    • Public Operation package that the user defined function calls. 
    • The business API is used for creating, modifying, or deleting a operation header. 
    • When creating an operation header, the API also creates activities and resources associated with this header.

    Oracle Process Manufacturing Dependency GMD_STEP_DEPENDENCY_PUB

    • Public Routing package that the user defined function calls. 
    • The business API is used for creating or modifying routing step dependency information associated to the routing steps.

    Oracle Process Manufacturing Routing Steps GMD_ROUTING_STEPS_PUB

    • Public Routing package that the user defined function calls. 
    • The business API is used for creating or modifying routing steps associated to the routing header

    Oracle Process Manufacturing Routings GMD_ROUTINGS_PUB

    • Public Routing package that the user defined function calls. The business API is used for creating, modifying, or deleting a routing header.

    Oracle Process Manufacturing Recipe GMD_FETCH_VALIDITY_RULES

    • Public Recipe API that Recipe Header and Recipe Detail APIs call.

    Oracle Process Manufacturing Recipe GMD_RECIPE_FETCH_PUB

    • Public Recipe API that Recipe Header and Recipe Detail APIs call.

    Oracle Process Manufacturing Recipe GMD_RECIPE_DETAIL

    • Public Recipe API that the user defined function calls.

    Oracle Process Manufacturing Recipe GMD_RECIPE_HEADER

    • Public Recipe API that the user defined function calls.

    Oracle Process Manufacturing API GMD_FORMULA_EFFECTIVITY_PUB

    • Public Formula 
    • Effectivity package that the wrapper or user defined function calls. 
    • The business API can be used for Creating, Modifying, or deleting a formula effectivity.

    Oracle Process Manufacturing API GMD_FORMULA_DETAIL_PUB

    • Public Formula 
    • Detail package that the wrapper or user defined function calls.
    • The business API can be used for creating, modifying, or deleting a formula detail.

    Oracle Process Manufacturing API GMD_FORMULA_PUB

    • Public Formula
    • Header package that the user defined function calls. 
    • The business API can be used for creating, modifying, or deleting a formula header. 
    • While creating a Formula header the API also creates Detail and Effectivity associated with this header.

    Thursday, June 10, 2021

    API to Create Element & Retro Components

    • Below are the sequence of steps to create Element and its Retro Components

      1. API to Create Element Type & Parent Element
      2. API to Create Element Type for Retro & Child Element
      3. API to Create Retro Component Usage
      4. API to Create Element Span Usages


    • API to Create Element Type & Parent Element

    DECLARE

       l_classification_id                 NUMBER := NULL;

       l_event_group_id                NUMBER := NULL;

       l_formula_id                        NUMBER := NULL;

       l_element_name                  VARCHAR2 (500) := 'Misc Allowance';

       l_element_type_id               NUMBER := NULL;

       l_effective_start_date          DATE := NULL;

       l_effective_end_date            DATE := NULL;

       l_object_version_number         NUMBER := NULL;

       l_comment_id                        NUMBER := NULL;

       l_processing_priority_warning   BOOLEAN := NULL;

    BEGIN

       SELECT classification_id

         INTO l_classification_id

         FROM pay_element_classifications

        WHERE UPPER (classification_name) = 'EARNINGS'

              AND legislation_code = 'US';


       SELECT event_group_id

         INTO l_event_group_id

         FROM pay_event_groups

        WHERE UPPER (event_group_name) = 'ENTRY CHANGES';


       SELECT formula_id

         INTO l_formula_id

         FROM ff_formulas_f

        WHERE formula_name = 'US_ONCE_EACH_PERIOD';


       pay_element_types_api.

        create_element_type (

          p_validate                       => FALSE,

          p_effective_date                 => TO_DATE ('01-JAN-2020', 'DD-MON-YYYY'),

          p_classification_id              => l_classification_id,

          p_element_name                   => l_element_name,

          p_input_currency_code            => 'USD',

          p_output_currency_code           => 'USD',

          p_multiple_entries_allowed_fla   => 'N',

          p_processing_type                => 'N' ,

        --N -> Non Recurring

         --R -> Recurring                               

          p_business_group_id              => 101,

          p_legislation_code               => NULL,

          p_formula_id                     => l_formula_id,

          p_reporting_name                 => l_element_name,

          p_description                    => l_element_name,

          p_recalc_event_group_id          => l_event_group_id,

          p_element_type_id                => l_element_type_id,

          p_effective_start_date           => l_effective_start_date,

          p_effective_end_date             => l_effective_end_date,

          p_object_version_number          => l_object_version_number,

          p_comment_id                     => l_comment_id,

          p_processing_priority_warning    => l_processing_priority_warning

        );

       COMMIT;

       DBMS_OUTPUT.put_line (l_element_type_id || ' has been created Successfully !!!');

    EXCEPTION

       WHEN OTHERS

       THEN

          DBMS_OUTPUT.put_line ('Main Exception: ' || SQLERRM);

    END;


    • API to Create Element Type for Retro & Child Element


    DECLARE

       l_classification_id             NUMBER := NULL;

       l_event_group_id                NUMBER := NULL;

       l_formula_id                    NUMBER := NULL;

       l_element_name                  VARCHAR2 (500) := 'Misc Allowance Retro';

       l_element_type_id               NUMBER := NULL;

       l_effective_start_date          DATE := NULL;

       l_effective_end_date            DATE := NULL;

       l_object_version_number         NUMBER := NULL;

       l_comment_id                    NUMBER := NULL;

       l_processing_priority_warning   BOOLEAN := NULL;

    BEGIN

       SELECT classification_id

         INTO l_classification_id

         FROM pay_element_classifications

        WHERE UPPER (classification_name) = 'EARNINGS'

              AND legislation_code = 'US';



       SELECT formula_id

         INTO l_formula_id

         FROM ff_formulas_f

        WHERE formula_name = 'US_ONCE_EACH_PERIOD';


       pay_element_types_api.

        create_element_type (

          p_validate                       => FALSE,

          p_effective_date                 => TO_DATE ('01-JAN-2020', 'DD-MON-YYYY'),

          p_classification_id              => l_classification_id,

          p_element_name                   => l_element_name,

          p_input_currency_code            => 'USD',

          p_output_currency_code           => 'USD',

          p_multiple_entries_allowed_fla   => 'N',

          p_processing_type                => 'N' ,

            --N -> Non Recurring 

            --R -> Recurring                                          

          p_business_group_id              => 101,

          p_legislation_code               => NULL,

          p_formula_id                     => l_formula_id,

          p_reporting_name                 => l_element_name,

          p_description                    => l_element_name,

          p_recalc_event_group_id          => l_event_group_id,

          p_element_type_id                => l_element_type_id,

          p_effective_start_date           => l_effective_start_date,

          p_effective_end_date             => l_effective_end_date,

          p_object_version_number          => l_object_version_number,

          p_comment_id                     => l_comment_id,

          p_processing_priority_warning    => l_processing_priority_warning);

       COMMIT;

       DBMS_OUTPUT.put_line (l_element_type_id || ' has been created Successfully !!!');

    EXCEPTION

       WHEN OTHERS

       THEN

          DBMS_OUTPUT.put_line ('Main Exception: ' || SQLERRM);

    END;


    • API to Create Retro Component Usage

    DECLARE

       l_retro_component_id         NUMBER := NULL;

       l_element_type_id            NUMBER := NULL;

       l_reprocess_type             VARCHAR2 (50) := NULL;

       l_retro_component_usage_id   NUMBER := NULL;

       l_object_version_number      NUMBER := NULL;

    BEGIN

       SELECT retro_component_id

         INTO l_retro_component_id

         FROM pay_retro_components

        WHERE UPPER (short_name) = 'STANDARD';


       SELECT element_type_id

         INTO l_element_type_id

         FROM pay_element_types_f

        WHERE UPPER (element_name) = 'MISC ALLOWANCE';


       SELECT hl.lookup_code

         INTO l_reprocess_type

         FROM hr_lookups hl

        WHERE hl.lookup_type = 'RETRO_REPROCESS_TYPE'

              AND UPPER (hl.meaning) = 'REPROCESS';


       PAY_RCU_INS.

        ins (p_effective_date             => TO_DATE ('01-JAN-2020', 'DD-MON-YYYY'),

             p_retro_component_id         => l_retro_component_id,

             p_creator_id                 => l_element_type_id,

             p_creator_type               => 'ET',

             p_default_component          => 'Y',

             p_reprocess_type             => l_reprocess_type,

             p_business_group_id          => 101,

             p_retro_component_usage_id   => l_retro_component_usage_id,

             p_object_version_number      => l_object_version_number,

             p_replace_run_flag           => 'N',

             p_use_override_dates         => 'N'

            );

       COMMIT;

       DBMS_OUTPUT.put_line (

          l_retro_component_usage_id || ' has been created Successfully !!!');

    EXCEPTION

       WHEN OTHERS

       THEN

          DBMS_OUTPUT.put_line ('Main Exception: ' || SQLERRM);

    END;


    • API to Create Element Span Usages


    DECLARE

       l_time_span_id               NUMBER := NULL;

       l_retro_component_usage_id   NUMBER := NULL;

       l_retro_element_type_id      NUMBER := NULL;

       l_element_span_usage_id      NUMBER := NULL;

       l_object_version_number      NUMBER := NULL;

    BEGIN

       SELECT time_span_id

         INTO l_time_span_id

         FROM pay_time_spans

        WHERE CREATOR_ID = 1;


       SELECT prcu.retro_component_usage_id

         INTO l_retro_component_usage_id

         FROM pay_retro_component_usages prcu, pay_element_types_f petf

        WHERE petf.element_type_id = prcu.creator_id

              AND UPPER (petf.element_name) = 'MISC ALLOWANCE';


       SELECT petf.element_type_id

         INTO l_retro_element_type_id

         FROM pay_element_types_f petf

        WHERE UPPER (petf.element_name) = 'MISC ALLOWANCE RETRO';


       PAY_ESU_INS.

        ins (p_effective_date             => TO_DATE ('01-JAN-2020', 'DD-MON-YYYY'),

             p_time_span_id               => l_time_span_id,

             p_retro_component_usage_id   => l_retro_component_usage_id,

             p_retro_element_type_id      => l_retro_element_type_id,

             p_business_group_id          => 101,

             p_element_span_usage_id      => l_element_span_usage_id,

             p_object_version_number      => l_object_version_number);

       COMMIT;

       DBMS_OUTPUT.put_line (

          l_retro_component_usage_id || ' has been created Successfully !!!');

    EXCEPTION

       WHEN OTHERS

       THEN

          DBMS_OUTPUT.put_line ('Main Exception: ' || SQLERRM);

    END;


    APEX$TASK_PK

      APEX$TASK_PK is a substitution string holding the primary key value of the system of records