Thursday, 19 November 2015

Enable Debug Profile Options

Set values as below:

FND: Debug: YES
FND: DEBUG LEVEL: STATEMENT
INV: DEBUG TRACE YES
INV: DEBUG Level: 102
INV: Debug File = /tmp/invdbg_AA.db
MRP: Debug Mode: Yes

This debug setting is helpful when something is going wrong during a concurrent program.
Run the standard program or API.

Check the log.

Disabling a BOM Routing and then Adding same routing again.

Pass the values to API like this:

Update Mode --
 p_operation_rec(l_upd_cnt).Assembly_Item_Name :='ECJ1VC1H050C';
 p_operation_rec(l_upd_cnt).Organization_Code := 'GLO';
 p_operation_rec(l_upd_cnt).Operation_Sequence_Number :=100;
 p_operation_rec(l_upd_cnt).Operation_Type := 1;
 p_operation_rec(l_upd_cnt).Start_Effective_Date := '09-Nov-2015'; --Existing old effective date
 p_operation_rec(l_upd_cnt).disable_date := TO_DATE('9-Nov-2015, 23:59:59','DD-MON-YYYY, HH24:MI:SS');
 p_operation_rec(l_upd_cnt).Standard_Operation_Code := '10';
 p_operation_rec(l_upd_cnt).Transaction_Type := 'UPDATE';
 While creating the same routing -CREATE mode
 p_operation_rec(l_upd_cnt).Assembly_Item_Name := 'ECJ1VC1H050C';
 p_operation_rec(l_upd_cnt).Organization_Code := 'GLO';
 p_operation_rec(l_upd_cnt).Operation_Sequence_Number :=100;
 p_operation_rec(l_upd_cnt).Operation_Type := 1;
 p_operation_rec(l_upd_cnt).Start_Effective_Date := TO_DATE('10-Nov-2015, 00:00:00','DD-MON-YYYY, HH24:MI:SS');
 p_operation_rec(l_upd_cnt).disable_date := NULL;
 p_operation_rec(l_upd_cnt).Standard_Operation_Code := '10';
 p_operation_rec(l_upd_cnt).Transaction_Type := 'CREATE';

x_rtg_header_rec := bom_rtg_pub.g_miss_rtg_header_rec;
      x_rtg_revision_tbl.DELETE;
      x_operation_tbl.DELETE;
      x_op_resource_tbl.DELETE;
      x_sub_resource_tbl.DELETE;
      x_op_network_tbl.DELETE;
      error_handler.initialize;
      xx_mas_print_log_p ( 'Pass in API' );
      bom_rtg_pub.process_rtg (
        p_bo_identifier         => 'RTG'
      , p_api_version_number    => '1.0'
      , p_init_msg_list         => TRUE
      , p_rtg_header_rec        => l_rtg_header_rec
      , p_operation_tbl         => p_operation_rec
      , p_op_resource_tbl       => l_op_resource_tbl
      , p_sub_resource_tbl      => l_sub_resource_tbl
      , p_op_network_tbl        => l_op_network_tbl
      , x_rtg_header_rec        => x_rtg_header_rec
      , x_rtg_revision_tbl      => x_rtg_revision_tbl
      , x_operation_tbl         => x_operation_tbl
      , x_op_resource_tbl       => x_op_resource_tbl
      , x_sub_resource_tbl      => x_sub_resource_tbl
      , x_op_network_tbl        => x_op_network_tbl
      , x_return_status         => l_return_status
      , x_msg_count             => l_msg_count
      );
      COMMIT;
      xx_mas_print_log_p ( 'BOM_RTG_PUB.PROCESS_RTG' );
      xx_mas_print_log_p ('Return Status for ' || ' = ' || l_return_status );
      xx_mas_print_log_p ('Message Count for ' || ' = ' || l_msg_count );
      error_handler.get_message_list ( l_error_message_list );
      IF l_return_status <> 'S' THEN
        -- Error Processing
        l_err_message := NULL;
        l_err_message_type := NULL;
        FOR k IN 1 .. l_msg_count
        LOOP
          IF l_err_message IS NULL THEN
            l_err_message := SUBSTR (
                              l_error_message_list ( k ).MESSAGE_TEXT
                            , 1
                            , 250
                            );
            xx_mas_print_log_p ('Error in API - l_err_message1:' || l_err_message );
          ELSE
            l_err_message :=
                 l_err_message || '-' || SUBSTR (
                                          l_error_message_list ( k ).MESSAGE_TEXT
                                        , 1
                                        , 250
                                        );
            xx_mas_print_log_p ('Error in API - l_err_message1:' || l_err_message );
          END IF;
          IF l_err_message_type IS NULL THEN
            l_err_message_type := l_error_message_list ( k ).MESSAGE_TYPE;
          ELSE
            l_err_message_type :=
                               l_err_message_type || '-' || l_error_message_list ( k ).MESSAGE_TYPE;
          END IF;
        END LOOP;
END IF;

REGEXP_INSTR

How to use REGEXP_INSTR.
REGEXP_INSTR is used to get multiple values positions in a string.

For Example:
let say we need to find the position of (-) and (*) in single string.

SELECT REGEXP_INSTR (
                   'ABC-CDE&'
                 , '(-|&)'
                 )
          FROM   DUAL;

This will return you 4.

Thursday, 2 April 2015

Steps for compiling a form on UNIX

Steps for compiling a form on UNIX


1. Login into UNIX server

2. Set the environment for the respective instance
a.             Command for setting environment
b.            For ABC instance -> . /evnabc/erpapp/appl/APPSORA.env

3. PLL files are stored in the ‘Resource’ folder under AU TOP.

        a.    PLLs are in this folder -> /evnabc/erpapp/appl/au/12.0.0/resource
        b.    Forms are in folder -> /evnabc/erpapp/appl/au/12.0.0/forms/US

4. Command to compile the form -> frmcmp_batch module=<path with form name.fmb> userid=username/password output_file=<path with form name.fmx> Module_Type=FORM compile_all=Yes

        a. User name would be either APPS or the respective top name

If a form needs to be compiled on the local system then the short cut key is Ctrl+Shift+K and for generating fmx is Ctrl+T in Form Builder (10g).

Query to check business event fire status

Below query can be used to check Business events trigger status in oracle from database:


SELECT COUNT(1),
       a.msg_state, 
       a.user_data.event_name, 
       a.user_data.send_date
FROM applsys.aq$wf_deferred a
WHERE a.user_data.event_name LIKE 'oracle.apps.ont.oi.xml_int.status' --Business event name
AND a.user_data.send_date > SYSDATE - 1
GROUP BY a.msg_state, a.user_data.event_name, a.user_data.send_date
ORDER BY 1, 2 ;

Result:
Event Key passed: 1686010

Saturday, 28 March 2015

Item Outbound Sample Code

Below is the sample code for Item Outbound:

CREATE OR REPLACE PROCEDURE EE_INV_ITEM_PROC(
                                    ERRBUF OUT VARCHAR2,
                                    RETCODE OUT VARCHAR2,
                                    P_LOC IN VARCHAR2,
                                    P_FILE_NAME IN VARCHAR2
                                   ) 
IS
CURSOR CUR_INV IS
                 SELECT OOD.ORGANIZATION_NAME,
                        OOD.ORGANIZATION_ID ORID,
                        MSI.SEGMENT1 ITEM_NAME,
                        MIL.CONCATENATED_SEGMENTS ITM_LOC
                  FROM  ORG_ORGANIZATION_DEFINITIONS OOD,
                        MTL_SYSTEM_ITEMS_B MSI,
                        MTL_ITEM_LOCATIONS_KFV MIL                     
                 WHERE  MSI.ORGANIZATION_ID=OOD.ORGANIZATION_ID
                   AND  MIL.ORGANIZATION_ID=MSI.ORGANIZATION_ID
                   AND  TRUNC(MSI.CREATION_DATE)=TRUNC(SYSDATE);
V_FILE_TYPE UTL_FILE.FILE_TYPE;
BEGIN
V_FILE_TYPE:=UTL_FILE.FOPEN(LOCATION  =>P_LOC,
                            FILENAME  =>P_FILE_NAME,
                            OPEN_MODE => 'W');
FOR V_REC IN CUR_INV
LOOP
UTL_FILE.PUT_LINE(V_FILE_TYPE,V_REC.ORGANIZATION_NAME||'~'||
                              V_REC.ORID||'~'||
                              V_REC.ITEM_NAME||'~'||
                              V_REC.ITM_LOC);
END LOOP;
UTL_FILE.FCLOSE(V_FILE_TYPE);
EXCEPTION
WHEN UTL_FILE.invalid_operation THEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'FILE HACVING INVALID OPERATION');
WHEN UTL_FILE.invalid_filename  THEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'INVALID FILE NAME'||P_FILE_NAME);
WHEN OTHERS THEN
FND_FILE.PUT_LINE(FND_FILE.LOG,SQLERRM);
END;                                                                        


Hope this will help.    

Wednesday, 18 March 2015

Workflow scripts for Different Errors


Below are the helpful queries beginners can use to find out errors in oracle workflows:-


1) SELECT COUNT (*)
,item_type
,activity_name
,MIN (item_begin_date)
,MAX (item_begin_date)
FROM wf_item_activity_statuses_v
WHERE activity_status_code = 'ERROR'
AND item_end_date IS NULL
GROUP BY item_type
,activity_name
ORDER BY 3 DESC, 1 DESC, 2;


2) SELECT item_type
,parent_item_type
,DECODE (end_date, NULL, 'OPEN', 'CLOSED')
error_type_status
,COUNT (*)
FROM wf_items
WHERE parent_item_type is not null
AND item_type in ('CUNNLWF','DOSFLOW','DOSFLOWE',
'ECXERROR','HRSSA','HRSTAND','HXCEMP','IBUHPSUB','OKLAMERR',
'OMERROR','PARMAAP','PARMATRX','POERROR','WFSTD','XDPWFSTD',
'ZPBWFERR', 'WFERROR')
GROUP BY item_type
,parent_item_type
,DECODE (end_date, NULL, 'OPEN', 'CLOSED')
ORDER BY item_type,parent_item_type;

3) SELECT COUNT (*)
,v.text_value
,min(i.begin_date)
,max(i.begin_date)
FROM wf_item_attribute_values v
,wf_items i
WHERE v.item_key=i.item_key
AND v.item_type = i.item_type
AND v.item_type = 'WFERROR'
AND v.NAME = 'EVENT_NAME'
AND v.text_value IS NOT NULL
GROUP BY text_value
ORDER BY text_value;

Useful fusion query for User access

  Table FUN_USER_ROLE_DATA_ASGNMNTS is used for “Manage data access for users”. it will store use and role assignment to data security. Tabl...