Showing posts with label debug. Show all posts
Showing posts with label debug. Show all posts

Saturday, February 18, 2017

Viewing BML print statements in log

While working with complex BML, I have always been wondering if I can see print statements for debugging that we write in BML code in some log file during quote process. Finally, found there is a way to do it and its released in 2016 R1 release.

How to enable?
Admin > General Site Options  > Enable BML Print Logging = Yes

Where to see?
Admin > Error Logs > bm.log

Use it for debugging or performance monitoring purpose. Very useful!

Don't forget to disable logging in production, it affects performance. Conditionalize your print statements using some debug flag variable in BML code.

Happy BMLing!

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;

Monday, February 25, 2013

Debugging Configurator Batch Validation

When you do Book Order in Order Management, it will validate line Configuration using batch validation API. This process causes issues at times and the front end error message simply says like "Configuration validation resulted in errors." without any additional details. As this is background process, it makes debugging difficult.

Here are few important steps to debug Configurator batch validation error:

1) Generate OM debug log for batch validation process. That should reveal some detail about what is happening.

2) Generate sql trace for batch validation process. Useful in certain cases.

3) Check AltBatchValidateUrl parameter from cz_db_settings.

4) Check if above URL is reachable by Database using following script
DECLARE
  config_messages cz_cf_api.CFG_OUTPUT_PIECES ;
  finalURL VARCHAR2(500);
  MESSAGE  VARCHAR2(500);
BEGIN
  dbms_output.put_line('start...');
  finalURL        := 'http://configurator-businessappsLoad.companyname.com:80/configurator/oracle.apps.cz.servlet.UiServlet?test=version';
  config_messages := UTL_HTTP.request_pieces(url => FinalURL);
  dbms_output.put_line('message count = ' || config_messages.COUNT);
  FOR i IN config_messages.FIRST .. config_messages.LAST
  LOOP
    MESSAGE := config_messages(i);
    dbms_output.put_line('Message ' || i || ' : ' || MESSAGE);
  END LOOP;
  dbms_output.put_line('...end');
END;

5) Check if there any additional logs written in Configurator batch validation
select * from cz_db_logs 
where logtime is not null
and loguser = 'batchValidate'
order by logtime desc;

6) Check if you are using model based routing and try disabling it and see if it works.

7) If you are using https url for batch validation, you need check if Wallet setup is done correctly.