Saturday, February 11, 2017

Oracle CPQ - Debug Configuration rule which is using Commerce transaction data

Oracle Metalink has created a very good note on how to use commerce transaction data in Configuration rules.

How To Query Transaction Data from Commerce Into a Configuration Rule (Doc ID 1660743.1)

But it has one important not-so-highlighted point which can be very useful for debugging purpose in Configuration rule. If you want to debug such kind of rule, you can specify your transaction id in context parameters key/value pair as below and it will set this transaction in context for your bmql query.
bsId=3489815

Some snippet from above metalink note:
To test the code in the debugger, get a transaction ID from an existing quote first. Then in the debuggers Context Parameters:field, enter the following key=value pair:
bsId = (your transactionID)


Example query code from metalink note. Here quote_process is a commerce process variable name.


ret = "";

records = bmql("select quoteNumber_quote, quoteDescription_quote from commerce.quote_process");

print records;

for record in records {
     ret = ret + get (record, "quoteDescription_quote") + " " + get(record, "quoteNumber_quote") + "|^|";
}

records = bmql("select _group_sequence_number from commerce.line_process");

for record in records {
     print "_group_sequence_number: " + get(record, "_group_sequence_number");
}

return ret;

Thursday, December 8, 2016

Restart EBS instance if everything is down

Start EBS Instance
Manually restart server if nothing is working like SSH, DB etc

Check if database listener is up or not
> lsnrctl status

Start listener if required using following
> lsnrctl start <DBID>
Connect to database using sysdb
> sqlplus / as sysdba
> startup

stop all services from $ADMIN_SCRIPTS_HOME
> adstpall.sh
start all services from $ADMIN_SCRIPTS_HOME
> adstrtall.sh


Wednesday, July 6, 2016

JRAD doc queries

Very useful which can help you find lot of issues related to missing intl txt or publication issue or identify corrupted ui template

--Debug the missing intl_text_id, find it in attribute values
select * from JDR_ATTRIBUTES where att_value like '%8581175%';

--use above component id to get document name
select jdr_mds_internal.getdocumentname(95614) from dual;

--use this to find the template element causing issue by checking sequence id
select * from jdr_components where comp_docid in (95614);

--use above jdr document name to find the content template
select * from cz_ui_templates where jrad_doc='/oracle/apps/cz/runtime/oa/webui/templates/regions/6448_162';

--check which page is referring this template
select * from cz_ui_page_elements where ctrl_template_id=6448;


select * from cz_localized_texts where localized_str like '%';

select * from cz_ui_defs where ui_Def_id in (62791);

select * from cz_ui_templates where ui_Def_id in (62791);

select * from fnd_new_messages where message_text like '%Message Text Here%';

Saturday, June 18, 2016

Why Target instance name is not shown in Publication LOV?

Many times, in CZGOLD instance environment, it is observed that cloned CZGOLD instance will not show cloned target instance while creating publication. Configurator uses below query to check if the remote instance should be visible in Publication LOV or not. You can check data based on this and correct as required.

In simple words, in cloned target instance's cz_servers table, if any server is having source_server_flag as 1, then that server's name in target must match with CZ instance's LOCAL server name. If there are multiple records with source_server_flag as 1, then it might create issue as well.

SELECT local_name, server_local_id
  FROM cz_servers
 WHERE server_local_id >= 0
   AND cz_model_migration_pvt.target_open_for ('P', fndnam_link_name, local_name)='1'


FUNCTION target_open_for (
   p_migration_or_publishing   IN   VARCHAR2,
   p_link_name                 IN   VARCHAR2,
   p_local_name                IN   VARCHAR2
)  RETURN VARCHAR2
IS
   target_open            VARCHAR2 (1)    := '1';
   target_not_open        VARCHAR2 (1)    := '0';
   l_source_server_flag           VARCHAR2 (1);
   l_source_server_flag_for_pub   VARCHAR2 (1);
   l_sql_str              VARCHAR2 (2000);
   l_sql_str_for_pub      VARCHAR2 (2000);
   target_instance_for_pub VARCHAR2(2000);
   local_instance_name VARCHAR2(2000);

BEGIN

   IF (p_migration_or_publishing = MODE_PUBLICATION) THEN
       IF (p_local_name='LOCAL') THEN
         RETURN target_open;
       END IF;
   END IF;

   IF p_link_name IS NULL THEN
      RETURN target_not_open;
   END IF;

   l_sql_str :=
         'SELECT NVL(source_server_flag,''0''), local_name FROM cz_servers@' || p_link_name || ' ' ||
         'WHERE source_server_flag = ''1'' ';

   EXECUTE IMMEDIATE l_sql_str
                INTO l_source_server_flag, target_instance_for_pub;


   IF (p_migration_or_publishing = MODE_PUBLICATION) THEN

      SELECT instance_name
       INTO local_instance_name
      FROM cz_servers
       WHERE local_name = 'LOCAL';

       IF (local_instance_name=target_instance_for_pub) THEN
         RETURN target_open;
       END IF;
   END IF;

   RETURN target_not_open;

EXCEPTION
   WHEN NO_DATA_FOUND THEN
      RETURN target_open;
   WHEN OTHERS THEN
      RETURN target_not_open;
END;