Sunday, November 3, 2013


How to submit the XML Publisher report from a PL\SQL Procedure in EBS

I have provided a sample procedure named "PRINT_REPORT". The first API called is FND_REQUEST.ADD_LAYOUT this API will attach the layout or RTF template to your concurrent program. The next API is FND_REQUEST.SUBMIT_REQUEST which will submit the concurrent request.


PROCEDURE print__report ( x_errbuff            OUT VARCHAR2
                              ,x_retcode            OUT NUMBER
 ,p_program_short_name IN VARCHAR2
   )
IS
lc_stage             VARCHAR2(1000);
  lc_error_message     VARCHAR2(4000);
  ln_loader_request_id NUMBER;
  lb_wait              BOOLEAN;
  lc_phase             VARCHAR2(100);
  lc_status            VARCHAR2(30);
  lc_devpha            VARCHAR2(100);
  lc_devsta            VARCHAR2(100);
  lc_message           VARCHAR2(50);
  lb_layout             BOOLEAN;

  ex_conc_request_failed EXCEPTION;

BEGIN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Launching the XML Publisher Report');

 lc_stage := 'Launching the Error Report';

 lb_layout := FND_REQUEST.ADD_LAYOUT
       ('XXCUST', -- Custom Application Top Name
         p_program_short_name,
        'en',
        'US',
        'PDF'
);

IF lb_layout THEN


   ln_loader_request_id := FND_REQUEST.SUBMIT_REQUEST
    (
     'XXCUST' -- Custom Application Top Name
    ,p_program_short_name
    ,''
    ,''
    ,FALSE
,P_PARAMETER_1
    ,CHR(0)
    );


END IF;

  COMMIT;



EXCEPTION
      WHEN OTHERS THEN
           x_errbuff  := g_package_name ||' : '|| SUBSTR(SQLERRM,1,1500)||' : '||lc_stage;
           x_retcode := 2;


END print_report;

Saturday, November 2, 2013


Script to release AP Invoice holds using the standard API 

In certain situations we have to complete the Invoice Validation and Accounting process for testing.
During validation an Invoice can be placed on Hold due to reasons like "Encumbrance Accounting Failed" or some other reasons which are difficult to track and resolve.  The following script be executed from APPS schema to release the hold placed on the invoice.

DECLARE
  p_invoice_id ap_invoices_all.invoice_id      % TYPE := 25010; /* Change invoice id to correct value */
  p_inv_batch  ap_batches_all.batch_name       % TYPE := 'TEST17SEP1.1';
  p_hold_code  ap_holds_all.hold_lookup_code   % TYPE := 'Encumbrance Acctg Fail';

  v_hold_cnt NUMBER;
  v_apprvl_sts     ap_invoices.wfapproval_status   % TYPE;
  v_release_reason ap_lookup_codes.description     % TYPE;
  v_release_code   ap_lookup_codes.lookup_code     % TYPE := 'Encumbrance Acctg Ok';

  CURSOR lcu_inv_on_hold IS
    SELECT hld.hold_lookup_code
         , hld.invoice_id
      FROM ap_holds hld
         , ap_invoices inv
         , ap_batches_all  btch
     WHERE hld.invoice_id = inv.invoice_id
       AND btch.batch_id = inv.batch_id
       AND (p_invoice_id     IS NULL or p_invoice_id = inv.invoice_id      )
       AND (p_inv_batch      IS NULL or p_inv_batch  = btch.batch_name     )
       AND (p_hold_code      IS NULL or p_hold_code  = hld.hold_lookup_code)
    ;
BEGIN

   mo_global.set_policy_context('S',82);
 
 
   SELECT description
     INTO v_release_reason
     FROM ap_lookup_codes
    WHERE lookup_type = 'HOLD CODE'
      AND lookup_code = v_release_code
      AND enabled_flag = 'Y'
      AND TRUNC (SYSDATE) BETWEEN TRUNC (NVL (start_date_active, SYSDATE - 1))
                              AND TRUNC (NVL (inactive_date    , SYSDATE + 1))
    ;


   FOR lr_rec in lcu_inv_on_hold
   LOOP
       dbms_output.put_line('Inside Loop : ' || lr_rec.invoice_id);
       ap_holds_pkg.quick_release
       ( x_invoice_id                  => lr_rec.invoice_id
       , x_hold_lookup_code            => lr_rec.hold_lookup_code
       , x_release_lookup_code         => v_release_code
       , x_release_reason              => v_release_reason
       , x_responsibility_id           => fnd_global.resp_id
       , x_last_updated_by             => fnd_global.user_id
       , x_last_update_date            => SYSDATE
       , x_holds_count                 => v_hold_cnt
       , x_approval_status_lookup_code => v_apprvl_sts
       , x_calling_sequence            => 'xxap_invoice_util_pkg.release_holds'
       ) ;
     
       dbms_output.put_line('Hold count = ' || v_hold_cnt ||
                            ', Approval Status:' || v_apprvl_sts);
   END LOOP;

COMMIT;

EXCEPTION
  WHEN OTHERS THEN
    dbms_output.put_line('Oracle Exception:' || SUBSTR(sqlerrm,1,500));
END;





R12 Upgrade Technical Assessment Questions


Sr. #
Technical Assessment Questions
1
What are the types of objects that are currently customized in your production application? Can you please provide us the list of Custom Forms, Reports, Interfaces, Workflows. If possible, Kindly classify  based on their level of complexity.
2
i)Are you currently using a reporting tool (Discoverer, Crystal Reports, Siebel, FSGs, OBIEE etc)? If so which one and which version (if applicable)?

ii) Are you currently using any BI dashboard type product (Siebel, DBI, SharePoint, OBIEE etc)? If so which one? What do you plan to use going forward and how many elements will need to be converted?
3
i)How many reports will need to be converted in the new tool? (Oracle's direction is to move all reports (Oracle reports) to BI Publisher reports)

ii)For the current custom reports, are they standard "Oracle reports" or BI Publisher report? If they are Oracle reports, do you expect to convert them to BI Publisher reports?
4
i) Are there any third party applications integrated with Oracle EBS.
Ii) Will any third party applications be made obsolete as a result of the upgrade
iii) If there is any middleware used in integrations? If so, please provide details
5
Are you planning to keep all the customizations as it is?  Or planning to add/change new functionalities
6
How many custom applications has <Client Name> created and register within EBS and are the existing customization all contained within these custom applications? If not, please describe the customizations that are contained within standard application database objects or directory structures.
7
Should we include Architecture assistance for the upgrade project to help with sizing/availability etc?

Is <Client Name> planning on buying new hardware for the production upgrade and the test cycles of the production upgrade or are they planning to perform an upgrade in place on the existing hardware?

Does <Client Name> wish to migrate any hardware platform or OS components as part of this upgrade, such as migrating SLES 10 OS from 32 bit to 64 bit or changing to another OS?
8
Is automated testing in scope? If yes does need to prepare test scripts or already have test scripts?
9
Are standard oracle API’s being used by the interfaces?
10
Since Oracle database 11.2.0.2 is the most current database version certified by Oracle for EBS 12.1.3 on SLES 10, do they wish to upgrade to 11.2.0.2 instead of 11.1.0.7?
11
If an acceptable archiving approach is recommended, can <Client Name> complete archiving of current production transaction history to reduce transaction volume prior to the production upgrade window?
13
Is it safe to assume that <Client Name> will have enough hardware available to accommodate at least two (ideally three) test R12 instance concurrently?
14
i) What is the current size of the database? What is the size of the whole production environment?

Ii) How many years of data is held in the production system?
15
Can you provide an architecture diagram of the existing environment? (ideally including each tier’s server specs). What is the architecture of the Oracle Application Install (multi node, single node, # of Application Servers, shared appl_top, etc)
17
Do you use any configuration management(Verson Control) tool to manage different versions of customizations? If Yes, kindly provide details.
18
Are the Oracle Applications servers located centrally? If not, where are the servers located?
19
What is the current back up method?
20
Do you have any standby solution or high availability solution in place for production instance? If yes, Please provide details. If no, is that a consideration for this project?
21
Are there any critical Month End /Year End/ Translation/Consolidation related customized programs that have been developed? If yes please provide the details.
22
Are there any EDI Transactions? If yes, please provide details and any translators between interfaces.
23
Do you have any requirement for transfer of vendor payment files / customer remittance files to / from banking payment gateways to / from Oracle Applications? If so, please list how many banks / formats would be involved in such cases?
24
  also follows Global Delivery Model for such assignments wherein mainly development work is done remotely/offshore locations. Our assumption is that <Client Name> will support this model by giving instance access, appropriate DB access, logins etc. Please confirm if this is acceptable.




R12 Upgrade Functional Assessment Questions



Functional Assessment Questions
i) What are the EBS modules currently implemented.
Ii) Do you wish to implement any new applications after upgrading to the intended release?
How many operating units, Legal Entities and Inventory organization are available currently? Is there a primary and Secondary Ledgers (Set of Books) or only one?
What nature of Financials currently impelemented (Commercial,Public Sector or Government Financials)
What are the existing business issues\process issues you are facing.
Is there functionality in any of the modules that is not working, functional or technical issues?

Are there any outstanding issues on the current configuration which it is hoped will be resolved during the upgrade?
What are the sub-modules of Oracle Projects currently being used?
Oracle Project Costing, Oracle Project Billing or Only Oracle Project Costing?
What are the high level expectations from the business users after the upgrade to R12?
What is the number of customers in AR? What is the volume of monthly Sales invoices?
What is the number of vendors in AP? What is the volume of monthly vendor invoices?
Are internal resources, both functional and technical, from that project available for the R12 upgrade project? If yes please describe those resources in terms of role and experience level.
What third party add-on does <Client Name>  use for MICR check printing today? Is there a desire to continue using it in R12 or replace it as part of R12 upgrade?
Does <Client Name> currently use client-server ADI to publish and define FSG reports? If yes, Report Manager will need to be added to scope. Please note that R12 currently does not have a replacement for client-server ADI FSG definition functionality.
How long does the monthly close process take? What days is the staff unavailable?
Is the Journal approval being utilized?
Documentations on the current Oracle applications 11i configuration are available and up-to-date. This includes but not limited to BR100, BR030, MD050, MD070, MD120 etc.?
Will any third party applications be made obsolete as a result of the upgrade?
What are the HRMS/Payroll modules currently impelemented
How many users are there for Oracle Apps
Are multiple Language(apart from US English) being used.
In how many locations has Oracle Apps been implemented.
 If its multi-location implementation. Is it across different countries.
Is Oracle PROD running a single global instance or multiple instances.
If multiple are you looking for instance consolidation
Have you implemented Multi-Org
Would there be any need to change the basic structure existing in Oracle(COA,
Costing Method, Organization Strcuture)
Have you implemented any country specific localizations at your locations
Do you have any disaster recovery environments (that would need to be refreshed/cloned) after the go-live?
What is your fiscal calendar (e.g Jan-Dec?)
When is your Monthly Closing (.e.g last day of the monght).
Is the PROD systems used during the weekends by the users? How much downtime can be planned for the upgrade activity?
What are the WebADIs that you are using currently? Please specify.
What are the documentation available for the R 11.5.10.2 System? Do you have the Oracle AIM documents BR 100s, TE 40s etc?
What is your current ACH process
How many sales/use tax locations and/or tax codes are currently defined?
What is the process for processing Employee expenses?
How would Expense report invoices be paid in the new system?
Approximately how many assets are active in the system?
How many active back accounts are defined?
Do you have invoice batches in AP or are invoices entered individually?
Please provide details on anticipated approval process for Purchase Orders and Requisitions ?
What is the intended go-live date for the upgrade?
i) Are key users empowered to make decisions (i.e., regarding configurations) to maintain progress?

ii) Is there a steering committee in place to resolve issues in a timely manner?

iii) Are internal resources, both functional and technical, from that project available for the R12 upgrade project? If yes please describe those resources in terms of role and experience level.

How to find the Output of XML Publisher (BI Publisher) reports output in EBS

cd $APPLCSF/$APPLOUT
-> ls -ltr *<request_id>*
where <request_id> is the report concurrent program request_id.

For Example, if the concurrent request is is 754321 and the report has generated the PDF\RTF output,
Then use the following commad :-


ls -ltr *754321 *PDF
How to Diagnose Workflow Notification Mailer Issue




Outbound Notification Emails:

1. Check if the notification is present in the recipient/user's Worklist/Notifications page.If it does not exist
    then it means that notification itself is not created and need to check the corresponding workflow
    status.You may also query the notification from the wf_notifications table
SQL> select recipient_role,notification_id,status,mail_status from wf_notifications where recipient_role like '&user_name';
   The e-mail notification is sent only if all of following are true.
               --Notification status is OPEN or CANCELED
               --Notification mail_status is MAIL or INVALID
2. Check Recipient role has a valid e-mail address and notification preference MAIL%
SELECT email_address, nvl(WF_PREF.get_pref(name, 'MAILTYPE'), notification_preference)
FROM wf_roles
WHERE name = '&recipient_role';
   Recipient can receive email notification only if

        -- notification preference is not set 'QUERY' / 'DISABLED' / 'SUMMARY' / 'SUMHTML'      &
        -- recipient has valid email address
3. Check and ensure that the following Workflow Service Components are up and running.

        Workflow Deferred Agent Listener
        Workflow Deferred Notification Agent Listener
        Notification Mailer
         -- If the Notification Mailer is not running,  refer to the following note to troubleshoot the mailer
               
Document 242941.1 -- How To Troubleshoot Java-based Workflow Notification Mailer

4. The  message makes two stops before it is sent as e-mail.
Send Event Raised -> Enqueued to WF_DEFERRED Queue --> Processed by Deferred Agent Listener -->
Enqueued to WF_NOTIFICATION_OUT Queue --> Processed by Notification Mailer and sent as e-mail;
5. If an error occurs during dispatch of oracle.apps.wf.notification.send, the message is enqueued to
    WF_ERROR queue. The Error Agent Listener dispatches the ERROR subscription for
    oracle.apps.wf.notification.send that executes WF_XML.Error_Rule.
    Check the Sysadmin user Notifications/Worklist for error notifications to find the cause.
6. Run $FND_TOP/sql/wfmlrdbg.sql for notification id and check the status of the message in
    WF_DEFERRED and WF_NOTIFICATION_OUT queue.
    --PROCESSED in WF_DEFERRED - The message is enqueued to WF_NOTIFICATION_OUT
    --PROCESSED in WF_NOTIFICATION_OUT - The message is sent as e-mail
    --READY in WF_DEFERRED - Check if Deferred Agent Listener is running
    --READY in WF_NOTIFICATION_OUT - Check if Notification Mailer is running

7.. Check for the volumes on the following queues
    WF_DEFERRED
    WF_NOTIFICATION_OUT
[SQL> select NVL(substr(wfe.corrid,1,50),'NULL - No Value') corrid, decode(wfe.state,0,'0 = Ready',1,'1 = Delayed',2,'2 =  Retained',
3,'3 = 
Exception',to_char(substr(wfe.state,1,12))) State,
count(*) COUNT
from applsys.wf_deferred wfe group by wfe.corrid, wfe.state;]
[SQL> select NVL(substr(wfe.corrid,1,50),'NULL - No Value') corrid, decode(wfe.state,0,'0 = Ready',1,'1 = Delayed',2,'2 =  Retained',
3,'3 = 
Exception',to_char(substr(wfe.state,1,12))) State,
count(*)COUNT
from applsys.wf_notification_out wfe group by wfe.corrid, wfe.state;]
 8. If the Message events are not moving out from the wf_notification_out queue , check the notification
     mailer outbound thread count and ensure that it is >=1
9. Check the Mailer parameter Test address, if Test address  is set to any email address note that all the
    outbound notification emails are sent to the Test address only.
10. Ensure that Global Preferences -->  Notification Style is set to one of the following values as desired.
       HTML Mail
       HTML mail with attachments
       Plain text mail
       Plain text mail with attachments
    Navigation: Connect to Applications as Sysadmin user and select responsibility Workflow
                      Administrator  Web Applications --> Administration --> Global  Preferences
11. Troubleshooting framework based notifications
    a. Identify the notification as Fwk based, run $FND_TOP/sql/wfmlrdbg.sql for the notification_id and
        check the column Fwk Content value and if it 'Y' then it is Fwk based notification.
    b. Follow 
Document 339718.1 and ensure that mailer setup and system profiles are set
        correctly.
12. Basic steps to try in solving the outbound email issues, 
    a. Stop Notification Mailer, rebuild Mailer Queue using $FND_TOP/patch/115/sql/wfntfqup.sql. This
        will recreate WF_NOTIFICATION_OUT with new messages that are eligible to be e-mailed.
    b. Bounce Workflow Mailer service.

II Inbound/Response Emails
1. Enable the Mailer inbound processing by setting the mailer parameter Inbound thread count=1 and
    ensure that Notification mailer is up and running.
2. From the mail client check the mailer imap account inbox to see if the response email has arrived and is
     in the unread status.
     NOTE: Mailer will only read/process the unread emails.
3. Workflow Notification Mailer process the valid  response e-mail from IMAP inbox and   then  parses
    the content using NID string in the response e-mail and enqueues the event
    oracle.apps.wf.notification.receive to WF_NOTIFICATION_IN and moves the message to Process
    folder.
4. If a valid  response email is moved to Discard folder, check if the same IMAP account details are shared
    by the multiple notification mailers from the different instance.

     NOTE: It's recommended to use a dedicated IMAP account with each mailer.
5.  Workflow Inbound Notifications Agent Listener listens to WF_NOTIFICATION_IN agent.
6. The message makes one stop before making it to the Notification Activity.
IMAP Inbox -> Mailer builds XML with response attributes and enqueued to WF_NOTIFICATION_IN Queue --> Workflow Inbound Notifications Agent Listener consumes the messages and apply the response to the notification activity by running the subscription.
7. Run $FND_TOP/sql/wfmlrdbg.sql for notification id and check the status of the message in
    WF_NOTIFICATION_IN queue.
8. If there is an error during response event processing the message is enqueued to WF_ERROR queue
9. If there is an exception/error while applying the response,  the Inbound Agent Listener sets the
    mail_status of the notification to INVALID and sends the INVALID response e-mail sent to the
    responder.
Best Practices/tips:
1. Set the mailer parameter 'Processor Close on Read Timeout' to 'Y' i.e., select the checkbox for it.
2. Set the mailer parameter 'Expunge Inbox on Close' to 'Y' i..e., select the check-box for it.
3.  Do not leave the mailer parameter 'NodeName' to default value i.e., WFMAIL but change it to a value as relevant for the instance type or name.  Pre-11.5.10.2, the NodeName must be WFMAIL.
1. Please follow Note 275379.1 (Script To Check What Workflow Related Patches and run to check installed patches) run and upload results to the SR.

2. Please enable STATEMENT level logging:
a. From Self Service > Select "Workflow Manager" under "Oracle Applications Manager" > Click "Notification Mailers" > Service Components (Service Components: <SID>) > select Workflow Notification Mailer >
b. Click on Edit button > Advanced
c. Click on next until you are in the Details section (Step 2 of 8) > Change the log level field from Error To statement>
d. Click on Next all the way to "Step 4 of 8" and click Finish button.


3. Restart the Workflow Mailer and Agent Listener services

a. From Self Service > Select "Workflow Manager" under "Oracle Applications Manager" > Click "Notification Mailers" > Service Components (Service Components: <SID>) >
b. Click "Workflow Mailer Service" under "Container" Column.
e. From "Service Instances for Generic Service Component Container:<SID>"page, click "Pull Down" button from the Start All/ Stop All.
f . Select Stop All > Go.
g. Wait for the Services to read Actual 0 Target 0 and Deactivated.
h. Run the following SQL to make sure service are stopped:
SELECT component_name, component_status, component_status_info
FROM fnd_svc_components_v
WHERE component_name like 'Workflow%';

i. Restart the mailer services using the "Start All" button.
j. Run scripted again from step "h." to see Services are RUNNING.



4. To test the state of Java Mailer, please run Java Mailer FYI test and provide the Notification ID (NID) to step 5.
a. Please log in to OAM
b. Select Workflow Manager from "Navigate to" LOV and click "GO"
b.1 Please run the following sql to make sure the user has a valid email address and the preference is enabled to receive notification.
select name, notification_preference, email_address
from WF_ROLES
where name = upper('<UserName>');


b.2. If there is no valid email address, please assign email address from sysadmin > Security > User > Define form for the user and save. Also if the value for notification preference is disable, please enable that from the Self Service Preferences page by selecting HTML Mail with Attachment (MAILHTML).

c. Click "Notification Mailers"
d. Click "View Details"
e. Click "Test Mailer"
f. Search "Recipient Role" and click "Go" then "Accept".
g. Click "Send Test Message"
h. One will get conformation Notification ID (NID) and provide that for the next step.
i. Please run the following sql to locate the new NIDs which will have one NID with "Message_Name = PLSQL_MSG" and Second with "Message_Name = OAFWK_MSG".
select *
from wf_notifications
order by 1 desc;


5. Please provide the output of the $FND_TOP/sql/wfmlrdbg.sql.
Example:
$ sqlplus apps/<Apps Password> @$FND_TOP/sql/wfmlrdbg.sql <NID1> <NID2> <NIDn>;
$ sqlplus apps/apps @$FND_TOP/sql/wfmlrdbg.sql 942537 942536 942535;


6. Upload Fresh log file from $APPLCSF/$APPLLOG/FNDCPGSC*.txt i.e. the log file for the Active process for Workflow Mailer Service and Agent Listener services.

To retrieve the last 2 log files for Workflow Mailer and Agent Listener services, run the following command:
ls -lt $APPLCSF/$APPLLOG/FNDCPGSC*.txt


7. Is the Instance in a Load Balancing Environment? If that is the case, then please check whether "WF Workflow Mailer Framework Web Agent and Application Framework Agent" Profile options are set correctly.

a. "WF: Workflow Mailer Framework Web Agent" [WF_MAIL_WEB_AGENT] profile option is set to a physical Web Server host address (non-load balanced). The key here is if this profile option is not set, notification mailers will use the Web agent specified in the Application Framework Agent profile option (APPS_FRAMEWORK_AGENT) instead.

b. "Application Framework Agent profile option (APPS_FRAMEWORK_AGENT)" is set to a virtual or load balancing URL like BigIP.

Note: If the profile options are not set properly, Notifications with framework regions such as REQAPPRV, FYI Notification with framework region ("Message_Name = OAFWK_MSG"), etc. will be affected. However, other notifications with no framework regions like FYI Notifications ("Message_Name = PLSQL_MSG"), POAPPROV will not be affected.

One can check whether the affected notification has a Framework Region by running the following sql:
SELECT notification_id, message_type, message_name,
wf_notification.isFwkRegion(notification_id) FWK
FROM wf_notifications
WHERE notification_id IN (<NID>,<NID>,<NID>);