Tuesday, 12 July 2016

Create User for Oracle cloud/Fusion

Create first implementation user

Login with administrator user for cloud instance. 


Navigation : Setup and Maintenance
In All Task Tab enter Name as "Create Implementation User"


Save it



Click on Go to Task icon it will open identify Manager - Self Service



Click on Administration link on right hand side upper part


Click on Create User Link



Enter details for field like First Name, Last Name, Email, etc.
Also enter User Login which is username for cloud application and enter Password which we need to change again while login first time to cloud.

Save all details and user got created.

Now click on Roles to assign roles to your user. It is same way we assign responsibilities in R11 and R12 version of EBS.


Click on Assign icon to assign different roles to your user.


Enter Name for roles and search for it.
e.g. In the Display Name field, search on Application Implementation Consultant


Search it and Add it to your user.

In the same way we can assign some of below given roles to user.
OIAdministrators, Human Resource Manager, Employee, Application Implementation Consultant, IT Security Manager, System Administrators, Payables, Receivables etc.




Now sign out from current login and by using new user try to login to cloud application. it will ask to reset password for first time.

In this way we can create user for cloud application (Fusion Application)


Sunday, 19 June 2016

Get On Hand Quantities using API in Oracle Apps

This script can be used to get the below quantities.
1. On-hand Quantity
2. Available to Reserve
3. Quantity Reserved
4. Quantity Suggested
5. Available to Transact
6. Available to Reserve

You can also get the On-hand quantities from the table mtl_onhand_quantities 

Script :

==========================================================
DECLARE
--  
   x_return_status         VARCHAR2 (50);
   x_msg_count             VARCHAR2 (50);
   x_msg_data              VARCHAR2 (50);
   v_item_id               NUMBER;
   v_org_id                NUMBER;
   v_qoh                   NUMBER;
   v_rqoh                  NUMBER;
   v_atr                   NUMBER;
   v_att                   NUMBER;
   v_qr                    NUMBER;
   v_qs                    NUMBER;
   v_lot_control_code      BOOLEAN;
   v_serial_control_code   BOOLEAN;
--
 BEGIN
--
    -- Set the variable values
    v_item_id := '7867';
    v_org_id := 122;
    v_qoh := NULL;
    v_rqoh := NULL;
    v_atr := NULL;
    v_lot_control_code := FALSE;
    v_serial_control_code := FALSE;
--
    -- Set the org context
    fnd_client_info.set_org_context (26);
--
    -- Call API
    inv_quantity_tree_pub.query_quantities
    (p_api_version_number       => 1.0,
     p_init_msg_lst             => 'F',
     x_return_status            => x_return_status,
     x_msg_count                => x_msg_count,
     x_msg_data                 => x_msg_data,
     p_organization_id          => v_org_id,
     p_inventory_item_id        => v_item_id,
     p_tree_mode                => apps.inv_quantity_tree_pub.g_transaction_mode,     
     p_is_revision_control      => FALSE,
     p_is_lot_control           => v_lot_control_code,     
     p_is_serial_control        => v_serial_control_code,
     p_revision                 => NULL,        
     p_lot_number               => NULL,           
     p_lot_expiration_date      => SYSDATE,
     p_subinventory_code        => NULL,    
     p_locator_id               => NULL,     
     p_onhand_source            => 3,
     x_qoh                      => v_qoh,      
     x_rqoh                     => v_rqoh,           
     x_qr                       => v_qr,
     x_qs                       => v_qs,
     x_att                      => v_att,  
     x_atr                      => v_atr    
    );
--

   DBMS_OUTPUT.put_line ('On-Hand Quantity is: ' || v_qoh);
   DBMS_OUTPUT.put_line ('Available to reserve is: ' || v_atr);
   DBMS_OUTPUT.put_line ('Quantity Reserved is: ' || v_qr);
   DBMS_OUTPUT.put_line ('Quantity Suggested is: ' || v_qs);
   DBMS_OUTPUT.put_line ('Available to Transact is: ' || v_att);
   DBMS_OUTPUT.put_line ('Available to Reserve is: ' || v_atr);
--
 EXCEPTION
    WHEN OTHERS
    THEN
       DBMS_OUTPUT.put_line ('ERROR: ' || SQLERRM);
 END;
========================================================================================

Thursday, 2 June 2016

Oracle BULK COLLECT with example

Oracle BULK COLLECT technique enables the PL/SQL engine to collect many rows at once and place them in a collection of array.
A collection is an ordered group of elements, all of the same type. It is a general concept that encompasses lists, arrays, and other familiar datatypes.
Each element has a unique subscript that determines its position in the collection.

BULK COLLECT improves performance of queries that retrieve more than one row.
BULK COLLECT also leave it to the optimizer to speed up "read only" cursor FOR loops.
Use the LIMIT clause to avoid excessive PGA memory consumption.

 e.g. 
SELECT * BULK COLLECT INTO collection(s) FROM table;
FETCH cur BULK COLLECT INTO collection(s);
EXECUTE IMMEDIATE query BULK COLLECT INTO collection(s);

Example :
==========================================================
CREATE OR REPLACE PROCEDURE XXBULKCOLLECTTEST
IS
--
--Declare a nested table of records to hold the queried data.
TYPE EMP_COL_REC IS RECORD
    (
    EMPNO_R EMP.EMPNO%TYPE,
    ENAME_R EMP.ENAME%TYPE,
    JOB_R EMP.JOB%TYPE,
    MGR_R EMP.MGR%TYPE,
    HIREDATE_R EMP.HIREDATE%TYPE,
    COMM_R EMP.COMM%TYPE,
    DEPTNO_R EMP.DEPTNO%TYPE,
    SAL_R EMP.SAL%TYPE
    );
--  
TYPE EMP_INFO IS TABLE OF EMP_COL_REC;
P_EMP_INFO EMP_INFO;
--
BEGIN
--  
    SELECT EMPNO,ENAME,JOB,MGR,HIREDATE,COMM,DEPTNO, SAL
    BULK COLLECT INTO P_EMP_INFO
    FROM EMP
    WHERE DEPTNO=10;
--
  FOR I IN P_EMP_INFO.FIRST .. P_EMP_INFO.LAST
  LOOP
    DBMS_OUTPUT.PUT_LINE('EMPNO '||P_EMP_INFO(I).EMPNO_R||'  '
                         ||'SAL '||P_EMP_INFO(I).SAL_R||'  '
                         ||'ENAME '||P_EMP_INFO(I).ENAME_R||'  '
                         ||'JOB '||P_EMP_INFO(I).JOB_R||'  '
                         ||'MGR '||P_EMP_INFO(I).MGR_R||'  '
                         ||'HIREDATE '||P_EMP_INFO(I).HIREDATE_R||'  ');
  END LOOP;
--
END;
=================================================================
BULK COLLECT WITH LIMIT

SAMPLE SCRIPT:

CREATE OR REPLACE PROCEDURE XXBULKCOLLECTLIMIT
IS
--
CURSOR EMP_CUR
IS
SELECT *  FROM EMP;
--  
TYPE EMP_CUR_TBL IS TABLE OF EMP_CUR%ROWTYPE
INDEX BY PLS_INTEGER;
--
EMP_TBL EMP_CUR_TBL;
--
limit_in PLS_INTEGER:=5;
--
BEGIN
--  
OPEN EMP_CUR;
LOOP
  FETCH EMP_CUR
  BULK COLLECT INTO EMP_TBL LIMIT limit_in;
--
  FOR I IN 1 .. EMP_TBL.COUNT
  LOOP
    DBMS_OUTPUT.PUT_LINE('EMPNO '||EMP_TBL(I).EMPNO||'  '
                         ||'SAL '||EMP_TBL(I).SAL||'  '
                         ||'ENAME '||EMP_TBL(I).ENAME||'  '
                         ||'JOB '||EMP_TBL(I).JOB||'  '
                         ||'MGR '||EMP_TBL(I).MGR||'  '
                         ||'HIREDATE '||EMP_TBL(I).HIREDATE||'  ');
  END LOOP;
--
  EXIT WHEN EMP_TBL.COUNT <= limit_in;
  END LOOP;
  CLOSE EMP_CUR;
--

END;

Tuesday, 19 April 2016

Custom Objects List Query in Oracle apps (CEMLI)

1. Query to get List of Custom Concurrent Programs 

SELECT   DISTINCT fcp.user_concurrent_program_name "Concurrent Program Name",
fa.application_name,
fcp.concurrent_program_name conc_short_name,
decode( fef.execution_method_code, 'H','Host',
'I', 'PLSQL Stored Procedure',
'P', 'Report',
'L', 'SQL Loader',
'Q','SQL*Plus',
'A','Spawned',
'K','Java Concurrent Program',
'B','Request Set Stage Function',
'S','Immediate',
'J','Java Stored Procedure',
'M','Multi-Language Function',
fef.execution_method_code) "execution method",
fef.executable_name,
fcp.description "Concurrent Program Description",
fef.executable_name"Executable Name",
fef.description "Executable Description",
fef.execution_file_name ,
fcp.enabled_flag
,FCP.CREATION_DATE
    FROM fnd_executables_form_v fef,
                fnd_concurrent_programs_VL fcp,
                fnd_application_tl fa
   WHERE fcp.application_id=fef.application_id
   and fa.application_id=fcp.application_id
   AND fef.executable_id=fcp.executable_id
  AND UPPER(fcp.user_concurrent_program_name) like 'XXCUST%'
  ORDER BY 4;


2. Query to get List of Custom Form List

SELECT  DISTINCT forms.form_name,
         formstl.user_form_name,
         func.function_name,
         func.user_function_name,
         fm.menu_name,
         menu.prompt menu_prompt,
         menu.description,
         restl.responsibility_name
        -- FORMSTL.language
  FROM   fnd_form FORMS,
         fnd_form_tl FORMSTL,
         fnd_form_functions_VL FUNC,
         fnd_menu_entries_VL MENU,
         FND_MENUS FM,
         fnd_responsibility RES,
         fnd_responsibility_tl RESTL
 WHERE     1=1
         and forms.form_id = formstl.form_id
         and func.form_id = forms.form_id
         and menu.function_id = func.function_id
         and menu.menu_id=fm.menu_id
         and res.menu_id = menu.menu_id
         and res.responsibility_id = restl.responsibility_id
         and UPPER(forms.form_name) like 'XXCUST%'      
         order by 1;

3) Query to get Custom Table List

select object_name,
 object_type
from all_objects
where 1=1
and object_type='TABLE'
and status='VALID'
and object_name like 'XXCUST%';
4) Query to get Custom View List

select object_name,
 object_type
from all_objects
where 1=1
and object_type='VIEW'
and status='VALID'
and object_name like 'XXCUST%';
5)Query to get Custom plsql List

select object_name,
  object_type
from all_objects
where 1=1
and object_type IN ('FUNCTION','PACKAGE','PROCEDURE')
and status='VALID'
and object_name like 'XXCUST%'
ORDER BY 2; 6) Query to get custom List for Value set.

SELECT FLEX_VALUE_SET_NAME,
DECODE (validation_type,
                 'Y',
                 'Translatable Dependent',
                 'X',
                 'Translatable Independent',
                 'F',
                 'Table',
                 'U',
                 'Special',
                 'D',
                 'Dependent',
                 'I',
                 'Independent',
                 'N',
                 'None',
                 'P',
                 'Pair')
            validation_type,
            DESCRIPTION
FROM FND_FLEX_VALUE_SETS
WHERE FLEX_VALUE_SET_NAME LIKE 'XXCUST%'
ORDER BY 2;

7) Query to get List of Form Personalization

Select Distinct
A.Id,
A.Form_Name ,
A.Enabled,
C.User_Form_Name,
 D.Application_Name ,
A.Description,
Ca.Action_Type,
Ca.Enabled,
Ca.Object_Type,
ca.message_type,
ca.message_text
from FND_FORM_CUSTOM_RULES a,
     FND_FORM b,
     FND_FORM_TL c,
     Fnd_Application_Tl D,
     Fnd_Form_Custom_Actions ca
where a.form_name = b.form_name
And B.Form_Id = C.Form_Id
And B.Application_Id = D.Application_Id
And C.User_Form_Name Like 'XXCUST%'
And A.Enabled ='Y'
and a.id = ca.rule_id;

Monday, 28 March 2016

PTD, QTD, and YTD in Trial balance

Kindly see below given scenario to understand how Trial balance calculated.

YTD: Year to Date

PTD: Period to Date

QTD: Quarter to Date

Opening Balance: This is balance amount which is carry forward from previous month/year.

E.g. for Jan-16 opening balance will be Dec-15 closing balance. For account 12345 Dec-15 closing balance is 1000 then it will be opening balance for Jan-16 trial balance YTD Report.

Opening Balance
1000
Month
Debit
Credit
Total
Jan-16
500
300
200
Feb-16
800
500
300
Mar-16
1200
700
500

When we run trial balance with below given parameter.
1) PTD
Period Type: PTD
Period Name: Mar-16
Trial Balance for account 12345 will be 500

2) QTD
Period Type: QTD
Period Name: Mar-16
QTD Trial Balance for account 12345 will be sum of balances for all month in Mar-16 quarter (i.e. 1st quarter)
Total balance (QTD): Jan-16 + Feb-16 +Mar-16
Total balance (QTD): 200+300+500=1000

3) YTD
Period Type: YTD
Period Name: Mar-16
YTD Trial Balance for account 12345 will be sum of beginning balance with till date balance for the year.
Opening Balance: Jan-16 Opening Balance + Jan-16 TB + Feb-16 TB
Opening Balance: 1000+200+300=1500
Total balance (YTD): Opening Balance + Current Month Balance (Mar-16) PTD
Total balance (YTD): 1500+500=2000


Wednesday, 23 March 2016

Quarterly Trial Balance Report Query (QTD)

Quarterly Trail Balance report used to get TB for particular Quarter. Some of major companies need to publish  there Profit and loss number. For this one can compared it using QTD report.

Quarter may contain 3 or 4(Including Adjacent Period)  periods e.g. Jan-16, Feb-16, Mar-16 & Mar-Adj-16. One can easily get details about period structured from back end by querying GL_PERIODS table.

In this table you will get column like Period Name, Quarter_Num, Period_Year etc. by using this column we can have condition in our query to get detail for Quarter period. Period_set_name also important column in GL_PERIODS table. Functional people defined period set name in GL. e.g. Fiscal, Calendar, or any custom XXCust_Set.

Query to retrieve Quarterly Trial balance:

SELECT gcc.segment3 account,
  gl_flexfields_pkg.get_description_sql(gcc.chart_of_accounts_id,3,gcc.segment3) Acc_Description,
  SUM(NVL(GJL.ACCOUNTED_DR,0))Q_ACC_DR,
  SUM(NVL(GJL.ACCOUNTED_CR,0))Q_ACC_CR,
  SUM(NVL(GJL.ACCOUNTED_DR,0)-NVL(GJL.ACCOUNTED_CR,0))QTD_BALANCE
FROM gl_je_headers gjh,
  gl_je_lines gjl,
  gl_ledgers gl,
  gl_code_combinations_kfv gcc
WHERE gjl.je_header_id     = gjh.je_header_id
AND gjl.code_combination_id=gcc.code_combination_id
AND gjh.ledger_id          =gl.ledger_id
AND gjh.status             ='P'
AND gjh.actual_flag        ='A'                                      ---- 'A' for Actuals
AND gjh.period_name       IN
  (
--Query to retrieve period name for first quarter----
 SELECT Period_name
  FROM gl_periods;
  WHERE period_set_name='XXCust_Set'
  AND quarter_num=1                                          ---- 1 will consider first quarter Jan-Mar
 AND period_year=2016
--
  )
  AND gl.name               = 'US Vision Operation' --Ledger Name
  GROUP BY gcc.segement3,
  gcc.chart_of_accounts_id
order by 1;



Tuesday, 8 March 2016

FSG (Financial Statement Generator) Report setup in Oracle GL (General Ledger) !!!


Oracle General Ledger’s Financial Statement Generator (FSG) is a powerful and flexible financial report building tool you can use to build your own custom financial reports without programming. 

There are two required components in defining a report: Row set and Column set.



Step 1 : To define Row set column:
Navigation : GL -> Reports-> Define-> Row Set



Add each line header in line item field. Indent field used to space from left side. you also can set Line to skip before and after to bifurcate each line heading. we can use Underline character as '-' or '=' or '*' to design layout. All property like line to skip , Underline character and page break used before and after we can set for our current line item.


To show balance for current line item you need to assign account code combination for this particular account. e.g. Income Line item comes under account code 710102 which is 6th segment as per my current setup for code combination in GL Accounting Flexfield.


You can set n number of line header for one FSG report



We can perform Addition and deletion operation on summary of group of line item. For this we need to click on Calculation Button instead of Account assignment button.



Here we use '+' sum operator to sum group of line item to show total sale in FSG report.we can add n number of line item 


Step 2 : Define Column Set
Navigation : GL -> Report-> Define -> Column Set
Enter Name and description and then click on Define Columns button.


Position column is important in column set. it will decide position of current column name and its value in report. you need to imagine report layout and accordingly specify position field value. 
e.g. if you started with position 50 for first column then you need to mention 70 in position field of very next column so it will appear after 20 space in report layout.
Amount Type column also important in column set this have value like YTD-Actual, PTD- Actual, QTD-Actual, YTD- Budget etc. This field will decide amount shown in this column against each line item will show YTD balance or QTD balance. 


You define 20 column in FSG report. it will permit you to define more than 20 column in column set of FSG but report will not show header of column name in report output. 


Step 3 Build Column Set: Once done with column set click on Build column set Button. below screenshot showing note ' This column set has more than 20 column. you can view first 20 column in column set builder.

Below screenshot showing how to build column set. in this you can edit name or width and left margin field as per your report requirement. This is last step of FSG setup. Once you done with it now you can run report



Step 4  To Run report: 
Navigation : GL -> Request -> Financial
In this window you can select Report name then enter Ledger, period and currency column and submit report.


Once request completed click on view output.

FSG Report output.


One can run Report " Publish FSG Report"  to get FSG report output in Excel. This report is available in R12.



Oracle Fusion SQL Queries to get Sales Person/Sales Representative information for an Order

1) Get sales person details if the Sales Person ID is known SELECT  jrs.SALESREP_NUMBER  ,         jrs.status           ,         jrs.START_...