Total Pageviews

Saturday, March 16, 2013

SQL Loader In Oracle Apps With Control File:


SQL LOADER is an Oracle utility used to load data into table given a datafile which has the records that need to be loaded. SQL*Loader takes data file, as well as a control file, to insert data into the table. When a Control file is executed, it can create Three (3) files called log file, bad file or reject file, discard file.
  • Log file tells you the state of the tables and indexes and the number of logical records already read from the input datafile. This information can be used to resume the load where it left off. 
  • Bad file or reject file gives you the records that were rejected because of formatting errors or because they caused Oracle errors. 
  • Discard file specifies the records that do not meet any of the loading criteria like when any of the WHEN clauses specified in the control file. These records differ from rejected records.
Structure of a Control file:
Sample CTL file for loading a Variable record data file:

OPTIONS (SKIP = 1,, ERRORS=99, ROWS=100)   –The first row in the data file is skipped without loading and With Will Allow fro 99 errors while loadig and
Rows=100 means , For Every 100 Rows auto commit will happens.
LOAD DATA 
INFILE ‘$FILE’             — Specify the data file  path and name
APPEND                       – type of loading (INSERT, APPEND, REPLACE, TRUNCATE
INTO TABLE “APPS”.”BUDGET”   – the table to be loaded into
FIELDS TERMINATED BY ‘|’           – Specify the delimiter if variable format datafile
OPTIONALLY ENCLOSED BY ‘”‘   –the values of the data fields may be enclosed in “
TRAILING NULLCOLS     – columns that are not present in the record treated as null
(ITEM_NUMBER    “TRIM(:ITEM_NUMBER)”, – Can use all SQL functions on columns
QTY                 DECIMAL EXTERNAL,
REVENUE             DECIMAL EXTERNAL, 
EXT_COST            DECIMAL EXTERNAL TERMINATED BY WHITESPACE “(TRIM(:EXT_COST))”  ,
MONTH           “to_char(LAST_DAY(ADD_MONTHS(SYSDATE,-1)),’DD-MON-YY’)” ,
DIVISION_CODE    CONSTANT “AUD”  – Can specify constant value instead of Getting value from datafile
)
OPTION statement precedes the LOAD DATA statement. The OPTIONS parameter allows you to specify runtime arguments in the control file, rather than on the command line. The following arguments can be specified using the OPTIONS parameter. 
SKIP = – Number of logical records to skip (Default 0)
LOAD = n — Number of logical records to load (Default all)
ERRORS = n — Number of errors to allow (Default 50)
ROWS = n   — Number of rows in conventional path bind array or between direct path data saves (Default: Conventional Path 64, Direct path all)
BINDSIZE = n – Size of conventional path bind array in bytes (System-dependent default)
SILENT = {FEEDBACK | ERRORS | DISCARDS | ALL} — Suppress messages during run 
(header, feedback, errors, discards, partitions, all)
DIRECT = {TRUE | FALSE} –Use direct path (Default FALSE)
PARALLEL = {TRUE | FALSE} — Perform parallel load (Default FALSE)
LOADDATA statement is required at the beginning of the control file. 
INFILE: INFILE keyword is used to specify location of the datafile or datafiles. 
INFILE* specifies that the data is found in the control file and not in an external file. INFILE ‘$FILE’, can be used to send the filepath and filename as a parameter when registered as a concurrent program.
INFILE   ‘/home/vision/kap/import2.csv’ specifies the filepath and the filename.
Example where datafile is an external file:
LOAD DATA
INFILE   ‘/home/vision/kap/import2.csv’
INTO TABLE kap_emp
FIELDS TERMINATED BY “,”
( emp_num, emp_name, department_num, department_name )
Example where datafile is in the Control file:
LOAD DATA
INFILE *
INTO TABLE kap_emp
FIELDS TERMINATED BY “,” 
( emp_num, emp_name, department_num, department_name )
BEGINDATA
7369,SMITH,7902,Accounting
7499,ALLEN,7698,Sales
7521,WARD,7698,Accounting
7566,JONES,7839,Sales
7654,MARTIN,7698,Accounting
Example where file name and path is sent as a parameter when registered as a concurrent program
"rtrim(ltrim(replace(:CUSTOMER_NUMBER,chr(13))))"           

LOAD DATA
INFILE ‘$FILE’
INTO TABLE kap_emp
FIELDS TERMINATED BY “,” 
( emp_num, emp_name, department_num, department_name )
TYPE OF LOADING:
INSERT   — If the table you are loading is empty, INSERT can be used.
APPEND  — If data already exists in the table, SQL*Loader appends the new rows to it. If data doesn’t already exist, the new rows are simply loaded. 
REPLACE — All rows in the table are deleted and the new data is loaded
TRUNCATE — SQL*Loader uses the SQL TRUNCATE command.
INTOTABLEis required to identify the table to be loaded into. In the above example INTO TABLE “APPS”.”BUDGET”, APPS refers to the Schema and BUDGET is the Table name.
FIELDS TERMINATED BY specifies how the data fields are terminated in the datafile.(If the file is Comma delimited or Pipe delimited etc)
OPTIONALLY ENCLOSED BY ‘”‘ specifies that data fields may also be enclosed by quotation marks.
TRAILINGNULLCOLS clause tells SQL*Loader to treat any relatively positioned columns that are not present in the record as null columns.
Loading a fixed format data file:
LOAD DATA
INFILE ‘sample.dat’
INTO TABLE emp
(      empno         POSITION(01:04)   INTEGER EXTERNAL,
ename          POSITION(06:15)   CHAR,
job            POSITION(17:25)   CHAR,
mgr            POSITION(27:30)   INTEGER EXTERNAL,
sal            POSITION(32:39)   DECIMAL EXTERNAL,
comm           POSITION(41:48)   DECIMAL EXTERNAL,
deptno         POSITION(50:51)   INTEGER EXTERNAL)
SQL*Loader loads the tables, creates the log file, and returns you to the system prompt. You can check the log file to see the results of running the case study.
Register as concurrent Program:
Place the Control file in $CUSTOM_TOP/bin.
Define the Executable. Give the Execution Method as SQL*LOADER.
Define the Program. Add the Parameter for FILENAME.
Skip columns:
You can skip columns using the ‘FILLER’ option.
Load Data



TRAILING  NULLCOLS
(
name Filler,
Empno ,
sal
)

here the column name will be skipped.

Thursday, March 14, 2013

XML Publisher Reports Issues in Oracle Apps  by Avinash Kumar


Hi Firends,

Most of the issues will be solved by below tag:

For Example I have faced below scenarios :

Ex:1 

When output is in CSV format..column payment term. have the values 01-00
but my output was displayed as  'JAN-00'

Answer) I have used below tag to solve the issue <?xdofx:PAYMENT_TERM||'    '?>

Ex: 2

When output is in CSV format column one of the column contain around 20 number like 123757638868363833846846
My CSV output was displayed in exponential value like 12375763e373884 etc...

Answer) I have  used the below tag to resolve the issue.

<?xdofx:SALES_ORDER_NUMBER||'    '?>

Ex : 3

To Get Values in For Total Amount including decimal values. 
123455.00 


Please use below tag

<fo:bidi-override direction="ltr" unicode-bidi="bidi-override"> <?format-number:sum(TOT_AMOUNT);'99G999G999G990D00PT'?> </fo:bidi>


<fo:bidi-override direction="ltr" unicode-bidi="bidi-override"> <?format-number:sum(APPROVED_AMT);'99G999G999G990D00PT'?> </fo:bidi>


<fo:bidi-override direction="ltr" unicode-bidi="bidi-override"> <?format-number:sum(TOTAL_AMT);'99G999G999G990D00PT'?>

Ex : 4

For Summary and Details Reports

Use 

<? if:P_REPORT_TYPE='Summary'?>
<?end if?>

<? if:P_REPORT_TYPE='Detail'?>
<?end if?>



Spiting by Page Break

<?split-by-page-break:?>

For Looping we use tag

<?for-each:G_DETAILS?>
<?end for-each?>


Ex : 5 

To hide the column we use 

<?if@column:B_ADDRESS1!=''?><?B_ADDRESS1?><?end if?>




Regards,
Avinash Kumar.

Commands to Download and Upload ldt Files.


wft 
----
WFLOAD apps/appsO Y UPLOAD /ebs/apactst1/interfaces/CREATEPO.wft

Custom.pll

f60gen module=CUSTOM.pll userid=APPS/APPS output_file=$AU_TOP/resource/CUSTOM.plx module_type=library batch=no compile_all=special  ----  pll


FNDLOAD apps/appsO Y UPLOAD $FND_TOP/patch/115/import/afcpprog.lct NZPOPR.ldt  ----cpupload(target)




Value Set(upload/download)
----------------------------

FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct WL_CUST_NUM_TO.ldt VALUE_SET FLEX_VALUE_SET_NAME="WL_CUST_NUM_TO"

FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/afffload.lct  WL_CUST_NUM_TO.ldt



Form Function(upload/download)
------------------------------

Download

FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/affrmcus.lct AP_APXSUMBA.ldt FND_FORM_CUSTOM_RULES function_name="AP_APXSUMBA"

FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/affrmcus.lct ONT_OEXOEORD_FORM.ldt FND_FORM_CUSTOM_RULES form_name="OEXOEORD"

UPLOAD

FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/affrmcus.lct AP_APXSUMBA.ldt


FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/affrmcus.lct ARXCUDCI.ldt



REQUEST SET(upload/download)
-----------------------------
Downlaod:
FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcprset.lct EXELNZ_CEBANKST_RSET_WEBADI.ldt REQ_SET REQUEST_SET_NAME="EXELNZ_CEBANKST_RSET_WEBADI"


FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcprset.lct EXELNZ_CEBANKST_RSET_WEBADI_LINK.ldt REQ_SET_LINKS REQUEST_SET_NAME="EXELNZ_CEBANKST_RSET_WEBADI"

Upload

FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/afcprset.lct EXELNZ_CEBANKST_RSET_WEBADI.ldt 


FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/afcprset.lct EXELNZ_CEBANKST_RSET_WEBADI_LINK.ldt


Concurrent prog upload:
-----------------------

FNDLOAD apps/apps O Y UPLOAD $FND_TOP/patch/115/import/afcpprog.lct APXIIMPT.ldt

FNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct $file.ldt PROGRAM APPLICATION_SHORT_NAME="XX_TOP" CONCURRENT_PROGRAM_NAME="Localization Interface Program"


Personalization Form Name : = WSHFSTRX
---------------------------------------

To Download:

FNDLOAD apps/**** 0 Y DOWNLOAD $FND_TOP/patch/115/import/affrmcus.lct WSHFSTRX.ldt FND_FORM_CUSTOM_RULES form_name="WSHFSTRX"

To Upload:
FNDLOAD apps/**** 0 Y UPLOAD $FND_TOP/patch/115/import/affrmcus.lct WSHFSTRX.ldt



Compile Forms in 11i
----------------------

$ f60gen module=<formname>.fmb userid=apps/<apps_pwd> output_file=$XX_TOP/forms/US/<formname>.fmx

Compile Forms in R12

$ frmcmp_batch <formname>.fmb userid=apps/<apps_pwd> output_file=$XX_TOP/12.0.0/form/US/<formname>.fmx module_type=form compile_all=special



For Menus :
-----------

To Download:
FNDLOAD apps/appd O Y DOWNLOAD $FND_TOP/patch/115/import/afsload.lct IN_DX_MGR1.ldt MENU MENU_NAME="IN_DX_MGR1"

To Upload:
FNDLOAD apps/apps O Y UPLOAD $FND_TOP/patch/115/import/afsload.lct IN_DX_MGR.ldt

 
For Responsibility:
-------------------

FNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afscursp.lct IN_DX_CASH_MANAGEMENT.ldt FND_RESPONSIBILITY RESP_KEY="IN_DX_CASH_MANAGEMENT"

FNDLOAD apps/apps O Y UPLOAD $FND_TOP/patch/115/import/afscursp.lct IN_DX_AR_SUPERUSER.ldt


For Profiles
------------

FNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afscprof.lct XXGP_TNE_SINGLE_APPROVER_LIST_ENABLED.ldt PROFILE PROFILE_NAME="XXGP_TNE_SINGLE_APPROVER_LIST_ENABLED" APPLICATION_SHORT_NAME=GECUST

FNDLOAD apps/apps_123 O Y UPLOAD $FND_TOP/patch/115/import/afscprof.lct XXGP_TNE_SINGLE_APPROVER_LIST_ENABLED.ldt



For LOOKUPS 
-----------

FNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/aflvmlu.lct XXGP_TNE_ACTIVE_INACTIVE.ldt FND_LOOKUP_TYPE APPLICATION_SHORT_NAME="GECUST" LOOKUP_TYPE="XXGP_TNE_ACTIVE_INACTIVE"


FNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/aflvmlu.lct IN_LEGAL_ENTITY_MAPPING.ldt FND_LOOKUP_TYPE APPLICATION_SHORT_NAME="ONT" LOOKUP_TYPE="IN_LEGAL_ENTITY_MAPPING"

FNDLOAD apps/finapps_123 O Y UPLOAD $FND_TOP/patch/115/import/aflvmlu.lct XXGP_TNE_ACTIVE_INACTIVE.ldt

FNDLOAD apps/appdevpfin O Y UPLOAD $FND_TOP/patch/115/import/aflvmlu.lct XX_CATEGORY_SET_LE.ldt FND_LOOKUP_TYPE APPLICATION_SHORT_NAME="INV" LOOKUP_TYPE="XX_CATEGORY_SET_LE"



ALL MESSAGES Download/Upload
----------------------------

FND_TOP/bin/FNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afmdmsg.lct XX_AL_GMS_MESSAGES_00.ldt FND_NEW_MESSAGES APPLICATION_SHORT_NAME=GECUST 

FND_TOP/bin/FNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afmdmsg.lct XX_AL_GMS_MESSAGES_00.ldt FND_NEW_MESSAGES APPLICATION_SHORT_NAME=GECUST 

FND_TOP/bin/FNDLOAD apps/apps O Y UPLOAD $FND_TOP/patch/115/import/afmdmsg.lct XX_AL_GMS_MESSAGES_00.ldt


Alerts
------

http://imdjkoch.wordpress.com/tag/fndload-for-alerts/


FNDLOAD apps/apps_password 0 Y DOWNLOAD $ALR_TOP/patch/115/import/alr.lct my_file.ldt ALR_ALERTS APPLICATION_SHORT_NAME=FND ALERT_NAME=Alert name to download

FNDLOAD apps/apps 0 Y DOWNLOAD $ALR_TOP/patch/115/import/alr.lct XX_CUSTOM_ALR.ldt ALR_ALERTS APPLICATION_SHORT_NAME=XXCUST ALERT_NAME="XX - Alert Name"



FNDLOAD apps/apps_password 0 Y UPLOAD $ALR_TOP/patch/115/import/alr.lct my_file.ldt

FNDLOAD apps/apps 0 Y UPLOAD $ALR_TOP/patch/115/import/alr.lct XX_CUSTOM_ALR.ldt CUSTOM_MODE=FORCE



D2K Forms
---------

FND_TOP/bin/FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afsload.lct XX_CUSTOM_FRM.ldt FORM FORM_NAME="FORM_NAME" 

       
FND_TOP/bin/FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/afsload.lct XX_CUSTOM_FRM.ldt - WARNING=YES UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE



FND Message
-----------

FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afmdmsg.lct XX_CUSTOM_MESG.ldt FND_NEW_MESSAGES APPLICATION_SHORT_NAME="XXCUST" MESSAGE_NAME="MESSAGE_NAME%"


FNDLOAD apps/apps O Y UPLOAD $FND_TOP/patch/115/import/afmdmsg.lct XX_CUSTOM_MESG.ldt UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE



Form Function
-------------

FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afsload.lct XX_CUSTOM_FUNC.ldt FUNCTION FUNCTION_NAME="FORM_FUNCTION_NAME"

 
FND_TOP/bin/FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/afsload.lct XX_CUSTOM_FUNC.ldt - WARNING=YES UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE


Regards,
Avinash Kumar


How to Kill the Session For the Database Objects:



select * from dba_ddl_locks where name='XX_LISTENER_PK1';

select * from v$session where sid=722;

alter system kill session '722,49407' immediate;
 

Regards,
Avinash Kumar

Sunday, March 10, 2013


What is the difference between API and interface?

An API is nothing but “Application Programming Interface”. 

API – it’s validating the record(s) and inserting directly into base tables. (if any error occurs, it’s just thrown an error at run time.)

Interface – Loads the data through interface table(s) and error-out record(s) histories' available in the same interface tables or provided error tables.

(The below image can help you understands easier way.)



How to get the Distinct Values in TABLE Value set?
How to display distinct values in Oracle Apps valueset, below are possible options 
Method 1                                                              

Create the VIEW based on DISTINCT values; use the VIEW for creates the VALUESET.
Method 2

2) Write your query in such a way that it gives you a distinct value. You can make use of ROWID to meet the requirement.

  Example.      SELECT date_col
                      FROM   xx_custom_table xpr
                      WHERE  rowid = (select max(rowid) from  xx_custom_table xpr1
                                                    where xpr.date_col =xpr1.date_col)


Method 3

Paste the QUERY in TABLE field with alias name, and give the column name (with alias name).

(For an example)

Table : (SELECT DISTINCT PERIOD_NAME FROM GL_PERIODS) GL

Value : GL.PERIOD_NAME