Friday, January 31, 2020

Procedure to Create CCID (Code Combination ID) using API in oracle apps


I have used below script to create CCID (Code Combination ID) in General Ledger.

Procedure:

CREATE OR REPLACE PROCEDURE APPS.CREATE_CCID_PRC(
    p_seg1 VARCHAR2,
    p_seg2 VARCHAR2,
    p_seg3 VARCHAR2,
    p_seg4 VARCHAR2,
    p_seg5 VARCHAR2,
    p_seg6 VARCHAR2,
    p_seg7 VARCHAR2,
    p_ccid_out OUT NUMBER,
    p_err_out OUT VARCHAR2 )
IS
  l_code_combination_id NUMBER;
  l_boolean             BOOLEAN;
  l_segment_array apps.fnd_flex_ext.segmentarray;
  x_ccid      VARCHAR2(100);
  ln_org_id   NUMBER;
  l_error     VARCHAR2(4000):=NULL;
  l_exception EXCEPTION;
  ln_structure_num NUMBER;
BEGIN
  ln_org_id := 0;
  ln_structure_num := 0;
  -- Get Org ID
    BEGIN
      SELECT organization_id
      INTO ln_org_id
      FROM hr_operating_units
      WHERE name    = 'ABC Operating Unit'
      AND (date_to IS NULL OR date_to    > SYSDATE);
    EXCEPTION
    WHEN OTHERS THEN
      fnd_file.put_line('Error in Operating Unit:'||SQLERRM);
    END;
  --
  -- Get ID Flex Number
    BEGIN
      SELECT id_flex_num
      INTO ln_structure_num
      FROM apps.fnd_id_flex_structures
      WHERE id_flex_code        = 'GL#'
      AND id_flex_structure_code='CUMMINS_ACCOUNTING_FLEXFIELD'
              AND enabled_flag = 'Y'
              GROUP BY id_flex_num;
    EXCEPTION
      WHEN others THEN
              fnd_file.put_line('Error in Flex number:'||SQLERRM);
    END;
  --
  apps.fnd_global.apps_initialize(user_id => fnd_profile.VALUE('USER_ID'), 
                                  resp_id => fnd_profile.VALUE('RESP_ID'), 
                                  resp_appl_id => fnd_profile.VALUE('RESP_APPL_ID') );
  mo_global.set_policy_context('S',ln_org_id);
  --
  l_segment_array(1) := p_seg1;
  l_segment_array(2) := p_seg2;
  l_segment_array(3) := p_seg3;
  l_segment_array(4) := p_seg4;
  l_segment_array(5) := p_seg5;
  l_segment_array(6) := p_seg6;
  l_segment_array(7) := p_seg7;
  --
  l_boolean := apps.fnd_flex_ext.get_combination_id
                       (     application_short_name => 'SQLGL'
                           , key_flex_code         => 'GL#'
                           , structure_number  => ln_structure_num
                           , validation_date      => SYSDATE
                           , n_segments             => 7
                           , segments                 => l_segment_array
                           , combination_id      => l_code_combination_id 
                        );
  x_ccid    := l_code_combination_id;
  fnd_file.put_line(fnd_file.LOG,'l_code_combination_id: '||l_code_combination_id||fnd_flex_ext.get_message);

  p_err_out := fnd_flex_ext.get_message;
  p_ccid_out:= (l_code_combination_id);

EXCEPTION
  WHEN OTHERS THEN
    l_error:= ('Error:-'||sqlerrm);
    fnd_file.put_line(fnd_file.LOG,l_error);
END;
/
--------------------------------------------

Once procedure created then text it using below PLSQL block:

SET SERVEROUTPUT ON;
DECLARE
  l_err VARCHAR2(4000);
  l_ccid NUMBER;
BEGIN 
    apps.create_ccid_prc(
    p_seg1 => '453',
    p_seg2 => '453',
    p_seg3 => '4530000',
    p_seg4 => '00905003',
    p_seg5 => '000',
    p_seg6 => '00000',
    p_seg7 => '0000',
    p_ccid_out => l_ccid,
    p_err_out => l_err
    );
            --
  dbms_output.put_line(l_ccid);
  dbms_output.put_line(l_err); 
EXCEPTION WHEN OTHERS THEN 
  dbms_output.put_line('Error is: '||sqlerrm);  
END;
/


Run Concurrent Program in Custom Schema using FND_REQUEST.SUBMIT_REQUEST


I had a requirement to submit a AutoInvoice Master(related to AR Invoice) program using fnd_request.submit_request via back-end in custom schema.
For this we need to involves granting the specific user permissions to run a concurrent request. And also need to create Public synonyms.

Firstly give grants and try to execute fnd_request.submit_request via backed, if not succeed then create public synonyms.

Must run the following Grants for custom schema in APPS, once all granting and creating a synonyms done then try to use "fnd_request.submit_request" via custom schema.

1) GRANTS

GRANT ALL ON fnd_user to CUSTOM_USER_NAME;
GRANT ALL ON fnd_core_log to CUSTOM_USER_NAME;
GRANT ALL ON fnd_client_info to CUSTOM_USER_NAME;
GRANT ALL ON hr_signon to CUSTOM_USER_NAME;
GRANT ALL ON jg_context to CUSTOM_USER_NAME;
GRANT ALL ON fnd_global to CUSTOM_USER_NAME;
GRANT ALL ON fnd_profile to CUSTOM_USER_NAME;
GRANT ALL ON fnd_message to CUSTOM_USER_NAME;
GRANT ALL ON app_exception to CUSTOM_USER_NAME;
GRANT ALL ON fnd_log to CUSTOM_USER_NAME;
GRANT ALL ON fnd_request to CUSTOM_USER_NAME;
GRANT ALL ON fnd_concurrent_programs_vl to CUSTOM_USER_NAME;
GRANT ALL ON fnd_responsibility_vl to CUSTOM_USER_NAME;
GRANT ALL ON fnd_log_repository to CUSTOM_USER_NAME;
GRANT ALL ON fnd_application_vl to CUSTOM_USER_NAME;
GRANT ALL ON fnd_languages to CUSTOM_USER_NAME;
GRANT ALL ON fnd_application to CUSTOM_USER_NAME;
GRANT ALL ON fnd_lookup_types to CUSTOM_USER_NAME;
GRANT ALL ON fnd_product_groups to CUSTOM_USER_NAME;
GRANT ALL ON fnd_profile_options_vl to CUSTOM_USER_NAME;
GRANT ALL ON fnd_new_messages to CUSTOM_USER_NAME;
GRANT ALL ON fnd_data_group_units to CUSTOM_USER_NAME;
GRANT ALL ON fnd_oracle_userid to CUSTOM_USER_NAME;
GRANT ALL ON fnd_product_groups to CUSTOM_USER_NAME;
GRANT ALL ON fnd_product_initialization to CUSTOM_USER_NAME;
GRANT ALL ON fnd_product_init_condition to CUSTOM_USER_NAME;
GRANT ALL ON fnd_product_init_dependency to CUSTOM_USER_NAME;
GRANT ALL ON fnd_product_installations to CUSTOM_USER_NAME;
GRANT ALL ON fnd_profile_options to CUSTOM_USER_NAME;
GRANT ALL ON fnd_profile_option_values to CUSTOM_USER_NAME;
GRANT ALL ON fnd_security_groups_vl to CUSTOM_USER_NAME;
GRANT ALL ON fnd_user_resp_groups to CUSTOM_USER_NAME;
GRANT ALL ON icx_parameters to CUSTOM_USER_NAME;
GRANT ALL ON fnd_cache_versions to CUSTOM_USER_NAME;
GRANT ALL ON fnd_log_messages to CUSTOM_USER_NAME;
GRANT ALL ON fnd_printer to CUSTOM_USER_NAME;
GRANT ALL ON fnd_conc_date to CUSTOM_USER_NAME;
GRANT ALL ON fnd_printer_styles to CUSTOM_USER_NAME;
GRANT ALL ON fnd_printer_information to CUSTOM_USER_NAME;
GRANT ALL ON fnd_conc_release_classes_s to CUSTOM_USER_NAME;
GRANT ALL ON fnd_conc_request_arguments to CUSTOM_USER_NAME;
GRANT ALL ON fnd_concurrent_requests_s to CUSTOM_USER_NAME;
GRANT ALL ON fnd_conc_deferred_arguments to CUSTOM_USER_NAME;
GRANT ALL ON fnd_concurrent_programs to CUSTOM_USER_NAME;
GRANT ALL ON fnd_logins to CUSTOM_USER_NAME;
GRANT ALL ON fnd_conc_release_classes to CUSTOM_USER_NAME;
GRANT ALL ON fnd_conc_release_class_utils to CUSTOM_USER_NAME;
GRANT ALL ON fnd_concurrent_requests to CUSTOM_USER_NAME;
GRANT ALL ON fnd_print to CUSTOM_USER_NAME;
GRANT ALL ON fnd_conc_pp_actions to CUSTOM_USER_NAME;
GRANT ALL ON fnd_data_groups to CUSTOM_USER_NAME;
GRANT ALL ON fnd_responsibility to CUSTOM_USER_NAME;
GRANT ALL ON fnd_logins_s to CUSTOM_USER_NAME;
GRANT ALL ON fndcp_crm to CUSTOM_USER_NAME;
GRANT ALL ON fnd_conc_pp to CUSTOM_USER_NAME;
GRANT ALL ON fnd_conc_release_classes_tl to CUSTOM_USER_NAME;
GRANT ALL ON fnd_rt_request to CUSTOM_USER_NAME;
GRANT ALL ON fnd_request_set_programs to CUSTOM_USER_NAME;
GRANT ALL ON fnd_rt_requests to CUSTOM_USER_NAME;
GRANT ALL ON nls_session_parameters to CUSTOM_USER_NAME;
GRANT ALL ON fnd_dflex to CUSTOM_USER_NAME;
GRANT ALL ON fnd_conflicts_domain to CUSTOM_USER_NAME;
GRANT ALL ON fnd_conflicts_domain_s to CUSTOM_USER_NAME;
GRANT ALL ON fnd_conc_pp_actions to CUSTOM_USER_NAME;
GRANT ALL ON fnd_application_tl to CUSTOM_USER_NAME;
GRANT ALL ON fnd_executables to CUSTOM_USER_NAME;
GRANT ALL ON fnd_descriptive_flexs_vl to CUSTOM_USER_NAME;
GRANT ALL ON fnd_descr_flex_contexts_vl to CUSTOM_USER_NAME;
GRANT ALL ON fnd_conc_global to CUSTOM_USER_NAME;

2) Create Synonyms:

CREATE PUBLIC SYNONYM fnd_user        FOR fnd_user;
CREATE PUBLIC SYNONYM fnd_core_log    FOR fnd_core_log;
CREATE PUBLIC SYNONYM fnd_client_info FOR fnd_client_info;
CREATE PUBLIC SYNONYM hr_signon       FOR hr_signon;
CREATE PUBLIC SYNONYM jg_context      FOR jg_context;
CREATE PUBLIC SYNONYM fnd_global      FOR fnd_global;
CREATE PUBLIC SYNONYM fnd_profile     FOR fnd_profile;
CREATE PUBLIC SYNONYM fnd_message     FOR fnd_message;
CREATE PUBLIC SYNONYM app_exception   FOR app_exception;
CREATE PUBLIC SYNONYM fnd_log         FOR fnd_log;
CREATE PUBLIC SYNONYM fnd_request     FOR fnd_request;
CREATE PUBLIC SYNONYM fnd_concurrent_programs_vl FOR fnd_concurrent_programs_vl;
CREATE PUBLIC SYNONYM fnd_responsibility_vl FOR fnd_responsibility_vl;
CREATE PUBLIC SYNONYM fnd_log_repository FOR fnd_log_repository;
CREATE PUBLIC SYNONYM fnd_application_vl FOR fnd_application_vl;
CREATE PUBLIC SYNONYM fnd_languages      FOR fnd_languages;
CREATE PUBLIC SYNONYM fnd_application    FOR fnd_application;
CREATE PUBLIC SYNONYM fnd_lookup_types   FOR fnd_lookup_types;
CREATE PUBLIC SYNONYM fnd_product_groups FOR fnd_product_groups;
CREATE PUBLIC SYNONYM fnd_profile_options_vl FOR fnd_profile_options_vl;
CREATE PUBLIC SYNONYM fnd_new_messages     FOR fnd_new_messages;
CREATE PUBLIC SYNONYM fnd_data_group_units FOR fnd_data_group_units;
CREATE PUBLIC SYNONYM fnd_oracle_userid    FOR fnd_oracle_userid;
CREATE PUBLIC SYNONYM fnd_product_groups   FOR fnd_product_groups;
CREATE PUBLIC SYNONYM fnd_product_initialization FOR fnd_product_initialization;
CREATE PUBLIC SYNONYM fnd_product_init_condition FOR fnd_product_init_condition;
CREATE PUBLIC SYNONYM fnd_product_init_dependency FOR fnd_product_init_dependency;
CREATE PUBLIC SYNONYM fnd_product_installations FOR fnd_product_installations;
CREATE PUBLIC SYNONYM fnd_profile_option_values FOR fnd_profile_option_values;
CREATE PUBLIC SYNONYM fnd_security_groups_vl FOR fnd_security_groups_vl;
CREATE PUBLIC SYNONYM fnd_profile_options    FOR fnd_profile_options;
CREATE PUBLIC SYNONYM fnd_user_resp_groups   FOR fnd_user_resp_groups;
CREATE PUBLIC SYNONYM icx_parameters     FOR icx_parameters;
CREATE PUBLIC SYNONYM fnd_cache_versions FOR fnd_cache_versions;
CREATE PUBLIC SYNONYM fnd_log_messages   FOR fnd_log_messages;
CREATE PUBLIC SYNONYM fnd_printer        FOR fnd_printer;
CREATE PUBLIC SYNONYM fnd_conc_date      FOR fnd_conc_date;
CREATE PUBLIC SYNONYM fnd_printer_styles FOR fnd_printer_styles;
CREATE PUBLIC SYNONYM fnd_printer_information      FOR fnd_printer_information;
CREATE PUBLIC SYNONYM fnd_conc_release_classes_s   FOR fnd_conc_release_classes_s;
CREATE PUBLIC SYNONYM fnd_conc_request_arguments   FOR fnd_conc_request_arguments;
CREATE PUBLIC SYNONYM fnd_concurrent_requests_s    FOR fnd_concurrent_requests_s;
CREATE PUBLIC SYNONYM fnd_conc_deferred_arguments  FOR fnd_conc_deferred_arguments;
CREATE PUBLIC SYNONYM fnd_concurrent_programs      FOR fnd_concurrent_programs;
CREATE PUBLIC SYNONYM fnd_logins                   FOR fnd_logins;
CREATE PUBLIC SYNONYM fnd_conc_release_classes     FOR fnd_conc_release_classes;
CREATE PUBLIC SYNONYM fnd_conc_release_class_utils FOR fnd_conc_release_class_utils;
CREATE PUBLIC SYNONYM fnd_concurrent_requests FOR fnd_concurrent_requests;
CREATE PUBLIC SYNONYM fnd_print FOR fnd_print;
CREATE PUBLIC SYNONYM fnd_conc_pp_actions FOR fnd_conc_pp_actions;
CREATE PUBLIC SYNONYM fnd_data_groups     FOR fnd_data_groups;
CREATE PUBLIC SYNONYM fnd_responsibility  FOR fnd_responsibility;
CREATE PUBLIC SYNONYM fnd_logins_s FOR fnd_logins_s;
CREATE PUBLIC SYNONYM fndcp_crm    FOR fndcp_crm;
CREATE PUBLIC SYNONYM fnd_conc_pp  FOR fnd_conc_pp;
CREATE PUBLIC SYNONYM fnd_conc_release_classes_tl FOR fnd_conc_release_classes_tl;
CREATE PUBLIC SYNONYM fnd_rt_request FOR fnd_rt_request;
CREATE PUBLIC SYNONYM fnd_request_set_programs FOR fnd_request_set_programs;
CREATE PUBLIC SYNONYM fnd_rt_requests FOR fnd_rt_requests;
CREATE PUBLIC SYNONYM nls_session_parameters FOR nls_session_parameters;
CREATE PUBLIC SYNONYM fnd_dflex FOR fnd_dflex;
CREATE PUBLIC SYNONYM fnd_conflicts_domain       FOR fnd_conflicts_domain;
CREATE PUBLIC SYNONYM fnd_conflicts_domain_s     FOR fnd_conflicts_domain_s;
CREATE PUBLIC SYNONYM fnd_conc_pp_actions        FOR fnd_conc_pp_actions;
CREATE PUBLIC SYNONYM fnd_application_tl         FOR fnd_application_tl;
CREATE PUBLIC SYNONYM fnd_executables            FOR fnd_executables;
CREATE PUBLIC SYNONYM fnd_descriptive_flexs_vl   FOR fnd_descriptive_flexs_vl;
CREATE PUBLIC SYNONYM fnd_descr_flex_contexts_vl FOR fnd_descr_flex_contexts_vl;
CREATE PUBLIC SYNONYM fnd_conc_global FOR fnd_conc_global;

Steps to get ZPL code output using Zebra viewer - Online

Introduction ZPL is a print language used by many label printers. A print language is a set of commands that can be used to draw elements li...