tag:blogger.com,1999:blog-47618481064055563492024-03-03T18:26:08.764-06:00Oracle AppsDuring my work, sometimes I come across some information that I am sure to forget in a given time period. So I started this blog to post such information for future use. If it is of any use to you, please let me know.Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.comBlogger293125tag:blogger.com,1999:blog-4761848106405556349.post-23779041084666750272021-06-18T22:28:00.000-05:002021-06-18T22:28:03.432-05:00Query to get Count of Payable Invoices by Year and Status (Paid, Unpaid or Cancelled)<br/>
We were purging payable invoices and i wanted to know how many invoices are still not paid in a given year. So i used this simple query.
<br>
<textarea rows="10" cols="120" readonly="readonly" wrap="off">
select to_char(last_update_date,'YYYY') Year
, sum(decode(payment_Status_flag,'Y',1, 0)) "Paid Invoices"
, sum(decode(payment_Status_flag,'N', decode(cancelled_date,NULL,1, 0),0)) "Unpaid Invoices"
, sum(decode(payment_Status_flag,'N', decode(cancelled_date,NULL,0, 1),0)) "Cancelled Invoices"
from ap_invoices_all
where last_update_date between to_date('01-jan-2015','dd-mon-yyyy')
and to_date('01-jan-2020','dd-mon-yyyy')
group by to_char(last_update_date,'YYYY')
order by 1;
</textarea>Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0tag:blogger.com,1999:blog-4761848106405556349.post-4750937825662264742020-01-29T14:50:00.002-06:002020-01-29T14:51:55.961-06:00 Late Charges Calculation and Set Up: A Guide for Oracle Receivables Users (Doc ID 1269062.1)<a href="https://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=1269062.1">Link to Setup Guide</a>Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0tag:blogger.com,1999:blog-4761848106405556349.post-13430611727032711962019-06-10T19:48:00.000-05:002019-06-10T19:48:00.150-05:00List of Checks/EFT Payments where invoice or credit memo is removed<br/>
We wanted to find out what are the checks/EFT payments from where an invoice or a credit memo has been removed.
So I wrote this query. This query can give me count of invoices/credit memos along with total amount that have been paid and removed in a payment document.
<br/><br/>
<textarea cols="90" rows="30">
SELECT /*+ leading (pmt_mod pmt doc) use_nl (pmt_mod pmt doc) */
call_app_pay_service_req_code
, pmt.payment_id
, pmt.paper_document_number
, doc.document_status
, COUNT(9)
, SUM(doc.payment_amount)
, pmt.payment_amount
FROM iby_payments_all pmt
, iby.iby_docs_payable_all doc
, ( SELECT /*+ leading (psr_in) use_nl (psr doc_in) NO_UNNEST */
DISTINCT doc_in.payment_id
, call_app_pay_service_req_code
FROM iby_docs_payable_all doc_in
, iby_pay_service_requests psr_in
WHERE doc_in.payment_service_request_id = psr_in.payment_service_request_id
AND psr_in.creation_date > sysdate -100
AND psr_in.call_app_pay_service_req_code LIKE '%EFT%' /* This is filter payment requests*/
AND doc_in.document_status IN ('REMOVED')
) pmt_mod
WHERE pmt.payment_id = pmt_mod.payment_id
AND pmt.payment_id = doc.payment_id
GROUP BY call_app_pay_service_req_code
, pmt.payment_id
, doc.document_status
, pmt.paper_document_number
, pmt.payment_amount
ORDER BY 1,2,3 ;
</textarea>Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0tag:blogger.com,1999:blog-4761848106405556349.post-14702356518777924252019-04-11T19:40:00.000-05:002019-04-11T19:40:09.975-05:00Date Formats in Oracle SQLIn one of the table in Oracle application, we were storing date value in VARCHAR2 column (ATTRIBUTE1-15). I was saving date in YYYYMMDD format. Oracle Value set FND_STANDARD_DATE save set in YYYY/MM/DD HH24:MI:SS format.<br />
My custom program did not fail when converted to DATE using to_date function. So I tired following queries and all of them completed without any error. It seems to_date function does not care about separator (i.e. / Or - or NULL). <br> <br><br />
<br />
select to_date('20190721' , 'YYYY/MM/DD HH24:MI:SS') from dual; <br />
select to_date('201907/21', 'YYYY/MM/DD HH24:MI:SS') from dual; <br />
select to_date('04JUL19' , 'DD-MON-YY HH24:MI:SS' ) from dual; <br />
select to_date('04/JUL/19', 'DD-MON-YY HH24:MI:SS' ) from dual; <br />
select to_date('04|JUL-19', 'DD-MON-YY HH24:MI:SS' ) from dual; Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0tag:blogger.com,1999:blog-4761848106405556349.post-34389456946394849572018-12-12T19:38:00.000-06:002018-12-13T09:00:45.640-06:00Oracle API to Delete Projects (pa_project_pub.delete_project)<br/>
I was creating oracle projects from a text file. In order to use same text file for multiple test cases, I was deleting project using Oracle Projects Form. It was little inconvenient. So I wrote this simple script to delete project.
This script can be modified to select projects that need to be deleted.
<br/><br/>
<textarea cols="100", rows="60" readonly="readonly" wrap="off" >
declare
l_msg_count number;
l_msg_data VARCHAR2(4000);
l_return_status VARCHAR2(3);
l_index NUMBER;
--
-- Following values should be changed based on your environment
-- Make sure that you can delete project using the responsibility given below otherwise you will get following error
-- "You do not have update privileges on this project. A project can be updated only by its key members or users with cross-project responsibility."
--
l_org_id NUMBER := 1;
l_user_id NUMBER := 500;
l_resp_id NUMBER := 22593 /* Responsibility = Project Super User */;
l_resp_appl_id NUMBER := 275 /* Application = Projects*/ ;
CURSOR c_projs is
SELECT pm_product_code, pm_project_reference, project_id, segment1
from pa_projects
where created_by = l_user_id
and creation_date > to_date('11-DEC-2018 08:00:00', 'DD-MON-YYYY HH24:MI:SS')
and segment1 like 'SC%'
;
begin
mo_global.set_policy_context('S',l_org_id);
fnd_global.APPS_INITIALIZE(user_id=>l_user_id , resp_id=> l_resp_id, resp_appl_id=> l_resp_appl_id);
l_index := 0;
FOR l_rec in c_projs
LOOP
l_index := l_index + 1;
dbms_output.put(to_char(l_index,'99999') || ' Project ' || l_rec.segment1);
pa_project_pub.delete_project
( p_api_version_number => 1.0
, p_commit => FND_API.G_FALSE
, p_init_msg_list => FND_API.G_TRUE
, p_msg_count => l_msg_count
, p_msg_data => l_msg_data
, p_return_status => l_return_status
, p_pm_product_code => l_rec.pm_product_code
, p_pm_project_reference => l_rec.pm_project_reference
, p_pa_project_id => l_rec.project_id
) ;
IF l_return_status = 'S'
THEN
dbms_output.put_line(' Deleted Successfully');
ELSE
dbms_output.put_line(' Deletion Failed, errors are:');
FOR j in 1..FND_MSG_PUB.count_msg
LOOP
FND_MSG_PUB.get
( p_msg_index => j
, p_encoded => 'F'
, p_data => l_msg_data
, p_msg_index_out => l_index
) ;
dbms_output.put_line(' Error : ' || l_msg_data);
END LOOP;
END IF;
END LOOP;
end;
</textarea>
Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0tag:blogger.com,1999:blog-4761848106405556349.post-89162882308568875992018-08-09T22:08:00.000-05:002018-08-09T22:08:01.293-05:00How to Debug Account Generator<br />
I needed to debug workflow PAAPINVW (Project Supplier Invoice Account Generation). As per oracle documentation, it can debugged by setting profile option <font color="yellow"><b>"Account Generator:Run in Debug Mode"</b></font> to <font color="yellow"><b>"Yes"</b></font>. But I could not find where debug information is being saved. So I opened the package <font color="yellow"><b>"fnd_flex_workflow_apis"</b></font> and found that debug information is being saved in a file named <font color="yellow"><b>fdfsrvdbg.log</b></font>. File is created in first directory specified by parameter <font color="yellow">'utl_file_dir'<b></b></font>. The file <font color="yellow"><b>fdfsrvdbg.log</b></font> is opened in APPEND mode. So in order to view only your debug information, you may delete all lines from file or move this file other dir before you start your debug.<br />
<br />
Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0tag:blogger.com,1999:blog-4761848106405556349.post-64954768644928792212018-08-08T20:35:00.000-05:002018-08-08T20:35:19.362-05:00PAAPINVW - Steps to Customize Project Supplier Invoice Account Generator Workflow (Doc ID 1344854.1)This is a good oracle document describing how to customize <font color="yellow"><b>Project Supplier Invoice Account Generation"</b></font> Workflow <b> <a href="https://support.oracle.com/epmos/faces/DocumentDisplay?id=1344854.1">PAAPINVW - Steps to Customize Project Supplier Invoice Account Generator Workflow (Doc ID 1344854.1)</a></b><br/><br />
<br />
I had to read it multiple times to get good understanding of steps needed to modify it.<br />
<br />
<a href="https://docs.oracle.com/cd/E26401_01/doc.122/e49019/T188672T422927.htm">Oracle Projects Implementation Guide</a> (Release 12.2 Part Number E49019-07 AutoAccounting, the Account Generator, and Subledger Accounting) too was useful. <br />
<br />
For account generator workflow, setups created using RULES and ASSIGN RULES forms (Responsibility -> Project costing Super User, Navigation -> Setup -> AutoAccounting) are probably not applicable to "Project Supplier Invoice Account Generator Workflow". The workflow uses only LOOKUP SETS (Same navigation as RULES, ASSIGN RULES).<br />
<br />
If you create a new process for generating default account for supplier invoices then you need to update process name for item type "Project Supplier Invoice Account Generation". It can be done as given below.<br />
<ol><li> Login using System Administrator Responsibility</li>
<li> Navigate to Application -> Flexfield -> Key -> Accounts</li>
<li> Query your "Accounting Structure" </li>
<li> Naviate to "Process" block</li>
<li> Query item type "Project Supplier Invoice Account Generation" </li>
<li> Enter New Process created for generating account for supplier invoices.<br />
</ol>Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0tag:blogger.com,1999:blog-4761848106405556349.post-1740992098655234732018-07-17T13:52:00.002-05:002018-07-17T14:06:20.370-05:00Oracle Project API "PA_PROJECT_PUB" Error: "Your current responsibility does not have access to this function."Will it hurt Oracle developers to put Function Id too in the error message? How do i know which function i don't have access? <br />
<br />
<br />
So queried fnd_new_message to get message code (select * from fnd_new_messages where message_text like 'Your current resp%';). <br />
Message code was "PA_FUNCTION_SECURITY_ENFORCED". <br />
<br />
<br />
Searched source code of PA_PROJECT_PUB.create_project for the message code. it was function "PA_PM_CREATE_PROJECT" that my responsibility did not have access to.<br />
<br />
<br />
I could create projects using API via some other custom responsibility. So I used <font color="yellow"><b><a href="https://sanjaimisra.blogspot.com/2010/02/menu-structure.html">THIS QUERY</a></b></font> replaced "%" for user_menu_name with menu_name for responsibility that does not give error. I found the following sub menu has all the functions that may be needed for creating/updating projects/task using projects APIs<br />
<br />
<br />
<font color="yellow"><b>Open Integration Toolkit Funtions Menu</b></font><br />
<br />
You may have noticed that Function is spelled incorrectly. I think it has come from Oracle itself. <br />
<br />
<br />
Added <b>Open Integration Toolkit Funtions Menu</b> as sub-menu to custom responsibility's menu and I was able to create project using API.<br />
<br />
<br />
<br />
<br />
Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com1tag:blogger.com,1999:blog-4761848106405556349.post-74081515547859160302018-05-21T19:28:00.000-05:002018-05-22T07:56:06.827-05:00Project API Error "Project: '&PROJECT'Organization is invalid." (PA_INVALID_ORG_AMG)<br />
I was trying to create a project using "<font color="yellow"><b>pa_project_pub.create_project</b></font>" and I got the above error. I searched for message code for the above message and found following message code<br />
<br />
<br />
PA_INVALID_ORG_AMG<br />
<br />
<br />
Then I search dba_source to see what validation package is generating the above message. I could not find any oracle code that was using this message. I knew that oracle project changes message code for some unknown reason. so I searched for PA_INVALID_ORG and fortunately I found few instances where message was 'PA_INVALID_ORG'. <br />
<br />
<br />
select * from dba_source where text like '%PA_INVALID_ORG%'; --'%PA_INVALID_ORG_AMG%';<br />
<br />
<br />
<br />
So I looked at <font color="yellow"><b>pa_project_pub</b></font>. API was validating carrying_out_organization_id using <font color="yellow"><b>pa_project_pvt.check_valid_org</b></font>. Carrying out organization had become invalid due to some setup changes. Validation performed is to check existence in table pa_all_organization and inactive_date equal to null.<br />
<br />
<br />
Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0tag:blogger.com,1999:blog-4761848106405556349.post-54390907101115156122017-12-05T19:32:00.000-06:002017-12-06T13:57:14.624-06:00Parameters of a Scheduled Request Set<br>At my site, few users have scheduled a request set with different parameters. If support staff needs to hold a particular instance of that request set then there is no ways to identify that request. Oracle does not provide a mechanism to view parameters to a scheduled request set. Many times support staff guess based on "Requested By" of request set. So I wrote following query that can give me parameters to all scheduled instances of a request set. <br><br>
In the query below, I have provision for 20 parameters only. there could be up to 100 parameters. If there are more parameters to any concurrent program of a request set, then you need to modify DECODE and add sql statements for remaining parameters.<br><br>
<textarea cols="100", rows="60" readonly="readonly" wrap="off" >
SELECT "Request Set Name"
, Request_id "Request ID"
, "Stage Seq"
, "Program Seq"
, "Concurrent Program Name"
, "Parameter Name"
, DECODE(num, 1, (SELECT argument1 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
2, (SELECT argument2 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
3, (SELECT argument3 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
4, (SELECT argument4 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
5, (SELECT argument5 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
6, (SELECT argument6 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
7, (SELECT argument7 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
8, (SELECT argument8 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
9, (SELECT argument9 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
10, (SELECT argument10 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
11, (SELECT argument12 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
12, (SELECT argument12 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
13, (SELECT argument13 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
14, (SELECT argument14 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
15, (SELECT argument15 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
16, (SELECT argument16 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
17, (SELECT argument17 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
18, (SELECT argument18 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
19, (SELECT argument19 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
20, (SELECT argument20 FROM fnd_run_requests a1 WHERE parent_request_id= a.request_id and a1.concurrent_program_id = a.concurrent_program_id),
'Add Additional Sql to get parametervalues'
) "Parameter Value"
FROM (SELECT rs.user_request_set_name "Request Set Name"
, req.request_id Request_ID
, rss.display_sequence "Stage Seq"
, rsp.sequence "Program Seq"
, cp.user_concurrent_program_name "Concurrent Program Name"
, cp_param.column_seq_num "Param Seq"
, form_left_prompt "Parameter Name"
, rs.REQUEST_SET_ID
, cp.concurrent_program_id
, row_number () over (partition by req.request_id, CP.CONCURRENT_PROGRAM_ID order by cp_param.column_seq_num )num
FROM apps.fnd_request_sets_vl rs
, apps.fnd_req_set_stages_form_v rss
, applsys.fnd_request_set_programs rsp
, apps.fnd_concurrent_programs_vl cp
, apps.fnd_descr_flex_col_usage_vl cp_param
, fnd_concurrent_requests req
, fnd_concurrent_programs rset_prog
WHERE rs.user_request_set_name LIKE '<User Request Set Name>'
AND rs.application_id = rss.set_application_id
AND rs.request_set_id = rss.request_set_id
AND rss.set_application_id = rsp.set_application_id
AND rss.request_set_id = rsp.request_set_id
AND rss.request_set_stage_id = rsp.request_set_stage_id
AND rsp.program_application_id = cp.application_id
AND rsp.concurrent_program_id = cp.concurrent_program_id
AND rs.end_date_active IS NULL
AND cp_param.descriptive_flexfield_name (+) = '$SRS$.' || cp.concurrent_program_name
AND cp_param.application_id (+) = cp.application_id
AND cp_param.enabled_flag (+) = 'Y'
AND req.concurrent_program_id = rset_prog.concurrent_program_id
AND req.program_application_id = rset_prog.application_id
AND req.phase_code = 'P'
AND rset_prog.concurrent_program_name = 'FNDRSSUB'
AND req.argument1 = to_char(rs.application_id)
AND req.argument2 = to_char(rs.request_set_id)
ORDER BY req.request_id
, rss.display_sequence
, rsp.sequence
, cp_param.column_seq_num
) a;
</textarea>Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com1tag:blogger.com,1999:blog-4761848106405556349.post-57452882834128083492017-11-07T21:07:00.000-06:002017-11-07T21:07:09.910-06:00TCA Module: Table HZ_ORGANIZATION_PROFILES has multiple ACTIVE records for a single partyIn our test instance (and in production instance too) we found that there few many cases where a party has multiple active records in table hz_organization_profiles. When party information is updated via Customer interface or UI, the existing record in hz_organization_profiles is end dated and new record is created. (If a party is created and updated on same day then new record in hz_organization_profile is not created and existing record is simply updated.). I was not able to simulate this issue. When I searched oracle support, I found following note <br/><br/>
<b>
<a href="https://support.oracle.com/epmos/faces/DocumentDisplay?id=1458368.2">Trading Community: GDF: Ensure HZ_Organization_Profiles Have Appropriate Effective_End_Date Values and Contain No Over-Lapping Date Ranges (Doc ID 2260595.1)</a></b><br/><br/>
This note provides a data fix script but does not offer permanent solution. I think this table is not used much in Oracle application that is why this bug is not fixed in last many years. I have seen this issue sometime in year 2012. <br/><br/>
Effective end date column of this table too is not being updated properly. When a new record for a party is added to this table hz_organization_profiles, existing record is updated with effective_end_date trunc(sysdate - 1) and new record have effective_start_date as sysdate. For example if you update an organization at 11/06/2017 3:43pm then old record in hz_organization_profiles will have effective end date as 11/05/2017 00:00:00 and new record will have effective start date as 11/06/2017 15:43:00. So there was no active record for organization between 11/05/2017 00:00:00 and 11/06/2017 15:42:59. If Oracle wants to use time component then use in both effective start and end dates. This pains me to see how careless is Oracle AR application development.
Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0tag:blogger.com,1999:blog-4761848106405556349.post-26985096066647963372017-11-06T21:59:00.000-06:002020-02-12T14:52:15.934-06:00Receivables Transactions WORKBENCHRecently I found following note at support.oracle.com<br/><br/>
<a href="https://support.oracle.com/epmos/faces/DocumentDisplay?id=1458368.2">Receivables Transactions WORKBENCH(Doc ID 1458368.2)</a><br/><br/>
This document provides good information setups, defaulting. document sequence numbering etc. This is very good reference for receivables module. I hope oracle keeps this document updated.<br/><br/>
The above document is not available anymore. I found this document. I don't remember if it is same or different but provides good information.<br/><br/>
<a href="https://support.oracle.com/epmos/faces/DocumentDisplay?id=220026.1">Transaction Workbench: FAQ (Doc ID 220026.1)</a><br/><br/>Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0tag:blogger.com,1999:blog-4761848106405556349.post-62856170720320220162017-04-24T19:47:00.000-05:002017-05-12T11:21:19.929-05:00Knight's Tour<br>
My son, currently in 9th grade, has been pestering me to learn Python or Java or something else instead of reading Facebook all the time. So finally I gave in and told him to setup Python on one of the old unused desktop. He installed Ubuntu, Python, some editor called "ATOM" and some linter for Python program. Python seems to be very easy. There are lots of good material available. Whatever question I had, I got answer from stack overflow. As first program in Python I wanted to try Knight's tour. It took some time but I could complete it. Here is the code for Knight's tour.
<br><br>
<textarea cols="100", rows="60" readonly="readonly" wrap="off" >
# import copy
boardPostions = []
solutionNumber = 0
def getEmptyBoard():
"""Get empty board."""
emptyBoard = [[0, 0, 0, 0, 0, 0, 0, 0], # Row number 1
[0, 0, 0, 0, 0, 0, 0, 0], # Row Number 2
[0, 0, 0, 0, 0, 0, 0, 0], # Row Number 3
[0, 0, 0, 0, 0, 0, 0, 0], # Row Number 4
[0, 0, 0, 0, 0, 0, 0, 0], # Row Number 5
[0, 0, 0, 0, 0, 0, 0, 0], # Row Number 6
[0, 0, 0, 0, 0, 0, 0, 0], # Row Number 7
[0, 0, 0, 0, 0, 0, 0, 0], # Row Number 8
[0, 0, 0]] # row and column position of knight and current move number
return emptyBoard
def printBoard(singleBoardPosition):
"""Print board postions."""
global solutionNumber
print("===", solutionNumber, singleBoardPosition[8][0], singleBoardPosition[8][1], singleBoardPosition[8][2], ":")
if singleBoardPosition[8][2] > 63:
solutionNumber = solutionNumber + 1
for i in range(8):
for j in range(8):
print("%3d" % (singleBoardPosition[i][j]), end="")
print()
def copyBoardElements(b1, b2):
"""Copy board elements."""
if b1 is None:
print("copyBoardElements, b1 is None")
if b2 is None:
print("copyBoardElements, b2 is None")
for cp1 in range(8):
for cp2 in range(8):
b1[cp1][cp2] = b2[cp1][cp2]
b1[8][0] = b2[8][0]
b1[8][1] = b2[8][1]
b1[8][2] = b2[8][2]
def canReachFrom2Squares(board):
"""Check if all empty postions can be reached from two other positions."""
#
# Function to check if board has an empty square that can not be reached from 2 or more squares
#
i = 0
j = 0
totalCannotReach = 0
if board[8][2] >= 58:
# print("Return from top line")
return True
# else:
# print('Current postion on the board is ', board[8][2])
# print("checking unreacheable squares", i, j)
for i in range(8):
for j in range(8):
canReach = 0
if board[i][j] == 0:
newRow = i+2
newCol = j+1
# print ("checking 1", newRow, newCol)
if canReach < 2 and newRow in range(0, 8) and newCol in range(0, 8) and board[newRow][newCol] == 0:
canReach = canReach+1
# print("Can reach Number-1")
#
newRow = i+2
newCol = j-1
# print ("checking 2", newRow, newCol)
if canReach < 2 and newRow in range(0, 8) and newCol in range(0, 8) and board[newRow][newCol] == 0:
canReach = canReach+1
# print("Can reach Number-2")
#
newRow = i-2
newCol = j+1
# print ("checking 3", newRow, newCol)
if canReach < 2 and newRow in range(0, 8) and newCol in range(0, 8) and board[newRow][newCol] == 0:
canReach = canReach+1
# print("Can reach Number-3")
#
newRow = i-2
newCol = j-1
# print("checking 4", newRow, newCol)
if canReach < 2 and newRow in range(0, 8) and newCol in range(0, 8) and board[newRow][newCol] == 0:
canReach = canReach+1
# print("Can reach Number-4")
#
newRow = i+1
newCol = j+2
# print("checking 5", newRow, newCol)
if canReach < 2 and newRow in range(0, 8) and newCol in range(0, 8) and board[newRow][newCol] == 0:
canReach = canReach+1
# print("Can reach Number-5")
#
newRow = i+1
newCol = j-2
# print("checking 6", newRow, newCol)
if canReach < 2 and newRow in range(0, 8) and newCol in range(0, 8) and board[newRow][newCol] == 0:
canReach = canReach+1
# print("Can reach Number-6")
#
newRow = i-1
newCol = j+2
# print("checking 7", newRow, newCol)
if canReach < 2 and newRow in range(0, 8) and newCol in range(0, 8) and board[newRow][newCol] == 0:
canReach = canReach+1
# print("Can reach Number-7")
#
newRow = i-1
newCol = j-2
# print("checking 8", newRow, newCol)
if canReach < 2 and newRow in range(0, 8) and newCol in range(0, 8) and board[newRow][newCol] == 0:
canReach = canReach+1
# print("Can reach Number-8")
#
# print("canReach value = ", canReach)
if canReach < 2:
totalCannotReach = totalCannotReach+1
if totalCannotReach > 1:
# print("all not reachable from two positions", i, j)
# printBoard(board)
return False
return True
def makeInitialMove():
"""Make initial move on the board."""
for i in range(0, 8):
for j in range(0, 8):
initBoard = getEmptyBoard()
initBoard[i][j] = 1
initBoard[8][0] = i
initBoard[8][1] = j
initBoard[8][2] = 1
boardPostions.append(initBoard)
def makeSingleMove(i, j, k, board):
"""Make knight move onthe board."""
# check if new position is in the board or out of board and postion should be empty
if i in range(0, 8) and j in range(0, 8) and board[i][j] == 0:
newBoard = getEmptyBoard()
copyBoardElements(newBoard, board)
# newBoard[8][2] = k
# before making a move, check if every position can be reached from two other postions
# no need to perform that check if knight is moving for the first time
# no need to check if knight has already traversed all blocks, goal achieved.
if k == 64 or canReachFrom2Squares(newBoard):
newBoard[i][j] = k
newBoard[8][0] = i
newBoard[8][1] = j
newBoard[8][2] = k
if k == 64:
print("Knight traversed whole board without repeating any block", end="")
printBoard(newBoard)
else: # if knight traversed all block then why put board back on the stack?
boardPostions.append(newBoard)
# else:
# printBoard(newBoard)
# print("it will make board unreachable if knight move to ", i, j, "for move number=", k)
def makeKnightmove():
"""Make knight move."""
if boardPostions[len(boardPostions)-1] is None:
return 1
currentBoardPostion = getEmptyBoard()
# copyBoardElements(currentBoardPostion, boardPostions[len(boardPostions)-1])
# # print("Removing last board")
# boardPostions.pop()
currentBoardPostion = boardPostions.pop()
row = currentBoardPostion[8][0]
col = currentBoardPostion[8][1]
moveNumber = currentBoardPostion[8][2]
makeSingleMove(row+2, col+1, moveNumber+1, currentBoardPostion)
makeSingleMove(row+2, col-1, moveNumber+1, currentBoardPostion)
makeSingleMove(row-2, col+1, moveNumber+1, currentBoardPostion)
makeSingleMove(row-2, col-1, moveNumber+1, currentBoardPostion)
makeSingleMove(row-1, col+2, moveNumber+1, currentBoardPostion)
makeSingleMove(row-1, col-2, moveNumber+1, currentBoardPostion)
makeSingleMove(row+1, col+2, moveNumber+1, currentBoardPostion)
makeSingleMove(row+1, col-2, moveNumber+1, currentBoardPostion)
# return moveNumber+1
# solutionNumber = 0
# for i in range(8):
# for j in range(8):
# # boardPostions.append(makeMove(i, j, 1, None))
# intialBoard = getEmptyBoard()
# makeSingleMove(i, j, 1, None)
print("Make initial moves. it will put 64 boards each board representing initial position of knight.")
makeInitialMove()
print("Now start making moves after initial moves.")
loop_count = 0
current_move = 1
while True:
# print("")
# print("loop number", loop_count, "Number of boards", len(boardPostions))
makeKnightmove()
loop_count = loop_count+1
if len(boardPostions) == 0:
break
</textarea>Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0tag:blogger.com,1999:blog-4761848106405556349.post-86748321508711652932017-02-15T15:31:00.000-06:002017-02-16T07:11:44.530-06:00Example of Receipt Reversal API ar_receipt_api_pub.reverse and Invoice Adjustment API ar_adjust_pub.create_adjustment <br>
I was working on a custom program to apply receipts, credit memos to invoices and debit memos. I was creating good amount of data. Before starting a new set of tests, I wanted to close transactions and payments created in prior run. It was little cumbersome to adjust invoices, Debit memos, credit memos and reverse receipts using forms. So I created this small script and run it using a simple concurrent program. This script can adjust hundreds or invoices and receipts in no time.<br><br>
<textarea rows="50" cols="120" readonly="readonly" wrap="off">
DECLARE
l_adjust_and_reverse varchar2(30) := '&1';
CURSOR c_receipts_or_invoices IS
SELECT acct.account_number
, party.party_name
, aps.trx_number
, decode(aps.class,'PMT', cash_receipt_id, payment_schedule_id) Id
, aps.class
, aps.amount_due_original
, aps.amount_due_remaining
FROM ar_payment_schedules aps
, hz_cust_accounts acct
, hz_parties party
WHERE aps.amount_due_remaining <> 0
AND aps.customer_id = acct.cust_account_id
AND acct.party_id = party.party_id
AND party.party_name like 'SANJAI%'
ORDER BY acct.account_number
, aps.trx_number
;
PROCEDURE get_error_msg IS
i number;
l_msg_data varchar2(4000);
BEGIN
IF fnd_msg_pub.count_msg > 0
THEN
FOR j in 1..FND_MSG_PUB.count_msg
LOOP
FND_MSG_PUB.get
( p_msg_index => j
, p_encoded => 'F'
, p_data => l_msg_data
, p_msg_index_out => i
);
fnd_file.put_line( fnd_file.log, 'Error: ' || j || ':' || l_msg_data);
END LOOP;
END IF;
END get_error_msg;
--
--
PROCEDURE reverse_receipt
( p_cash_receipt_id number
) IS
l_ret_status VARCHAR2(1);
l_msg_count NUMBER;
l_msg_data VARCHAR2(32000);
BEGIN
ar_receipt_api_pub.reverse(
-- Standard API parameters.
p_api_version => 1.0
, p_init_msg_list => FND_API.G_TRUE
, p_commit => FND_API.G_FALSE
, p_validation_level => FND_API.G_VALID_LEVEL_FULL
, x_return_status => l_ret_status
, x_msg_count => l_msg_count
, x_msg_data => l_msg_data
-- Receipt reversal related parameters
, p_cash_receipt_id => p_cash_receipt_id
, p_receipt_number => NULL
, p_reversal_category_code => 'NSF'
, p_reversal_category_name => NULL
, p_reversal_gl_date => NULL
, p_reversal_date => NULL
, p_reversal_reason_code => 'NSF'
, p_reversal_reason_name => NULL
, p_reversal_comments => NULL
, p_called_from => NULL
, p_attribute_rec => AR_RECEIPT_API_PUB.attribute_rec_const
, p_global_attribute_rec => AR_RECEIPT_API_PUB.global_attribute_rec_const
, p_cancel_claims_flag => 'Y'
, p_org_id => fnd_global.org_id
) ;
get_error_msg;
FND_FILE.PUT_LINE(FND_FILE.LOG, 'Return Status for receipt id (' || p_cash_receipt_id || ') = ' || l_ret_status);
FND_FILE.PUT_LINE(FND_FILE.LOG, ' ');
END;
--
--
PROCEDURE adjust_transaction
( p_payment_schedule_id NUMBER
) IS
l_msg_count NUMBER;
l_msg_data VARCHAR2(32000);
l_ret_status VARCHAR2(1);
l_adj_rec ar_adjustments_all % ROWTYPE ;
l_adj_num ar_adjustments_all.adjustment_number % TYPE;
l_adj_id ar_adjustments_all.adjustment_id % TYPE;
l_old_adj_id ar_adjustments_all.adjustment_id % TYPE;
BEGIN
l_adj_rec.type := 'INVOICE';
l_adj_rec.payment_schedule_id := p_payment_schedule_id;
l_adj_rec.receivables_trx_id := 3026;
l_adj_rec.apply_date := trunc(sysdate);
l_adj_rec.gl_date := trunc(sysdate);
l_adj_rec.created_from := 'SKM_SCRIPT';
ar_adjust_pub.create_adjustment (
p_api_name => 'AR_ADJUST_PUB'
, p_api_version => 1.0
, p_init_msg_list => FND_API.G_TRUE
, p_commit_flag => FND_API.G_FALSE
, p_validation_level => FND_API.G_VALID_LEVEL_FULL
, p_msg_count => l_msg_count
, p_msg_data => l_msg_data
, p_return_status => l_ret_status
, p_adj_rec => l_adj_rec
, p_chk_approval_limits => FND_API.G_TRUE
, p_check_amount => FND_API.G_TRUE
, p_move_deferred_tax => NULL
, p_new_adjust_number => l_adj_num
, p_new_adjust_id => l_adj_id
, p_called_from => 'SKM_TEST_SCRIPT'
, p_old_adjust_id => l_old_adj_id
, p_org_id => fnd_global.org_id
) ;
get_error_msg;
FND_FILE.PUT_LINE(FND_FILE.LOG, 'Return Status = ' || l_ret_status || ', Adjustment ID = ' || l_adj_id);
FND_FILE.PUT_LINE(FND_FILE.LOG, ' ');
END adjust_transaction;
--
--
BEGIN
-- create_ar_invoice;
FND_FILE.PUT_LINE(FND_FILE.LOG, 'Following Transactions will be Adjusted or Reversed');
FND_FILE.PUT_LINE(FND_FILE.LOG,'');
FND_FILE.PUT_LINE(FND_FILE.LOG, 'Account number Party Name Trx Number ID Class Amt Due Orig Amt');
FND_FILE.PUT_LINE(FND_FILE.LOG, '=====================================================================================================================');
FOR l_rec IN c_receipts_or_invoices
LOOP
FND_FILE.PUT_LINE(FND_FILE.LOG, rpad(l_rec.account_number , 20,' ') || ' ' ||
rpad(substr(l_rec.party_name,1,30), 30,' ') || ' ' ||
rpad(substr(l_rec.trx_number,1,20), 20,' ') || ' ' ||
to_char(l_rec.id,'999999999') || ' ' ||
rpad(substr(l_rec.class ,1, 5), 5,' ') || ' ' ||
to_char(l_rec.amount_due_remaining,'999999999.99') || ' ' ||
to_char(l_rec.amount_due_original ,'999999999.99')
);
IF l_adjust_and_reverse = 'Y'
THEN
IF l_rec.class = 'PMT'
THEN
reverse_receipt(l_rec.id);
ELSE
adjust_transaction(l_rec.id);
END IF;
END IF;
END LOOP;
END;
/
</textarea>
Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0tag:blogger.com,1999:blog-4761848106405556349.post-8266735930983240802016-10-13T21:06:00.000-05:002016-10-14T11:42:12.809-05:00Determination of Default Receipt Application GL Date<ol type="1">
<li> Check the value of profile option "AR: Application GL Date Default"<br><br></li>
<ol type="a">
<li>If this profile option is equal to “INV_REC_SYS_DT”, then Receipt application GL date is largest of <br><br></li>
<ol type="i">
<li>Receipt GL Date<br><br></li>
<li>Invoice GL Date<br><br></li>
<li>System Date<br><br></li>
</ol>
<li>If this profile option is equal to NULL or INV_REC_DT then Receipt application GL date is largest of<br><br></li>
<ol type="i">
<li>Receipt GL Date<br><br></li>
<li>Invoice GL Date<br><br></li>
</ol>
</ol>
<li>If Receipt Application Date is in CLOSED GL Period then<br><br></li>
<ol type="i">
<li>Get the minimum value of START_DATE from GL_PERIOD_STATUS for the application, set of books such that period status is either ‘O’ or ‘N’ or ‘F’<br><br></li>
</ol>
<li>The GL Date for receipt application is derived using <font color="yellow"><b> ARP_UTIL.VALIDATE_AND_DEFAULT_GL_DATE</b></font>. If there is any need to default GL is custom program then this procedure can be used. This procedure checks if input date is valid or not. If input GL date is not valid then it provides next available GL date. For example suppose Receipt and AR Invoice GL dates are 20-Sep-2016 and period SEP-2016 is closed than this procedure will provide first date of next open period. I have not tested what happens if no period is open. I think it is highly unlikely that no GL period is open receivables.<br><br></li>
</ol>
Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0tag:blogger.com,1999:blog-4761848106405556349.post-70633612648733296052016-10-05T21:17:00.000-05:002016-10-07T11:18:29.837-05:00Purchasing API Example: PO_CHANGE_API1_S.update_po<br>
I had to modify deliver to location and PO distribution DFF on multiple purchase orders. All those purchase orders had "Authorization Status" as "Approved". I thought of using Oracle Purchasing API <font color="yellow"><b>PO_CHANGE_API1_S.update_po</font></b>. It was not easy to use this API for following reasons.
<ol>
<li>API did not allow update of Deliver to location although Purchase Orders form allows update of deliver to location.</li><br>
<li>Handling of DFF update has bugs. When I updated flexfield, I got following error<br>
The flexfield on this field contains a flexfield bind variable with a :BLOCK.FIELD reference. This prohibits operation in the mode that optimizes performance over a wide-area network.
To continue using this form, have the system administrator either remove all :BLOCK.FIELD references, or turn off wide area operation by setting the profile option - Flexfields: Validate on Server to N. The reference may be in a WHERE_CLAUSE token passed into the flexfield definition in the form, a WHERE clause in a table-validated value set, or a default value for one of the segments of this flexfield.<br><br>
We could not update PO distribution DFF to remove :block.field references. By setting profile option "Flexfields:Validate On Server" to "No" did not help. Refer to <a href="https://support.oracle.com/epmos/faces/DocumentDisplay?id=273044.1">FLEXFIELDS: Validate on Server Profile Option (Doc ID 273044.1)</a> for more information on this profile option.
</li>
</ol>
Since I had created a test script so I tried to see how it works by updating PO description, item description.<br><br>
Updating PO Line quantity worked very well. When I updated line quantity, it updated shipment quantity and distribution quantity too. I was thinking that I have provide these values in shipment and distribution records.
Sample is given below. If you a better way to initialize TYPE <font color="Yellow"><b> PO_PUB_UPDATE_REC_TYPE</font></b>, please let me know.
<br><br>
<textarea rows="50" cols="100" readonly="readonly" wrap="off">
DECLARE
CURSOR c_dists_to_update IS
SELECT pod.po_distribution_id
, pod.distribution_num
, pod.line_location_id
, pll.shipment_num
, pod.po_line_id
, pol.line_num
, pod.po_header_id
, poh.org_id
, poh.segment1
, pod.attribute1 pod_attr1
, pod.attribute2 pod_attr2
, 'SKM_LOCATION' new_location_code /* New Location code was determined using subquery and must exist in hr_locations */
FROM po_distributions_all pod
, po_headers_all poh
, po_lines_all pol
, po_line_locations_all pll
WHERE poh.po_header_id = pod.po_header_id
AND pol.po_line_id = pod.po_line_id
AND pll.line_location_id = pod.line_location_id
AND poh.segment1 LIKE 'SKM-20161005-0%'
;
TYPE varchar2_table IS TABLE OF VARCHAR2(150) INDEX BY BINARY_INTEGER;
TYPE number_table IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
l_attr13 VARCHAR2_TABLE;
l_attr13_new VARCHAR2_TABLE;
l_line_location_id NUMBER_TABLE;
l_distribution_id NUMBER_TABLE;
l_hr_location_id NUMBER_TABLE;
l_rec_count NUMBER;
l_po_rec PO_PUB_UPDATE_REC_TYPE;
l_errors PO_API_ERRORS_REC_TYPE;
l_ret_status VARCHAR2(240);
PROCEDURE update_po
( p_po_header_id NUMBER
, p_segment1 VARCHAR2
, p_org_id NUMBER
, p_line_num NUMBER
, p_shipment_num NUMBER
, p_distribution_num NUMBER
, p_new_location_code VARCHAR2
) IS
BEGIN
l_po_rec := po_pub_update_rec_type ( po_header_id => null
, po_number => null
, run_submission_checks => null
, launch_approvals_flag => null
, org_id => null
, approval_background_flag => null
, po_header_changes => PO_PUB_HEADER_REC_TYPE
( buyer_name => null
, fob_lookup_code => null
, payment_terms => null
, description => null
, attribute_category => null
, attribute1 => null
, attribute2 => null
, attribute3 => null
, attribute4 => null
, attribute5 => null
, attribute6 => null
, attribute7 => null
, attribute8 => null
, attribute9 => null
, attribute10 => null
, attribute11 => null
, attribute12 => null
, attribute13 => null
, attribute14 => null
, attribute15 => null
, attribute16 => null
, attribute17 => null
, attribute18 => null
, attribute19 => null
, attribute20 => null
, po_line_changes => PO_PUB_LINE_TAB_TYPE
( PO_PUB_LINE_REC_TYPE
( line_num => null
, line_type => null
, item_category => null
, unit_price => null
, vendor_product_num => null
, quantity => null
, amount => null
, unit_of_measure => null
, secondary_quantity => null
, preferred_grade => null
, item_desc => null
, attribute_category => null
, attribute1 => null
, attribute2 => null
, attribute3 => null
, attribute4 => null
, attribute5 => null
, attribute6 => null
, attribute7 => null
, attribute8 => null
, attribute9 => null
, attribute10 => null
, attribute11 => null
, attribute12 => null
, attribute13 => null
, attribute14 => null
, attribute15 => null
, attribute16 => null
, attribute17 => null
, attribute18 => null
, attribute19 => null
, attribute20 => null
, po_line_loc_changes => PO_PUB_LINE_LOC_TAB_TYPE
( PO_PUB_LINE_LOC_REC_TYPE
( shipment_num => null
, quantity => null
, amount => null
, promised_date => null
, need_by_date => null
, ship_to_location_code => null
, split_shipment_num => null
, new_split_ship_num => null
, qty_rcv_tolerance => null
, attribute_category => null
, attribute1 => null
, attribute2 => null
, attribute3 => null
, attribute4 => null
, attribute5 => null
, attribute6 => null
, attribute7 => null
, attribute8 => null
, attribute9 => null
, attribute10 => null
, attribute11 => null
, attribute12 => null
, attribute13 => null
, attribute14 => null
, attribute15 => null
, attribute16 => null
, attribute17 => null
, attribute18 => null
, attribute19 => null
, attribute20 => null
, po_dist_changes => PO_PUB_DIST_TAB_TYPE
( PO_PUB_DIST_REC_TYPE
( distribution_num => null
, deliver_to_location_code => null
, project => null
, task_name => null
, expenditure_type => null
, expenditure_organization => null
, expenditure_item_date => null
, award_number => null
, end_item_unit_number => null
, quantity_ordered => null
, split_distribution_num => null
, new_split_dist_num => null
, amount_ordered => null
, attribute_category => null
, attribute1 => null
, attribute2 => null
, attribute3 => null
, attribute4 => null
, attribute5 => null
, attribute6 => null
, attribute7 => null
, attribute8 => null
, attribute9 => null
, attribute10 => null
, attribute11 => null
, attribute12 => null
, attribute13 => null
, attribute14 => null
, attribute15 => null
, attribute16 => null
, attribute17 => null
, attribute18 => null
, attribute19 => null
, attribute20 => null
)
)
)
)
)
)
)
) ;
l_po_rec.po_header_id := p_po_header_id;
l_po_rec.org_id := p_org_id;
l_po_rec.launch_approvals_flag := fnd_api.g_true;
l_po_rec.po_header_changes.description := 'Update on ' || to_char(sysdate,'DD-MON-YYYY HH24:MI:SS');
l_po_rec.po_header_changes.attribute1 := 'ABC';
l_po_rec.po_header_changes.attribute3 := '2015/01/01 00:00:00';
l_po_rec.po_header_changes.attribute4 := '2018/12/31 00:00:00';
l_po_rec.po_header_changes.po_line_changes(1).line_num := p_line_num;
l_po_rec.po_header_changes.po_line_changes(1).quantity := 65;
l_po_rec.po_header_changes.po_line_changes(1).item_desc := 'Item Desc ' || to_char(sysdate,'DD-MON-YYYY HH24:MI:SS');
l_po_rec.po_header_changes.po_line_changes(1).po_line_loc_changes(1).shipment_num := p_shipment_num;
l_po_rec.po_header_changes.po_line_changes(1).po_line_loc_changes(1).ship_to_location_code := p_new_location_code;
l_po_rec.po_header_changes.po_line_changes(1).po_line_loc_changes(1).po_dist_changes(1).distribution_num := p_distribution_num;
/*
API does not allow update of deliver to location if authroiztion status is other than Incomplete. Although Purchase Order form allows
update of deliver to location. Form does not allow update of shipto lication but API allows that. This behavior is weird because
Form and API should behace same.
l_po_rec.po_header_changes.po_line_changes(1).po_line_loc_changes(1).po_dist_changes(1).deliver_to_location_code := p_new_location_code ;
l_po_rec.po_header_changes.po_line_changes(1).po_line_loc_changes(1).po_dist_changes(1).attribute13 := 'aaaaaaaa wwwww~187TS5' ;
l_po_rec.po_header_changes.po_line_changes(1).po_line_loc_changes(1).po_dist_changes(1).attribute1 := l_dist_rec.pod_attr1;
l_po_rec.po_header_changes.po_line_changes(1).po_line_loc_changes(1).po_dist_changes(1).attribute2 := l_dist_rec.pod_attr2;
*/
fnd_file.put_line( fnd_file.log, p_segment1 || ' ' || to_char(p_line_num,'99999999999') || ' ' ||
to_char(p_shipment_num,'99999999') || ' ' || to_char(p_distribution_num,'999999999999') || ' '
) ;
PO_CHANGE_API1_S.update_po
( p_api_version => 1.0
, p_init_msg_list => 'T'
, x_return_status => l_ret_status
, p_changes => l_po_rec
, x_api_errors => l_errors
);
IF l_errors IS NOT NULL
THEN
FOR i in 1..l_errors.message_name.COUNT
LOOP
fnd_file.put_line(fnd_file.log, 'Message name = ' || l_errors.message_name(i));
fnd_file.put_line(fnd_file.log, 'Message text = ' || l_errors.message_text(i));
END LOOP;
END IF;
END update_po;
--
-- Begin of main pl/sql block
--
BEGIN
FOR l_dist_rec IN c_dists_to_update
LOOP
update_po
( l_dist_rec.po_header_id
, l_dist_rec.segment1
, l_dist_rec.org_id
, l_dist_rec.line_num
, l_dist_rec.shipment_num
, l_dist_rec.distribution_num
, l_dist_rec.new_location_code
) ;
END LOOP;
END;
/
</textarea>
Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com3tag:blogger.com,1999:blog-4761848106405556349.post-12787836583136200262016-09-08T21:34:00.000-05:002017-07-03T09:57:58.281-05:00Log and Output Files of Concurrent Requests<br/>I do not perform user acceptance testing but recently I had to help users with acceptance testing. I was supposed to run a request set and save log files and output files. That request set had 38 concurrent programs and users wanted to save 20 log and output files. It was painful to save log and output files. So I created this small script that can save log and output files for all requests.
This script should be modified for
<ol>
<li>Username who ran the request sets</li>
<li>Request set run start and end time</li>
<li>Test Case Number (It is used for group results of a request set run, it could be Request Set request id too)</li>
<li>Directory name where file should be copied</li>
</ol>
The output of this script can be transferred to shell script and by executing that shell script, log and output files can be copied to desired directory.
<br><br>
<textarea cols="100" rows="30" readonly="readonly" wrap="off">
DECLARE
l_outfile_suffix varchar2(30);
l_test_case_id varchar2(15) := 'TestCase01_' ;
l_dir varchar2(60) := '/home/myid/tmp';
l_user_name varchar2(30) := 'myOracleUserName';
l_start_time varchar2(30) := '07-SEP-2016 14:23:51';
l_end_time varchar2(30) := '07-SEP-2016 20:23:51';
CURSOR c_req IS
SELECT req.logfile_name
, nvl(( SELECT file_name
FROM fnd_conc_req_outputs
WHERE concurrent_request_id = req.request_id
), outfile_name
) outfile_name
, translate(prog.user_concurrent_program_name, ' '|| chr(38), '_-') name
, req.request_id
FROM apps.fnd_concurrent_programs_vl prog
, apps.fnd_concurrent_requests req
, apps.fnd_responsibility_vl resp
, apps.fnd_user usr
WHERE prog.concurrent_program_id = req.concurrent_program_id
AND prog.application_id = req.program_application_id
AND req.responsibility_id = resp.responsibility_id
AND req.responsibility_application_id = resp.application_id
AND req.requested_by = usr.user_id
AND usr.user_name = l_user_name
AND req.actual_start_date BETWEEN to_date(l_start_time, 'dd-mon-yyyy hh24:mi:ss')
AND to_date(l_end_time , 'dd-mon-yyyy hh24:mi:ss')
--
-- The condition below will remove request set stages. Request set stage log files do not have
-- any relevant information for user acceptance
--
AND prog.user_concurrent_program_name NOT LIKE '%Request%Set%Stage'
ORDER BY req.actual_start_date
;
BEGIN
FOR l_req in c_req
LOOP
l_outfile_suffix := substr(l_req.outfile_name, instr(l_req.outfile_name, '.'));
IF l_outfile_suffix = '.out'
THEN
l_outfile_suffix := '_out.txt';
END IF;
dbms_output.put_line('cp ' || l_req.logfile_name || ' ' || l_dir || '/' || l_test_case_id || l_req.request_id || '_' || l_req.name || '_log.txt' || ';');
dbms_output.put_line('if [[ -e ' || l_req.outfile_name || ' ]] && [[ -s ' || l_req.outfile_name || ' ]] ; then' );
dbms_output.put_line('cp ' || l_req.outfile_name || ' ' || l_dir || '/' || l_test_case_id || l_req.request_id || '_' || l_req.name|| l_outfile_suffix || ';');
dbms_output.put_line('fi');
END LOOP;
dbms_output.put_line('zip ' || l_test_case_id || ' *.*' );
dbms_output.put_line('rm ' || l_test_case_id || '*.txt');
dbms_output.put_line('rm ' || l_test_case_id || '*.PDF');
END;
</textarea>Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0tag:blogger.com,1999:blog-4761848106405556349.post-35308147572852047942016-07-21T20:52:00.000-05:002016-08-03T08:15:31.315-05:00Receivables AutoInvoiceThis is a great oracle document about Autoinvoice. <br><br>
AutoInvoice Setup for Release 12: A Case Study Using a Simple Script
<a href="https://support.oracle.com/epmos/faces/DocumentDisplay?id=1067402.1">metalink note [ID 1067402.1](Doc ID 1067402.1)</a><br><br>
I feel Oracle should have provided validation of DFF for invoice header, lines and distributions tables. In this way invoice lines/distributions with invalid DFF would have remained in interface tables and users can update them and import in the next run of autoinvoice.
<br>Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0tag:blogger.com,1999:blog-4761848106405556349.post-83216153616977501842016-07-16T11:25:00.000-05:002016-07-16T11:25:01.967-05:00Query for Imported AR Invoices<br>
We import Receivable Invoices using AutoInvoice interface. AutoInvoice program displays total number of invoices imported and errors if any. It does not tell what invoices were imported. So i wrote this simple query to find out invoices imported. This query works because oracle has provided index on creation date column of RA_CUSTOMER_TRX_ALL table. This sample query returns invoices that were created on 8th Jul between 7:25 and 8:50 am. <br><br>
<textarea cols="100" rows="30" readonly="readonly">
select rct.trx_number
, rct.interface_header_attribute2 Source_TRXN
, ctt.name
, hca.account_number
, site.location
, line.description
, line.unit_selling_price
, line.quantity_invoiced
, line.uom_code
, dist.amount
, dist.account_class
, gcc.segment1 || '.' || gcc.segment2 || '.' || gcc.segment3 gl_account
, dist.attribute1
, dist.attribute2
, rct.customer_trx_id
, dist.cust_trx_line_gl_dist_id
, rct.creation_date
from ra_customer_trx rct
, ra_customer_trx_lines line
, ra_cust_trx_line_gl_dist dist
, hz_cust_accounts hca
, hz_cust_site_uses site
, ra_cust_trx_types ctt
, gl_code_combinations gcc
where rct.creation_date between to_date('08-JUL-16 07:25', 'DD-MON-YY HH24:MI')
and to_date('08-JUL-16 08:50', 'DD-MON-YY HH24:MI')
and rct.customer_trx_id = dist.customer_trx_id
and dist.customer_trx_line_id = line.customer_trx_line_id (+)
and rct.cust_trx_type_id = ctt.cust_trx_type_id
and rct.bill_to_customer_id = hca.cust_account_id
and rct.bill_to_site_use_id = site.site_use_id
and dist.code_combination_id = gcc.code_combination_id
order by rct.creation_date
, rct.trx_number
, hca.account_number
;
</textarea>Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com1tag:blogger.com,1999:blog-4761848106405556349.post-74871543775211879492016-06-25T21:05:00.000-05:002016-06-25T21:05:05.623-05:00Query for Application of Receipts/Credit Memos to Invoices/Debit MemosI have a custom pl/sql program that applied credit memos and receipts to invoices and debit memos. At the end of program i wanted to see what has been applied to what. Receipt UI was not very good for viewing All applications. So i wrote query to check how receipts and credit memos are applied to invoices and debit memos.<br><br>
I noticed that when a receipt is applied to invoice or debit memo, APPLY_DATE in AR_RECEIVABLES_APPLICATIONS table has no time component but when a credit memo is applied to invoice or debit memo, it has time component.<br><br>
This query tells me what has been applied on 13th Jun 2016 between 8 am to 10 am. If APPLY_DATE for receipt application had time component, there would not be any need for condition of creation_date column. I can not use only creation date because there is no index on this column.<br>
<textarea cols="100" rows="25" readonly="readonly" wrap="no_wrap">
select rct.trx_number "INV Number"
, ctt_inv.name "Invoice Type"
, ps_cm.trx_number "CM/RCPT Number"
, ctt_cm.name "CM/Receipt Type"
, ps_inv.amount_due_original "INV Amount"
, ps_cm.amount_due_original *-1 "CM/RCPT Amount"
, app.amount_applied "Amt Applied"
, ps_inv.amount_due_remaining "INV Amt Due"
, ps_cm.amount_due_remaining *-1 "CM/RCPT Amt Due"
, site_inv.location "INV Loc"
, site_cm.location "CM/RCPT Loc"
, app.receivable_application_id "ID"
, app.creation_date
from ar_receivable_applications app
, ra_customer_trx rct
, ar_payment_schedules ps_cm
, ar_payment_schedules ps_inv
, ra_cust_trx_types ctt_inv
, ra_cust_trx_types ctt_cm
, hz_cust_site_uses site_inv
, hz_cust_site_uses site_cm
where apply_date between to_date('13-Jun-2016 08:00','DD-MON-YYYY HH24:MI')
and to_date('13-Jun-2016 10:10','DD-MON-YYYY HH24:MI')
and app.creation_date between to_date('13-Jun-2016 08:00','DD-MON-YYYY HH24:MI')
and to_date('13-Jun-2016 10:00','DD-MON-YYYY HH24:MI')
/*
and app.status = 'APP'
*/
and app.application_type = 'CM'
and app.applied_customer_trx_id = rct.customer_trx_id
and app.payment_schedule_id = ps_cm.payment_schedule_id
and rct.cust_trx_type_id = ctt_inv.cust_trx_type_id
and ps_cm.cust_trx_type_id = ctt_cm.cust_trx_type_id
and rct.customer_trx_id = ps_inv.customer_trx_id
and ps_inv.customer_site_use_id = site_inv.site_use_id
and ps_cm.customer_site_use_id = site_cm.site_use_id
union
select inv.trx_number
, ctt_inv.name
, rcpt.receipt_number
, rm.name
, ps_inv.amount_due_original
, ps_rcpt.amount_due_original *-1
, app.amount_applied
, ps_inv.amount_due_remaining
, ps_rcpt.amount_due_remaining *-1
, site_inv.location inv_loc
, site_rcpt.location rcpt_location
, app.receivable_application_id
, app.creation_date
from ar_receivable_applications app
, ar_cash_receipts rcpt
, ar_payment_schedules ps_rcpt
, ra_customer_trx inv
, ar_payment_schedules ps_inv
, ra_cust_trx_types ctt_inv
, ar_receipt_methods rm
, hz_cust_site_uses site_inv
, hz_cust_site_uses site_rcpt
where app.apply_date = to_date('13-Jun-2016','DD-MON-YYYY')
and app.creation_date between to_date('13-Jun-2016 08:00','DD-MON-YYYY HH24:MI')
and to_date('13-Jun-2016 10:00','DD-MON-YYYY HH24:MI')
and app.applied_customer_trx_id = inv.customer_trx_id
and app.cash_receipt_id = rcpt.cash_receipt_id
and inv.cust_trx_type_id = ctt_inv.cust_trx_type_id
and app.payment_schedule_id = ps_rcpt.payment_schedule_id
and app.applied_payment_schedule_id = ps_inv.payment_schedule_id
and rcpt.receipt_method_id = rm.receipt_method_id
and inv.bill_to_site_use_id = site_inv.site_use_id
and rcpt.customer_site_use_id = site_rcpt.site_use_id
/*
and app.status = 'APP'
*/
and app.application_type = 'CASH'
order by 1, creation_date, ID
;
</textarea>Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com1tag:blogger.com,1999:blog-4761848106405556349.post-4578137097130411522016-03-04T11:55:00.000-06:002016-03-04T11:55:52.107-06:00Poor Performance of Posting: Single Ledger: Query#1We were upgrading to Oracle database 12c. During regression testing we found that following sql is running very poorly for some JV Batches. Query is given below.
If you look at the query you would notice that POSTING_RUN_ID is hard coded. It means this is a dynamic sql and Oracle developer had appended POSTING_RUN_ID to the query instead of using a bind variable. Biggest drawback of hard coded value: Every time sql is different, it has different sql_id, plan hash value and i can not pin a sqlplan for this query.
This query works fine when a JE header has less number of lines. In our case it does not work very well when one header has 200k lines. it trying to access GL_JE_LINES using unique index but LINE_NUM is not used in the query so it ends up accessing 200K for each Header record and hence slow performance.
following bug were filed longtime back but no resolution
<br><br>
Bug 6415832: No resolution<br><br>
Bug 7044466: No resolution. As per this bug customer suggested creating a new index on JE_HEADER_ID, CODE_COMBINATION_ID and asked Oracle's blessing but i think it was not approved because no such index in Rel12.1.3. To solve our problem in PROD, we are thinking about creating an index on CODE_COMBINATION_ID , PERIOD_NAME and JE_HEADER_ID. This index works great for us.<br><br>
I wonder what is the use of where clause in this query? Subquery has same where clause. So if record in not found pi.period_net_dr and pi.period_net_dr will be just overwritten. <font color="yellow"><b>Am i right?</b></font>
<br><br>
<textarea cols="100" rows="30" readonly="readonly" wrap="off">
UPDATE GL_POSTING_INTERIM PI
SET (PI.period_net_dr,
PI.period_net_cr) =
(SELECT nvl(PI.period_net_dr,0) +
nvl(sum(decode(JEL.period_name, PI.period_name,
decode(sign(JEL.stat_amount), 1,
abs(JEL.stat_amount),
0 ), 0 )), 0),
nvl(PI.period_net_cr,0) +
nvl(sum(decode(JEL.period_name, PI.period_name,
decode(sign(JEL.stat_amount), 1,
0,
abs(JEL.stat_amount)),
0 )), 0)
FROM GL_JE_BATCHES JEB,
GL_JE_HEADERS JEH,
GL_JE_LINES JEL
WHERE JEB.status = 'I'
AND JEB.chart_of_accounts_id = 50225
AND JEB.posting_run_id = 229329
AND JEB.average_journal_flag = 'N'
AND JEH.je_batch_id = JEB.je_batch_id
AND JEH.status != 'P'
AND JEL.je_header_id = JEH.je_header_id
AND nvl(JEL.status,'U') = 'U'
AND JEL.stat_amount is not null
AND PI.ledger_id = JEH.ledger_id
AND PI.code_combination_id = JEL.code_combination_id
AND PI.actual_flag = JEH.actual_flag
AND PI.period_name = JEL.period_name
AND PI.currency_code = 'STAT'
AND nvl(PI.budget_version_id, -1) =
nvl(JEH.budget_version_id, -1)
AND nvl(PI.encumbrance_type_id, -1) =
nvl(JEH.encumbrance_type_id, -1)
GROUP BY JEH.ledger_id,
JEH.actual_flag,
JEH.encumbrance_type_id,
JEH.budget_version_id,
JEL.period_name,
JEL.code_combination_id)
WHERE (PI.ledger_id,
PI.actual_flag,
nvl(PI.budget_version_id, -1),
nvl(PI.encumbrance_type_id, -1),
PI.currency_code,
PI.period_name,
PI.code_combination_id) IN
(SELECT JEH2.ledger_id,
JEH2.actual_flag,
nvl(JEH2.budget_version_id, -1),
nvl(JEH2.encumbrance_type_id, -1),
'STAT',
JEH2.period_name,
JEL2.code_combination_id
FROM GL_JE_BATCHES JEB2,
GL_JE_HEADERS JEH2,
GL_JE_LINES JEL2
WHERE JEB2.status = 'I'
AND JEB2.chart_of_accounts_id = 50225
AND JEB2.posting_run_id = 229329
AND JEB2.average_journal_flag = 'N'
AND JEH2.je_batch_id = JEB2.je_batch_id
AND JEL2.je_header_id = JEH2.je_header_id
AND nvl(JEL2.status,'U') = 'U'
AND JEL2.stat_amount is not null)
</textarea>
Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0tag:blogger.com,1999:blog-4761848106405556349.post-24869357326409687402016-03-01T19:44:00.000-06:002016-03-02T11:56:49.038-06:00Oracle Alert Creation ExampleI had created one alert long time back and few days back i had to test one alert and I did not remember anything, So read the <a href="https://docs.oracle.com/cd/B34956_01/current/acrobat/120alrug.pdf">this document </a>and noted following points for future reference.
<ol>
<li>Responsibility: Alert Manager</li><br>
<li>Navigation: Alert -> Define</li><br>
<li>You will see following form (with all fields balnk)<br><br>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRL4jZ0JH8KoeAFRiIgGonbJc5c7Clm2VZ9LwNtPgi3LxrtrwanYUXsXNdF_YeyO7wIG-U4pzG63OVLssUwe7gfKHRfQxM4D4XcVS2VWvzZahP_N5igT_zhkhT7Tq8bLS4wnbyy2zTzv5O/s1600/CreateAlert.png" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRL4jZ0JH8KoeAFRiIgGonbJc5c7Clm2VZ9LwNtPgi3LxrtrwanYUXsXNdF_YeyO7wIG-U4pzG63OVLssUwe7gfKHRfQxM4D4XcVS2VWvzZahP_N5igT_zhkhT7Tq8bLS4wnbyy2zTzv5O/s700/CreateAlert.png" /></a>
</li><br>
<li>Periodic tab has information for concurrent program "Periodic Alert Scheduler". "Periodic Alert Scheduler" will schedule a concurrent program to run the alert based on Frequency column value. <br><br>
Concurrent program name will be Alert Name + ' ' + (Check Periodic Alert). <br><br>
Start Time, End Time and Check Interval are used for running it multiple times in a day starting at "Stat Time and ending at "End Time" at an interval given by "Check Interval" Value. Suppose an alert is defined to run "Every 1 Calendar Days" and start time, end time and check interval are 00:00:00, 9:00:00 and 01:00:00 and "Periodic Alert Scheduler" is scheduled to run everyday at 7 am, then Alert will run between 7 am to 9 pm every 1 hours. Three times in this case. If "Periodic Alert Scheduler" was scheduled to run at 12 am everyday then this alert will run 10 times every day (12 am to 9 am). In this particular case i had changed the schedule of "Periodic Alert Scheduler" to start at 7am and run indefinitely. <br><br>
If "Periodic Alert Scheduler" is not running then any alert will not be run. This may happen in development environment so that users do not get unnecessary alert about test data or developer can change the email change the alert recipient's email address </li><br>
<li>Import Button: If you do not want to cut and paste query from a file or sql developer, you can use this button to enter sql statement for Alert</li><br>
<li>Export Button: If you do not want to use cut and paste, you can use this button to save query to a file</li><br>
<li>Verify Button: Use this button to check for syntax errors</li><br>
<li>Run Button: Use this button to know how many rows will be returned.</li><br>
<li>Actions Button: It seems results of sql statement is called EXCEPTION. Based on results of the query you may want to<br><br>
<ol type="i">
<li>If Query returns No rows then it is a case of "NO Exception" and you may take an action such as send email that informing alert recipient that No results were found. it may be good or bad. For example if no orders were shipped yesterday then it is bad and if no concurrent programs failed yesterday, it is good</li><br>
<li>If query returns some result then you may send "Summary" action i.e. send one email providing results of sql statements </li><br>
<li>If query returns some results then you may send "Detail" action i.e. send alert for each row of query result. For example, Alert query may identify users whose password will expire within N days. Detail action can send email to each user separately and request them to change password. </li><br>
</ol>
Each action can be of following 4 types<br><br>
<ol type="i">
<li>Message</li><br>
<li>Concurrent Program </li><br>
<li>Operating system Script</li><br>
<li>Sql Statement Script </li><br>
</ol>
i have use only "Message" action type. For "Message" action type, you need to fill in detail like Email Address for alert recipient, subject and Layout for Query output.
</li><br>
<li>Action Sets Button: Any of the "Actions" created in previous step will not do anything unless included in some action set.
In Members tab in Action Set Detail form, you may added actions created in previous step.
</li><br>
<li>Response Set Button: Did not use it</li><br>
<li>Alert Details Button: In this form you can define operating unit for Alert. If i available under table "Installations" I did not change Oracle ID value, it was displayed by default as APPS </li><br>
</ol>Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com2tag:blogger.com,1999:blog-4761848106405556349.post-7092126543992239012016-01-04T19:23:00.000-06:002016-01-05T08:14:04.440-06:00Customer Bank Account DetailsBank account can be associated with customer account or customer site. This query can find all bank accounts associated with a customer and it's sites<br><br>
<textarea cols="100" rows="30" readonly="readonly" wrap="off">
SELECT ca.account_number "Customer Account Number"
, null "Site address"
, piu.start_date "Bank Account Use Start Date"
, piu.end_date "Bank Account Use End Date"
, eba.bank_account_num "Bank Account Number"
, eba.bank_account_name "Bank Account Name"
, eba.start_date "Bank Account Start Date"
, eba.end_date "Bank Account End Date"
FROM hz_cust_accounts ca
, iby_external_payers_all epa
, iby_pmt_instr_uses_all piu
, iby_ext_bank_accounts eba
WHERE ca.cust_account_id = epa.cust_account_id
AND piu.ext_pmt_party_id = epa.ext_payer_id
AND piu.payment_function = 'CUSTOMER_PAYMENT'
AND eba.ext_bank_account_id = piu.instrument_id
AND ca.account_number = 'SKM-PERSON-01'
AND epa.acct_site_use_id is null
union
SELECT ca.account_number
, (SELECT address1 || ' ' || loc.city || ' ' || loc.state || '-' || loc.postal_code
FROM hz_locations loc
, hz_party_sites hps
WHERE loc.location_id = hps.location_id
AND hps.party_site_id = cas.party_site_id
) addr
, piu.start_date
, piu.end_date
, eba.bank_account_num
, eba.bank_account_name
, eba.start_date
, eba.end_date
FROM hz_cust_site_uses_all csu
, iby_external_payers_all epa
, iby_pmt_instr_uses_all piu
, iby_ext_bank_accounts eba
, hz_cust_acct_sites_all cas
, hz_cust_accounts ca
WHERE ca.account_number = 'SKM-PERSON-01'
AND cas.cust_account_id = ca.cust_account_id
AND csu.cust_acct_site_id = cas.cust_acct_site_id
AND epa.acct_site_use_id = csu.site_use_id
AND piu.ext_pmt_party_id = epa.ext_payer_id
AND piu.payment_function = 'CUSTOMER_PAYMENT'
AND eba.ext_bank_account_id = piu.instrument_id
</textarea>
Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com1tag:blogger.com,1999:blog-4761848106405556349.post-73951332617548857932015-11-17T19:25:00.000-06:002015-11-17T19:25:01.266-06:00Changing Password using Sql Developer<br>
At my site i have access to 6 database instances. Every three months i have to change passwords for each instance and as per rules, we have to use longer and complicated passwords. For changing password in one instance, I had to do the following
<ol>
<li> Login to that instance using sqlplus, i had to enter existing password once</li>
<li>Type Password</li>
<li>Enter Old Password</li>
<li>Enter New Password</li>
<li>Enter New Password</li>
</ol>
And if there is any mistake in typing, redo whole thing again. Today I found a better way to change password in all instance
<ol>
<li>Login to database using sql developer</li>
<li>Type following command<br>
alter user user_name identified by "New_Password" replace "Old_Password";
</li>
</ol>
and password changes without any problem. <br><br>
Note: New_Password and Old_Password values should be in double quotes.Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0tag:blogger.com,1999:blog-4761848106405556349.post-5760467059761452122015-10-28T21:37:00.000-05:002017-01-09T13:28:48.725-06:00Oracle Forms Runtime Diagnostics and TraceThis is applicable to Oracle application release 12.1.3<br><br>
Following metalink notes provide step to generate Forms runtime diagnostics and trace<br><br>
<ol>
<li>R12: Forms Runtime Diagnostics (FRD), Tracing And Logging For Forms In Oracle Applications ( Doc ID 438652.1 )</li>
<li>How To Collect And Use Forms Trace (FRD) in Oracle Applications Release 12 (Doc ID 373548.1)</li>
</ol>
<br><br>
<u><b>To Generate Forms Trace, this is what I did:<br><br></b></u>
<ol>
<li>Checked profile option definition for <font color="yellow"><b>profile Forms Runtime Parameters</b></font>. If this profile is not updateable by user then make it updateable by user.<br><br></li>
<li>Now modify the profile profile <font color="yellow"><b>Forms Runtime Parameters</b></font> at user level and set it to <font color="yellow"><b>record=forms tracegroup=full</b></font>. Record and trace group are separated by a single space character. This setting of profile will generate forms trace.<br><br></li>
<li>It will create trace file in the directory $FORMS_TRACE_DIR. Trace file name will be <font color="yellow"><b>forms_<pid>.trc</b></font> . This file is binary file and it needs to be converted to readable format using following command. First connamd give xml output and second one gives html output that i prefer. (please note that <font color="yellow"><b>$AFJVAPRG</b></font> is an environment variable that points to java executable<br><br></li>
<ol type="I">
<li>$AFJVAPRG -cp $ORACLE_HOME/forms/java/frmxlate.jar oracle.forms.diagnostics.Xlate datafile=$FORMS_TRACE_DIR/forms_13840.trc outputfile=$MY_DIR/forms_trace.xml outputclass=WriteOut</li>
<br><br>
<li> $AFJVAPRG -cp $ORACLE_HOME/forms/java/frmxlate.jar oracle.forms.diagnostics.Xlate datafile=$FORMS_TRACE_DIR/forms_13840.trc outputfile=$MY_DIR/forms_trace.xml outputclass=WriteOutHTML <br><br><br></li>
</ol>
</ol>
<u><b>To Generate Forms Runtime diagnostics, this is what I did:<br><br></b></u>
<ol>
<li>Set profile <font color="yellow"><b>Forms Runtime Parameters</b></font> at user level to <font color="yellow"><b>record=collect</b></font> <br><br></li>
<li>It will create FRD output in $FORMS_TRACE_DIR and filename would be collect__<pid></li>
</ol>
Sanjai Misrahttp://www.blogger.com/profile/04189052945617903398noreply@blogger.com0