Friday, November 11, 2011

Debugging the Pick - Pack -Shipping / OM related debugging

 A To generate a debug file from the Shipping Transaction or Quick Ship forms in version 11.5.9 (Family pack I) or higher:
Set the following profile options:
OM: Debug Level - set to 5
WSH: Debug Enabled - set to Yes
WSH: Debug Level - set to Statement
WSH: Debug Log Directory - any directory that can be written to by the database

To check, run the following SQL statement:
Code:
select value from v$parameter where name = 'utl_file_dir'
Set profile option WSH: Debug Log Directory at the Site & Application Level.
In the Shipping form go to Tools and check the Debug box. This will print out a file name - NOTE down this file name.
Perform the action you wish to debug.
Go to Tools and uncheck Debug.
After you have completed generating the debug file, please set the value of the profile OM: Debug Level back to 0 and WSH: Debug Enabled set to No, otherwise there will be some performance impact. Retrieve the debug file from the directory specified in step 1.

B. To generate debug information for Pick Release in version 11.5.9 (Family pack I) or higher:
Set the following profile options:
OM: Debug Level - set to 5
INV: Debug Level - set to 10
WSH: Debug Enabled - set to Yes
WSH: Debug Level - set to Statement
In the Release Sales Order for Picking form go to Tools and check the Debug box.
Submit the pick release.
Provide the Pick Selection List Generation log file.

C. To generate debug information for Pick Release prior to version 11.5.9 (Family pack I):
Set the following profile options:
OM: Debug Level - set to 5
INV: Debug Level - set to 10
In the Release Sales Order for Picking form go to Tools and check the Debug box.
Submit the pick release.
Provide the Pick Selection List Generation log file.


D. To generate debug information for Interface Trip Stop - SRS in version 11.5.9 (Family pack I) or higher:
Set the following profile options:
OM: Debug Level - set to 5
INV: Debug Level - set to 10
WSH: Debug Enabled - set to Yes
WSH: Debug Level - set to Statement
Set the Debug Level parameter to 1 (Debugging ON) .
Submit the job.
Provide the log file.

E. To generate debug information for Interface Trip Stop - SRS prior to version 11.5.9 (Family pack I):
Set the following profile options:
OM: Debug Level - set to 5
INV: Debug Level - set to 10
Set the Log Level parameter to 1 (Debugging ON) .
Submit the job.
Provide the log file.

F. To generate debug information for an API in 11.5.9 (Family pack I) or higher:
Set the following profile options:
OM: Debug Level - set to 5
INV: Debug Level - set to 10
WSH: Debug Enabled - set to Yes
WSH: Debug Level - set to Statement
WSH: Debug Log Directory - set to a valid writeable directory path
Add the following line of code in the wrapper script which calls the API:
Code:
DECLARE l_file_name VARCHAR2(32767);
l_return_status VARCHAR2(32767);
l_msg_data VARCHAR2(32767);
l_msg_count NUMBER;
BEGIN
fnd_profile.put('WSH_DEBUG_MODULE','%');
fnd_profile.put('WSH_DEBUG_LEVEL',WSH_DEBUG_SV.C_STMT_LEVEL);
wsh_debug_sv.start_debugger(l_file_name,l_return_status,l_msg_data,l_msg_count);
Submit the job.
Provide the log file.

G. To generate debug information for an API prior to version 11.5.9 (Family pack I):
Set the following profile options:
OM: Debug Level - set to 5
INV: Debug Level - set to 10
Add the following lines of code in the wrapper script which calls the API:
Code:
oe_debug_pub.initialize; oe_debug_pub.SetDebugLevel(5);
DBMS_OUTPUT.PUT_LINE('Debug File = ' ||OE_DEBUG_PUB.G_DIR||'/'||OE_DEBUG_PUB.G_FILE);

Friday, July 8, 2011

On Hand Qty Query

SELECT SUM (target_qty), item_id, subinv
FROM (SELECT moqv.subinventory_code subinv
,moqv.inventory_item_id item_id
,SUM (transaction_quantity) target_qty
FROM mtl_onhand_qty_cost_v moqv
WHERE moqv.organization_id = :org_id
AND moqv.inventory_item_id = :item_id
AND moqv.subinventory_code =
NVL (:subinventory_code, moqv.subinventory_code)
GROUP BY moqv.subinventory_code
,moqv.inventory_item_id
,moqv.item_cost
UNION ALL
SELECT mmt.subinventory_code subinv
,mmt.inventory_item_id item_id
,-SUM (primary_quantity) target_qty
FROM mtl_material_transactions mmt, mtl_txn_source_types mtst
WHERE mmt.organization_id = :org_id
AND transaction_date >=
NVL (TO_DATE (:hist_date), TRUNC (SYSDATE))
+ 1
AND mmt.transaction_source_type_id =
mtst.transaction_source_type_id
AND mmt.inventory_item_id = :item_id
AND mmt.subinventory_code =
NVL (:subinventory_code, mmt.subinventory_code)
GROUP BY mmt.subinventory_code, mmt.inventory_item_id) oq
GROUP BY oq.item_id,subinv