Showing posts with label Configuration. Show all posts
Showing posts with label Configuration. Show all posts

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, August 13, 2015

check model bill similarity check in bulk

---------Block to submit BOM SIM and publication concurrent reqst-----------------
DECLARE
  CURSOR BOMSIM_PUBLCTN_CURSOR
  IS
    SELECT pn.name model_name,
      rp.name Description,
      rp.enclosing_folder folder_id,
      pn.devl_project_id model_id
    FROM cz_ps_nodes pn,
      cz_rp_entries rp
    WHERE pn.ps_node_id = rp.object_id
    AND rp.deleted_flag = 0
    AND rp.object_type  = 'PRJ'
    AND rp.name NOT LIKE 'Copy%'
    AND (pn.name        like 'MODEL-%')
    AND pn.deleted_flag = 0
    order by pn.name;
  V_inputdata BOMSIM_PUBLCTN_CURSOR%rowtype;
  ln_request_id NUMBER;
BEGIN
  -- Initialize Apps
  fnd_global.apps_initialize (1848 ,22687 ,708 );
  OPEN BOMSIM_PUBLCTN_CURSOR;
  FETCH BOMSIM_PUBLCTN_CURSOR INTO V_inputdata;
  WHILE BOMSIM_PUBLCTN_CURSOR%FOUND LOOP
    --DBMS_OUTPUT.PUT ('Model name '||V_inputdata.Model_Name);
    --DBMS_OUTPUT.PUT (', Folder '||V_inputdata.Folder_ID);
    --DBMS_OUTPUT.PUT_LINE (', Model ID is '||V_inputdata.Model_ID);
    ln_request_id := fnd_request.submit_request ('CZ' ,--IN VARCHAR2 DEFAULT NULL,                -- application
    'CZBOMSIM',                                        -- IN VARCHAR2 DEFAULT NULL,-- program short name
    '',                                                -- description
    '',                                                -- start time
    FALSE,                                             -- IN BOOLEAN DEFAULT FALSE,                -- sub request
    'PROD',                                         -- IN VARCHAR2 DEFAULT CHR (0),          -- argument1
    V_inputdata.Folder_ID,                                          -- IN VARCHAR2 DEFAULT CHR (0),          -- argument2
    V_inputdata.Model_ID,                                -- IN VARCHAR2 DEFAULT CHR (0),                  -- argument3
    CHR (0)                                            -- represents end of arguments
    );
    COMMIT;
    dbms_output.put_line ('l' ||ln_request_id || '.req' || ',' || V_inputdata.Model_Name || ',' || V_inputdata.Description ||',' ||
      V_inputdata.Folder_ID || ',' ||
      V_inputdata.Model_ID ||',' || ln_request_id );
    IF ln_request_id = 0 THEN
      dbms_output.put_line ('Concurrent request failed to submit');
    END IF;
    FETCH BOMSIM_PUBLCTN_CURSOR into V_inputdata;
  END LOOP;
  END;
  ------------------------------------------------------------------------------------------


Saturday, January 26, 2013

CZ: Understanding Valid and Complete Configuration

This is very common question among Configurator Developers: What is Valid Configurator and What is Complete Configuration? What is the difference between the two?
Order can be booked with only valid and complete configuration.

COMPLETE:
Configuration is said to be complete if all mandatory inputs have been provided. Alternatively, Incomplete is referred as Unsatisfied as well. Configuration can be incomplete/unsatisfied because of node definition (Structure) or because of Rules.
For example, if there is an option feature with min/max as 1/1, then atleast 1 option selection has to made for it. If user did not make any selection, then configuration will remain incomplete. For some features, you can specify if they need user input while creating the feature. Those can make Configuration incomplete if value has not been provided.
Configuration can be incomplete due to rules as well. For example, if there is a rule like
A Implies AnyTrue(B, C)
then if A is selected in Configuration, either B or C must be selected (Configurator Original Engine cannot select any option on its own). If none of B or C is selected, configuration will remain incomplete. The rule will be said as Unsatisfied Rules, and you can chose to display your own message for it in the rule definition.

VALID:
Configurator is said to be valid if none of the rules are violated or none of the Resource is over consumed.
If there is a violation in the configuration, its status will be marked as invalid. If any integer feature has maximum defined value as 100, and if user tries to enter 200, Configurator will accept input but it will make the configuration invalid.
Usually in rule case like BomModel Requires (IntFeature <= 100) will throw immediate violation when IntFeature value entered is more than 100, Configurator does not accept value in such case - Configurator will not prevent user from creating invalid configuration.

Tuesday, March 27, 2012

Start Configuration from Jdeveloper

I have seen everyone working on Configurator Extensions wondering if we can start Configuration session from local machine Jdeveloper. Well, the answer is Yes. You can! I have done it in past.

Follow these steps:
  • Install Jdeveloper.
  • You need is DBC file and put it in local machine directory. Refer DBC file path in your java program in System properties - DBCFILE and JTFDBCFILE.
  • Refer Configurator Extension Guide to create configuration using CIO from Java program.
  • Get all the classes from middletier required by Configurator (fnd classes). You can start with none and as you start getting error, you can create jar for specific packages like oracle.apps.fnd and put it in your jdev. If you want to know class location on server, you can use CZInfo.jsp file. More info on CZInfo.jsp file is here.

Its very useful for debugging purpose, but its very very slow is what I experienced - depending on your model size and how your db responds to your machine. It actually executes plenty of queries (to get model/rule details from database) to create configuration on local machine and load all those classes which makes it very slow.

Using this you can test/debug-step through your Extension code.