Importing journals Oracle Apps R12

To prepare for importing journals:

1. Define all account segment values used in your feeder systems.
2. Define your ledger using Accounting Setup Manager. The accounting setup must have a Complete status to use its ledgers.
3. Define or enable all currencies used in your feeder systems.
4. Define the journal entry sources used in your feeder systems. You can also specify whether you want General Ledger to store journal reference information from your feeder systems for a particular source. 5. Define journal entry categories used in your feeder systems.
6. If you want Journal Import to assign sequential numbers to your journal entries, enable sequential numbering, specifying Automatic as both your numbering and document generation method.
7. Open periods used in your feeder system. You can only import journals into Open or Future-Enterable periods in General Ledger.
8. Run the Optimizer program to create indexes on your account segments.
9. Define the concurrent program controls to improve the performance of Journal Import by setting the amount of disk space and memory it uses. The Journal Import program requires approximately 1.4 megabytes of memory to run. You can also specify whether to save your Journal Import data each time you run Journal Import. Journal Import runs faster if you do not archive your data.

Script for Creating user in oracle Apps R12

You can create user in oracle from front end directly, but user can be created only if you are having Sysadmin responsibility.What if you don't have  Sysadmin responsibility. but you have full back-end access (APPS access), then by running following script you can create your user from PL/SQL developer.

Reasons for a sales order to get Backordered



Back Orders:

The Oracle "term" backorder is a "status" on the order line or delivery line indicating that you have tried to release an order for picking in your warehouse, but that the pick release was UNSUCCESSFUL because there was no available inventory.(Backorder can be partial or complete). The Oracle term backorder does NOT mean that you have open purchase orders for the out-of-stock item from your vendors.

The term backorder is also used in business a little differently than in Oracle. The term "An item is on backorder" usually means that the item is not in stock, but the shipping company has already placed purchase orders from their suppliers to restock the item.

Use of shell script in oracle

A.Steps to Register Shell Script as a concurrent program.

B.Sample Shell Script to copy the file from source to destination.

C.Basic Shell Script Commands.

A. Steps to Register Shell Script as a concurrent program : 

Step 1:
=======
Place the .prog script under the bin directory for your applications top directory.

For example, call the script ONEPLACE_DEMO.prog and place it under $CUSTOM_TOP/bin
(*Note: $CUSTOM_TOP = name of you custom top)

Go to $CUSTOM_TOP/bin where you have places shell script file and run below command to give full permission to file.

chmod 777 .prog

step 2:
=======
Make a symbolic link from your script to $FND_TOP/bin/fndcpesr in $CUSTOM_TOP/bin directory.

For example, if the script is called ONEPLACE_DEMO.prog use this:

ln -s $FND_TOP/bin/fndcpesr ONEPLACE_DEMO

This link will be having same name as your script without the .prog extension.
step 3:
=======
Register the concurrent program, using an execution method as 'Host'. Use the name of your script without the .prog extension as the name of the executable.
For the example above:
Use ONEPLACE_DEMO as name of the executable file.
step 4:
=======
Your script will be passed at least 4 parameters, from $1 to $4.

$1 = orauser/pwd
$2 = userid(apps)
$3 = username,
$4 = request_id

Any other parameters you define will be passed in as $5 and higher.
Make sure your script returns an exit status.

B.Sample Shell Script to copy the file from source to destination

Shell Script to copy the file from source to destination

#Note: If you see # in front of any line it means that it’s a comment line not the actual code
#** ********************************************************************
# Created By : Oneplace World Blogspot
# Creation Date : 18-OCT-2016
# Script Name : ONEPLACE_DEMO.prog
# Description : This Script accepts three parameters
# 1)Data File Name 2)Source Directory Path 3)Target Directory Path
# Then copy the file from source location to target location.
# If copy fails send the error status/message to concurrent program so that user can see status.
#
#
# ========
# History
# ========
# Version 1 Oneplace World Blogspot 18-OCT-2016 Created for http://oneplaceworld.blogspot.in/ users
#
#** ********************************************************************
#Parameters from 1 to 4 i.e $1 $2 $3 $4 are standard parameters
# $1 : username/password of the database
# $2 : userid
# $3 : USERNAME
# $4 : Concurrent Request ID
DataFileName=$5
SourceDirectory=$6
TargetDirectory=$7
echo "————————————————–"
echo "Parameters received from concurrent program .."
echo " Time : "'date'
echo "————————————————–"
echo "Arguments : "
echo " Data File Name : "${DataFileName}
echo " SourceDirectory : "${SourceDirectory}
echo " TargetDirectory : "${TargetDirectory}
echo "————————————————–"
echo " Copying the file from source directory to target directory…"
cp ${SourceDirectory}/${DataFileName} ${TargetDirectory}
if [ $? -ne 0 ]
# the $? will contain the result of previously executed statement.
#It will be 0 if success and 1 if fail in many cases
# -ne represents not “equal to”
then
echo "Entered Exception"
exit 1
# exit 1 represents concurrent program status. 1 for error, 2 for warning 0 for success
else
echo "File Successfully copied from source to destination"
exit 0
fi
echo "****************************************************************"
#End of Shell Script File

C.Basic Shell Script Commands :

# Create Directory
mkdir
# Remove Directory
rmdir
#remove folder with files
rm -r -f
# Change Directory
cd
# Create new file
vi
#insert data into file
vi
esc i
#Save file
esc :wq enter
# exit without saving changes
esc :q! enter
# open existing file
vi
#remove file
rm
# Move file with same name
mv /
# move file with data appended to filename in the front
mv / /'date+%H%M%d%m%y'
# copy file with same name
cp /
# copy file with new name
cp / /
#print line
echo "your text here to print"
#print date
echo 'date'
#grep – This is one of the most powerful and useful commands available to you in Linux. It stands for Global/Regular Expression Print. It looks through a file and prints any line that matches a particular pattern. Because this pattern is based on "regular expression," a concise line can yield a multitude of patterns to be matched. For not, though, you can enter a tern for searching.(grep is case sensitive)
grep pattern_file
#You can use the “-i” flag to make it ignore case.
ls / | grep -i pattern_file
#Piping, or Chaining Piping is so named because it uses the pipe, (| ; shared with the \ key on most keyboards). Essentially, it takes the output of one command and directly feeds it to another. You can create long chains of commands to get a very specific desired output this way, and it’s very convenient for commands like grep.

ls / | grep pattern_file

Oracle FNDLOAD Scripts - Download and update LDT's

1. Lookups
-- ------------- 

Download Command :

FNDLOAD apps/password O Y DOWNLOAD $FND_TOP/patch/115/import/aflvmlu.lct XX_CUSTOM_LKP.ldt FND_LOOKUP_TYPE APPLICATION_SHORT_NAME="XXSHORT_NAME" LOOKUP_TYPE="XX_LOOKUP_TYPE"

 Upload Command :

FNDLOAD apps/password O Y UPLOAD $FND_TOP/patch/115/import/aflvmlu.lct XX_CUSTOM_LKP.ldt UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE

2. Concurrent Program
-- ----------------------------- 

Download Command :

FNDLOAD apps/password O Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct XX_CUSTOM_CP.ldt PROGRAM APPLICATION_SHORT_NAME="XXSHORT_NAME" CONCURRENT_PROGRAM_NAME="XX_CONCURRENT_PROGRAM"


 Upload Command :
FNDLOAD apps/password 0 Y UPLOAD $FND_TOP/patch/115/import/afcpprog.lct XX_CUSTOM_CP.ldt - WARNING=YES UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE

API for Closing/Finally Closing PO Using po_actions.close_po


API for closing or finally closing the POs. In this API, there is a parameter "p_action" which we need to set as either CLOSE (if we want to close the PO) or FINALLY CLOSE (If we want to Finally Close) the PO. Another Parameter which needs to set properly is "p_auto_close". This parameter should be set to 'N'.

/*oracle R12 : PO - Script to Close / Finally Close PO using PO_ACTIONS CLOSE_PO API.sql*/

DECLARE

x_action constant varchar2(20) := 'CLOSE'; -- Change this parameter as per requirement
x_calling_mode constant varchar2(2) := 'PO';
x_conc_flag constant varchar2(1) := 'N';
x_return_code_h varchar2(100);
x_auto_close constant varchar2(1) := 'N';
x_origin_doc_id number;
x_returned boolean;

CURSOR c_po_details IS

SELECT
pha.po_header_id,
pha.org_id,
pha.segment1,
pha.agent_id,
pdt.document_subtype,
pdt.document_type_code,
pha.closed_code,
pha.closed_date
FROM apps.po_headers_all pha, apps. pdt
WHERE pha.type_lookup_code = pdt.document_subtype
AND pha.org_id = pdt.org_id
AND pdt.document_type_code = 'PO'
AND authorization_status = 'APPROVED'
AND pha.closed_code <> 'CLOSED'
AND segment1 = 'P_PO_Number'; -- Enter the PO Number if only one PO needs to be finally closed/Closed

begin

fnd_global.apps_initialize (user_id => P_user_id,
resp_id => P_resp_id,
resp_appl_id => P_resp_appl_id);

/*For more details on how to Initialize the session oracle Apps R-12 visit Initializing The Session Oracle Apps R-12
*/
for po_head in c_po_details

LOOP

mo_global.init (po_head.document_type_code);
mo_global.set_policy_context ('S', po_head.org_id);

DBMS_OUTPUT.PUT_LINE ('Calling PO_Actions.close_po for Closing/Finally Closing PO =>' po_head.segment1);

x_returned :=
po_actions.close_po(
p_docid => po_head.po_header_id,
p_doctyp => po_head.document_type_code,
p_docsubtyp => po_head.document_subtype,
p_lineid => NULL,
p_shipid => NULL,
p_action => x_action,
p_reason => NULL,
p_calling_mode => x_calling_mode,
p_conc_flag => x_conc_flag,
p_return_code => x_return_code_h,
p_auto_close => x_auto_close,
p_action_date => SYSDATE,
p_origin_doc_id => NULL);

IF x_returned = TRUE THEN

DBMS_OUTPUT.PUT_LINE ('Purchase Order which just got Closed/Finally Closed is ' po_head.segment1);

COMMIT;

ELSE

DBMS_OUTPUT.PUT_LINE ('API Failed to Close/Finally Close the Purchase Order');

END IF;

END LOOP;

END;



/**Note : You can change document_type_code to close others type also for eg. PA,RFQ,REQUISITION etc. */

Initializing the session oracle Apps R-12

FND_GLOBAL.APPS_INITIALIZE is used for initializing the session before calling any public or private API’s in Oracle EBusiness suite. Its not required for all the API’s but its recommended that you set this profile before making any calls to either private or public API. 


Listed below is a sample call to FND_GLOBAL.APPS_INITIALIZE function


fnd_global.APPS_INITIALIZE(user_id=>l_user_id, 
                           resp_id=>l_resp_id, 
                           resp_appl_id=>l_resp_appl_id);


l_user_id : fnd user ID which will be utilized during the call. 
l_resp_id : responsibility ID 
l_resp_appl_id : responsibility application ID. 

You can use either sysadmin or use some user who has all the above listed responsibilities or you can use your username.


You can get user id,responsibility_id and application_id from below query:

select fnd.user_id , 
          fresp.responsibility_id, 
          fresp.application_id 
from   fnd_user fnd,
       fnd_responsibility_tl fresp 
where  fnd.user_name = 'P_user_name' 
and    fresp.responsibility_name = 'P_Responsibility_name';


Another option to get the values from oracle front-end, login and open java forms and then go to below path :
Help > Diagnostics > Examine 

and get the values from $profile session values.