Monday 21 December 2015

Example of SQL DATA LOADER

As Salamo alaikum wa rahmatullah


I have created one control file by the name stk.ctl which has following parameter
---------------------------

LOAD DATA
INFILE "D:/upload/stk.csv"
BADFILE "D:/upload/stk.bad"
DISCARDFILE "D:/upload/stk.dsc"
Insert into table tbl_mst_stock 
Fields terminated by "," 

(stock_id,stk_code,stk_desc,created_dt date 'mm/dd/yyyy',updated_dt date 'mm/dd/yyyy')

After that open the command prompt and put the following command
c:/>sqlldr userid=scott@orcl/tiger  control=stk.ctl log=stk.log <etner>

--
MA Asalaam
Passion for Oracle

Create sequence in oracle

As salamo alaikum wa rahmatullah


CREATE SEQUENCE customers_seq
 START WITH     1000
 INCREMENT BY   1
 NOCACHE
 NOCYCLE;


--

Ma Asalaam
Passion for Oracle

Package Example in Oracle

As salamo alaikum wa rahmatullah

create or replace package pck_test
is
procedure prc_inst(stc in varchar2,sdesc in varchar2,errcode out varchar2,errbuf out varchar2);
procedure prc_upd(id in number,stc in varchar2,sdesc in varchar2,errcode out varchar2,errbuf out varchar2);
procedure prc_del(id in number,errcode out varchar2,errbuf out varchar2);
end pck_test;

create or replace package body pck_test
is
procedure prc_inst(stc in varchar2,sdesc in varchar2,errcode out varchar2,errbuf out varchar2) 
is
begin
insert into tbl_mst_stock(stk_code,stk_desc,created_dt,updated_dt)
values(stc,sdesc,sysdate,sysdate);
commit;
errcode:='0';
errbuf:='row inserted successfully';
exception
when dup_val_on_index then
errcode:='1';
errbuf:= 'duplicate key found';
end prc_inst;

procedure prc_upd(id in number,stc in varchar2,sdesc in varchar2,errcode out varchar2,errbuf out varchar2) is
begin
update tbl_mst_stock
set stk_code=stc, stk_desc=sdesc, updated_dt=sysdate where stock_id=id;
errcode:='0';
errbuf:='record updated successfully';
exception
when others then
errcode:='1';
errbuf:= 'duplicate key found';
end prc_upd;

procedure prc_del(id in number,errcode out varchar2,errbuf out varchar2) is
begin
delete from tbl_mst_stock 
where stock_id=id;
commit;
errcode:='0';
errbuf:='record deleted successfully';
exception
when others then
errcode:='1';
errbuf:='no row exist';
end prc_del;


end pck_test;


--

Ma Asalaam
Passion for Oracle

Wednesday 16 December 2015

Variable example in Oracle SQL

As Salamo alaikum wa rahmatullah

sql> var rc varchar2(100);
sql>begin :rc:='Passion for Oracle'; end;
Sql>/
Sql> pl/sql Procedure successfully completed
Sql> print rc
Sql> rc
--------------
Passion for Oracle 


---
Ma Asalaam
Passion for Oracle

Package With Function

As salamo alaikum wa rahmatullah

Example of package which has function

create or replace package pck_fuc
as
function today_date  return date ;
end pck_fuc;

create or replace package body pck_fuc
as

function today_date return date
is 
dt date;
begin
select sysdate into dt from dual;
return(dt);
end today_date;
end pck_fuc;
show errors

declare 
d date;
begin
d:=pck_fuc.today_date();
dbms_output.put_line(d);

end;

--

Ma Asalaam
Passion for Oracle

Tuesday 15 December 2015

Package with Procedure In Out Parameter Example

As salamo alaikum wa rahmatullah,



create or replace package test_proc2
AS
Procedure show_name(ucod in varchar2,fnm out varchar2,lnm out varchar2);
Procedure show_phone(ucod in varchar2,ph out varchar2);
Procedure show_email(ucod in varchar2,eml out varchar2);
end test_proc2;

create or replace package body test_proc2
as
Procedure show_name(ucod in varchar2,fnm out varchar2,lnm out varchar2)
as
Begin
Select Fname,Lname into fnm,lnm from tbl_mst_user where ucode=ucod; 
End show_name;
Procedure show_phone(ucod in varchar2,ph out varchar2)
as 
Begin
Select phone into ph from tbl_mst_user where ucode=ucod;
end show_phone;
Procedure show_email (ucod in varchar2,eml out varchar2)
is
begin
select email into eml from tbl_mst_user where ucode=ucod;
end show_email;
end test_proc2;

set serveroutput on;

declare
f varchar2(100);
l varchar2(100);
begin

TEST_PROC2.SHOW_NAME('u001',f,l);
dbms_output.put_line(f||'  '||l);
end;

declare
ph varchar2(100);
begin

TEST_PROC2.show_phone('u001',ph);
dbms_output.put_line(ph);
end;


declare
em varchar2(100);
begin

TEST_PROC2.Show_email('u001',em);
dbms_output.put_line(em);

end;


--
Ma Asalaam
Passion for Oracle

Sunday 6 December 2015

Simple Cursor example for Chart of Account

As salamo alaikum wa rahmatullah

Set Serveroutput on;
declare
cursor my_cursor is select * from GLFV_charts_of_accounts;
begin
for item in my_cursor
loop
 DBMS_OUTPUT.PUT_LINE(item.CHART_OF_ACCOUNTS_NAME);
end loop;
end;

--
Ma Asalaam
Passion for Oracle

Important Interface Tables in Oracle Apps

As salamo alaikum wa rahmatullah


GL INTERFACE TABLES

GL_BUDGET_INTERFACE
GL_DAILY_RATES_INTERFACE
GL_IEA_INTERFACE
GL_INTERFACE
GL_INTERFACE_CONTROL
GL_INTERFACE_HISTORY 
AP INTERFACE TABLES 
AP_INTERFACE_CONTROLS
AP_INTERFACE_REJECTIONS
AP_INVOICES_INTERFACE
AP_INVOICE_LINES_INTERFACE
AR INTERFACE TABLES
AR_PAYMENTS_INTERFACE_ALL
AR_TAX_INTERFACE
HZ_DQM_SYNC_INTERFACE
HZ_PARTY_INTERFACE
HZ_PARTY_INTERFACE_ERRORS
RA_CUSTOMERS_INTERFACE_ALL
RA_INTERFACE_DISTRIBUTIONS_ALL
RA_INTERFACE_ERRORS_ALL
RA_INTERFACE_LINES_ALL
RA_INTERFACE_SALESCREDITS_ALL


FA INTERFACE TABLES 
FA_BUDGET_INTERFACE
FA_INV_INTERFACE
FA_PRODUCTION_INTERFACE
FA_TAX_INTERFACE 


INVENTORY INTERFACE TABLES 
MTL_CC_ENTRIES_INTERFACE
MTL_CC_INTERFACE_ERRORS
MTL_CI_INTERFACE
MTL_CI_XREFS_INTERFACE
MTL_COPY_ORG_INTERFACE
MTL_CROSS_REFERENCES_INTERFACE
MTL_DEMAND_INTERFACE
MTL_DESC_ELEM_VAL_INTERFACE
MTL_EAM_ASSET_NUM_INTERFACE
MTL_EAM_ATTR_VAL_INTERFACE
MTL_INTERFACE_ERRORS
MTL_INTERFACE_PROC_CONTROLS
MTL_ITEM_CATEGORIES_INTERFACE
MTL_ITEM_CHILD_INFO_INTERFACE
MTL_ITEM_REVISIONS_INTERFACE
MTL_ITEM_SUB_INVS_INTERFACE
MTL_OBJECT_GENEALOGY_INTERFACE
MTL_RELATED_ITEMS_INTERFACE
MTL_RESERVATIONS_INTERFACE
MTL_RTG_ITEM_REVS_INTERFACE
MTL_SECONDARY_LOCS_INTERFACE
MTL_SERIAL_NUMBERS_INTERFACE
MTL_SO_RMA_INTERFACE
MTL_SYSTEM_ITEMS_INTERFACE
MTL_TRANSACTIONS_INTERFACE
MTL_TRANSACTION_LOTS_INTERFACE
MTL_TXN_COST_DET_INTERFACE


PO INTERFACE TABLES
 PO_DISTRIBUTIONS_INTERFACE
PO_HEADERS_INTERFACE
PO_INTERFACE_ERRORS
PO_LINES_INTERFACE
PO_REQUISITIONS_INTERFACE_ALL
PO_REQ_DIST_INTERFACE_ALL
PO_RESCHEDULE_INTERFACE
RCV_HEADERS_INTERFACE
RCV_LOTS_INTERFACE
RCV_SERIALS_INTERFACE
RCV_TRANSACTIONS_INTERFACE


BOM INTERFACE TABLES 
BOM_BILL_OF_MTLS_INTERFACE
BOM_INTERFACE_DELETE_GROUPS
BOM_INVENTORY_COMPS_INTERFACE
BOM_OP_RESOURCES_INTERFACE
BOM_OP_ROUTINGS_INTERFACE
BOM_OP_SEQUENCES_INTERFACE
BOM_REF_DESGS_INTERFACE
BOM_SUB_COMPS_INTERFACE
CST_COMP_SNAP_INTERFACE
CST_INTERFACE_ERRORS
CST_ITEM_COSTS_INTERFACE
CST_ITEM_CST_DTLS_INTERFACE
CST_PC_COST_DET_INTERFACE
CST_PC_ITEM_COST_INTERFACE


WIP INTERFACE TABLES
WIP_COST_TXN_INTERFACE
WIP_INTERFACE_ERRORS
WIP_JOB_DTLS_INTERFACE
WIP_JOB_SCHEDULE_INTERFACE
WIP_MOVE_TXN_INTERFACE
WIP_SCHEDULING_INTERFACE
WIP_TXN_INTERFACE_ERRORS TABLE


ORDER MANAGEMENT INTERFACE TABLES
SO_CONFIGURATIONS_INTERFACE
SO_HEADERS_INTERFACE_ALL
SO_HEADER_ATTRIBUTES_INTERFACE
SO_LINES_INTERFACE_ALL
SO_LINE_ATTRIBUTES_INTERFACE
SO_LINE_DETAILS_INTERFACE
SO_PRICE_ADJUSTMENTS_INTERFACE
SO_SALES_CREDITS_INTERFACE
SO_SERVICE_DETAILS_INTERFACE
WSH_DELIVERIES_INTERFACE
WSH_FREIGHT_CHARGES_INTERFACE
WSH_PACKED_CONTAINER_INTERFACE 


Cash Management 

CE_STATEMENT_HEADERS_INT
CE_STATEMENT_LINES_INTERFACE

--
Ma Asalaam
Passion for Oracle

Key Tables of General Ledger in Oracle Apps

As Salamo alaikum wa rahmatullah


1- GL_SETS_OF_BOOKS
2- GL_IMPORT_REFERENCES
3- GL_DAILY_RATES
4- GL_JE_LINES
5- GL_PERIODS
6- GL_JE_HEADERS
7- GL_JE_BATCHES
8- GL_BALANCES
9- GL_CODE_COMBINATIONS
GL_SETS_OF_BOOKS
Stores information about the sets of books you define in your Oracle General Ledger application. Each row includes the set of books name, description, functional currency, and other information. This table corresponds to the Set of Books form.
GL_IMPORT_REFERENCES
Stores individual transactions from subledgers that have been summarized into Oracle General Ledger journal entry lines through the Journal Import process. You can specify the journal entry sources for which you want to maintain your transaction’s origin by entering ’Yes’ in the Import Journal References field of the Journal Sources form.
For each source that has Import Journal References set to ’Yes’, Oracle General Ledger will populate GL_IMPORT_REFERENCES with one record for each transaction in your feeder system.
GL_DAILY_RATES
Stores the daily conversion rates for foreign currency transactions. It replaces the GL_DAILY_CONVERSION_RATES table. It stores the rate to use when converting between two currencies for a given conversion date and conversion type. Each row in this table has a corresponding inverse row in which the from and to currencies are switched.
For example, if this table contains a row with a from_currency of YEN, a to_currency of CND, a conversion_type of Spot, and a conversion_date of January 1, 1997, it will also contain a row with a from_currency of CND, a to_currency of YEN, a conversion_type of Spot, and a conversion_date of January 1, 1997.
In general, this row will contain a rate that is the inverse of the matching row. One should never insert directly into this table. They should instead insert into the DAILY_RATES_INTERFACE table. Data inserted into the GL_DAILY_RATES_INTERFACE table will be automatically copied into this table.
GL_JE_LINES
Stores the journal entry lines that you enter in the Enter Journals form. There is a one–to–many relationship between journal entries and journal entry lines. Each row in this table stores the associated journal entry header ID, the line number, the associated code combination ID, and the debits or credits associated with the journal line. STATUS is ’U’ for unposted or ’P’ for posted.
GL_PERIODS
Stores information about the accounting periods you define using the Accounting Calendar form. Each row includes the start date and end date of the period, the period type, the fiscal year, the period number, and other information. There is a one–to–many relationship between a row in the GL_PERIOD_SETS table and rows inthis table.
GL_JE_HEADERS
Stores journal entries. There is a one–to–many relationship between journal entry batches and journal entries. Each row in this table includes the associated batch ID, the journal entry name and description, and other information about the journal entry. This table corresponds to the Journals window of the Enter Journals form. STATUS is ’U’ for unposted, ’P’ for posted. Other statuses indicate that an error condition was found. CONVERSION_FLAG equal to ’N’ indicates that you manually changed a converted amount in the Journal Entry Lines zone of a foreign currency journal entry. In this case, the posting program does not re–convert your foreign amounts. This can happen only if your user profile option MULTIPLE_RATES_PER_JE is ’Yes’. BALANCING_SEGMENT_VALUE is null if there is only one balancing segment value in your journal entry. If there is more than one, BALANCING_SEGMENT_VALUE is the greatest balancing segment value in your journal entry.
GL_JE_BATCHES
Stores journal entry batches. Each row includes the batch name, description, status, running total debits and credits, and other information. This table corresponds to the Batch window of the Enter Journals form. STATUS is ’U’ for unposted, ’P’ for posted, ’S’ for selected, ’I’ for in the process of being posted. Other values of status indicate an error condition. STATUS_VERIFIED is ’N’ when you create or modify an unposted journal entry batch.
The posting program changes STATUS_VERIFIED to ’I’ when posting is in process and ’Y’ after posting is complete.
GL_BALANCES
Stores actual, budget, and encumbrance balances for detail and summary accounts. This table stores functional currency, foreign currency, and statistical balances for each accounting period that has ever been opened.
ACTUAL_FLAG is either ’A’, ’B’, or ’E’ for actual, budget, or encumbrance balances, respectively. If ACTUAL_FLAG is ’B’, then BUDGET_VERSION_ID is required. If ACTUAL_FLAG is ’E’, then ENCUMBRANCE_TYPE_ID is required.
GL_BALANCES stores period activity for an account in the PERIOD_NET_DR and PERIOD_NET_CR columns. The table stores the period beginning balances in BEGIN_BALANCE_DR and BEGIN_BALANCE_CR.
An account’s year–to–date balance is calculated as BEGIN_BALANCE_DR – BEGIN_BALANCE_CR + PERIOD_NET_DR – PERIOD_NET_CR. Detail and summary foreign currency balances that are the result of posted foreign currency journal entries have TRANSLATED_FLAG set to ’R’, to indicate that the row is a candidate for revaluation.
For foreign currency rows, the begin balance and period net columns contain the foreign currency balance, while the begin balance and period net BEQ columns contain the converted functional currency balance. Detail foreign currency balances that are the result of foreign currency translation have TRANSLATED_FLAG set to ’Y’ or ’N’. ’N’ indicates that the translation is out of date (i.e., the account needs to be re–translated). ’Y’ indicates that the translation is current.
Summary foreign currency balances that are the result of foreign currency translation have TRANSLATED_FLAG set to NULL. All summary account balances have TEMPLATE_ID not NULL. The columns that end in ADB are not used. Also, the REVALUATION_STATUS column is notused.
GL_CODE_COMBINATIONS
Stores valid account combinations foreach Accounting Flexfield structure within your Oracle General Ledger application. Associated with each account are certain codes and flags, including whether the account is enabled, whether detail posting ordetail budgeting is allowed, and others. Segment values are stored in the SEGMENT columns. Note that each Accounting Flexfield structure may use different SEGMENT columns within the table to store the flexfield value combination. Moreover, the SEGMENT columns that are used are not guaranteed to be in any order. The Oracle Application Object Library table FND_ID_FLEX_SEGMENTS stores information about which column in this table is used for each segment of each Accounting Flexfield structure. Summary accounts have SUMMARY_FLAG = ’Y’ and TEMPLATE_ID not NULL. Detail accounts have SUMMARY_FLAG = ’N’ and TEMPLATE_ID NULL.
--
Ma Asalaam
Passion for Oracle

Saturday 5 December 2015

Oracle SQL*Loader

As salamo alaikum wa rahmatullah

If you are using oracle database at the same time you need to upload data into oracle table from text file.
Here is sample example how to upload the data from the text file.
For example, you have table named Employee which has columns Empno,Ename,Hiredate,Deptno.
I created a text file name employee.txt here under
1200,'Clark','12-Dec-1980',20
1201,'Alen','1-Jan-1985',30
1202,'Ramanivash','2-Feb-1990',40 
now employee text file is ready, after that i have to create a control file.
My control file name is example.ctl and the content is here under
load data
infile 'D:\upload\employee.txt'
into table employee
fileds terminated by ","
(Empno,Ename,Hiredate,Deptno)

Thanking you
--
Ma Asalaam
Mohammad Shahnawaz
Passion for Oracle

Monday 23 November 2015

Types of Docs in Oracle APPS

As salamo alaikum wa rahmatullah.

Types of document in Oracle Apps.

MD 050 -- Module design by the functional consultant.
MD 070 -- Technical Document designed by the technical consultant.
MD 020 -- Technical document designed by the functional document.
MD 0120 -- Migration and user training document by the technical consultant.
CV 040 -- Conversion of the functional document by the functional consultant.

CV 060 -- Conversion of the technical document by the technical consultant.

Note - Conversion means moving data from legacy system to the Apps system.

--
Ma Asalaam
Mohd. Shahnawaz
Passion for Oracle

Monday 2 November 2015

What are Task Flows?

As salamo alaikum wa rahmatullah

In simple word
------------------
* Visual representation of application process flow.
* Each Task Flow contains portion of application navigation.
* They are similar to traditional flow charts.
* Primary purpose is reuse.

---
Ma Asalaam
Passion for Oracle

Task Flow Managed Bean Scope

As Salamo alaikum wa rahmatullah.

Task Flow Managed Bean Scope are following
--------------------------------------------------
Application - Remains till application stop.
Session - Persists till user session.
Page Flow - Also known as task flow scope.
View - Lifespan till current page.
Request - Lives for duration of request only.
BackingBean - UI component based.
Flash Scope - Remains till next encountered view (included in JSF 2.0)

--
Ma Asalaam
Passion for Oracle

View Object Programmatically called in java class

As Salamo alaikum wa rahmatullah

package demo.vo.example.view;

import demo.vo.example.model.EmployeesViewImpl;

import demo.vo.example.model.EmployeesViewRowImpl;

import oracle.jbo.ApplicationModule;

import oracle.jbo.client.Configuration;

public class AppModuleTest {
   public static void main(String[] args) {
       ApplicationModule appModule=Configuration.createRootApplicationModule("demo.vo.example.model.AppModule", "AppModuleLocal");
       EmployeesViewImpl vo = (EmployeesViewImpl)appModule.findViewObject("EmployeesView1");
       while(vo.hasNext()){
           EmployeesViewRowImpl row = (EmployeesViewRowImpl)vo.next();
           System.out.println(row.getFirstName()+row.getLastName()+row.getEmail());
//           System.out.println(row.getLastName());
       }
   }
}

Project Reference



--
Ma Asalaam
Passion for Oracle

Tuesday 8 September 2015

Add User in SQL Server 2005/2008/2010/2012/2014

As salamo alaikum wa rahmatullah

Problem - Suppose you have installed the sql server with 'domainname\username' and forgot the enable sa user. for example 'test.com\admin'
Now you join the different domain - 'example.com\admin', now you are trying to access with new domain connection.
your management studio is unable to connect with the current domain user.

Solution - Follow the following step ..

First stop MSSQLSERVER services from the services.
write sqlcmd in run 
SQLCMD run as administrator

c:\> sc start MSSQLSERVER -m (MSSQLSERVER is service name)

C:\>SQLCMD -s GREENTECHAX (GREENTECHAX is instance name)
1>use master
2>go
1>Sp_addsrvrolemember  'fccdynamics\administrator', 'sysadmin'
2>go
1>Sp_addsrvrolemember  'domain\account', 'sysadmin' <CR>
2>Go

After that, Restart the service and start the ssms.
you are able to now connect with new domain.
--
Thanks and Regards
Mohammad Shahnawaz
Passion for Oracle

Monday 10 August 2015

What is RICE implementation in Oracle Apps Technical?

As Salamo alaikum wa rahmatullah

Mostly an oracle apps technical consultant will be working on RICE components.
R--Reports
I--Interfaces
C--Conversions
E--Extensions(Forms personalization)

Reports:
For suppose I'm running a business named 'Mobile and Accessories' which is wide spread across the globe.Now,I want to know how my business is running across the globe.I will ask a tech guy(oracle apps technical consultant) to develop a report.In that report I ask him to simply print the details of profit or loss,of every branch of my business across the world.He(tech guy) will come up with the report to me then I will come to know whether my company is running fine or not.Thereby, I can take necessary decisions to run my business fine.
Clearly we have seen that report will be developed by technical person,who must know the report building.
We build a report using sql,pl/sql.So,if your are strong in sql,pl/sql then its not a big deal to learn the report building.Its enough to learn the report developer tool.

Conversion:
As I said earlier I'm running a 'vnk' business(which is fictious).Suppose I,m using excel sheets to store the data.Now I want to install oracle apps(E-Business Suite) in my company. So,What ever data that is present in my excel sheets must also be present in my oracle apps tables(A table is a collection of rows and columns).Now I ask a tech guy to write a code such that my excel sheet data will get into oracle apps base tables.Then that tech guy will use 'conversion' to get the data from the legacy system(in our case it is excel sheet) into oracle apps base tables.

Interfaces:
Interfaces are similar to conversions.Conversion is a one-time process where as Interface is on-going process every now and then.We run interfaces daily or periodically.
Interfaces are of two types
1)Inbound Interface
2)Outbound Interface
Inbound Interface:Transferring the data from the legacy system(in our case it is excel sheet) into the Oracle apps base tables.
Outbound Interface:Transferring the data from the Oracle apps base tables into the legacy system(It might be any of these SAP,Peoplesoft etc).

Extensions:
Extensions are nothing but persionalizing the forms.In oracle e-business suite we have some where around 5000 to 6000 forms.In my 'vnk' business i want to customise the po(purchase order) form of the oracle apps then i ask the tech guy to do that.He will use form builder tool to do that.
--
Ma Asalaam
Passion's for Oracle

Monday 15 June 2015

user creation in oracle 12c

As salamo alaikum wa rahmatullah

Question:  I am trying to create a user in Oracle 12c and I don't give a rat's butt about pluggable databases.  When I try to create a user with the c## prefix I get the dreaded ORA-65096 error:

create user fred identified by flintstone;
ORA-65096: invalid common user or role name

I don't care if the user ID is used as a pluggable database, I just want to create a user named fred without being required to add the c## prefix (create user c##fred).
How do I fix the ORA-65096 error and create my use without a container database c## prefix?
Answer:  The oerr utility is not at all helpful for the ORA-65096 error:
ORA-65096: invalid common user or role name

Cause: An attempt was made to create a common user or role with a name that was not valid for common users or roles. In addition to the usual rules for user and role names, common user and role names must start with C## or c## and consist only of ASCII characters.

Action: Specify a valid common user or role name.
The solution to the ORA-06596 is to set a hidden parameter "_oracle_script".  When you set the undocumented (hidden) parameter "_oracle_script"=true  you can create the fred user without a C## in from of the user ID.  However, this user will not used useful in a pluggable/container database:
connect system/manager as sysdba
alter session set "_ORACLE_SCRIPT"=true;
create user fred identified by flintstone;
grant dba to pubs;
connect fred/flintstone
Always consult Oracle support before using any hidden Oracle parameters. 

--
Mohammad Shahnawaz
Passion for Oracle
Kuwait