Thursday, September 26, 2013

Api For New Receipt creation 11i


Create Receipt: 


      SET SERVEROUTPUT ON

declare
v_return_status varchar2(32767);
l_msg_count varchar2(32767);
l_msg_data varchar2(32767);
l_cr_id          NUMBER;

begin


BEGIN
fnd_global.apps_initialize(user_id, responsibility_id, responsibility_application_id);
END;
begin

  fnd_client_info.set_org_context('204');

end;

ar_receipt_api_pub.create_cash (
         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                => v_return_status
        ,x_msg_count                    => l_msg_count
        ,x_msg_data                     => l_msg_data
        ,p_currency_code                => 'USD'
        ,p_amount                       => 100
        ,p_receipt_number               => '12348'
        ,p_receipt_date                 => sysdate
        ,p_cr_id                        => l_cr_id
        ,p_receipt_method_name          => 'First Data'
        ,p_customer_number              =>'4932'
        --,p_customer_bank_account_name=>  'Credit Card Bank'
        ,p_customer_bank_account_id     =>'17937'
        ,p_comments                     => 'Hello Prabu'
        ,p_customer_receipt_reference   => NULL
        ,p_remittance_bank_account_id   => '10001'
      );
      COMMIT ;
     
       dbms_output.put_line('Hi Prabu: Status Is'||v_return_status);
    


      

    fnd_msg_pub.count_and_get(
    p_encoded => 'F',
    p_count => l_msg_count,
    p_data => l_msg_data);


    dbms_output.put_line('no. of FND messages :'||l_msg_count);

    for k in 1 .. l_msg_count loop
    l_msg_data := fnd_msg_pub.get(
    p_msg_index => k,
    p_encoded => 'F');
    dbms_output.put_line('Prabu E Msg: '||substr(l_msg_data,1,240));
  
    end loop;

     
      end;
     
    

 Apply Invoice to receipt:


SET SERVEROUTPUT ON

declare
l_return_status varchar2(32767);
l_msg_count varchar2(32767);
l_msg_data varchar2(32767);
l_cr_id          NUMBER;

begin

begin
  fnd_client_info.set_org_context('204');
  end;
 
AR_RECEIPT_API_PUB.APPLY
(
p_api_version => 1.0,
p_init_msg_list => FND_API.G_TRUE,
p_commit => FND_API.G_TRUE,
p_receipt_number => '12348',
p_customer_trx_id => '215952' ,
p_amount_applied =>100 ,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data
);

dbms_output.put_line('Hi Prabu: Status Is'||l_return_status);
    
 fnd_msg_pub.count_and_get(
    p_encoded => 'F',
    p_count => l_msg_count,
    p_data => l_msg_data);


    dbms_output.put_line('no. of FND messages :'||l_msg_count);

    for k in 1 .. l_msg_count loop
    l_msg_data := fnd_msg_pub.get(
    p_msg_index => k,
    p_encoded => 'F');
    dbms_output.put_line('Prabu E Msg: '||substr(l_msg_data,1,240));
  
    end loop;

     

end;

Thursday, September 5, 2013

order to cash



2) Order to cash flow with concurrent program Details
=>Sales order Creation
Create a sales order with order and lines details.
=> Picking:
Pick Release process in turn will kick off several other requests like Pick Slip Report, Shipping Exception Report and Auto Pack Report concurrent programs.
Underlying Tables affected:
If Autocreate Delivery is set to ‘Yes’ then a new record is created in the table WSH_NEW_DELIVERIES.
DELIVERY_ID is populated in the table WSH_DELIVERY_ASSIGNMENTS.
The RELEASED_STATUS in WSH_DELIVERY_DETAILS would be now set to ‘Y’ (Pick Confirmed) if Auto Pick Confirm is set to Yes otherwise RELEASED_STATUS is ‘S’ (Release to Warehouse).
Pick Confirm the Order:
IF Auto Pick Confirm in the above step is set to NO, then the following should be done.
Navigation:  Inventory Super User > Move Order> Transact Move Order
In the HEADER tab, enter the BATCH NUMBER (from the above step) of the order. Click FIND. Click on VIEW/UPDATE Allocation, then Click TRANSACT button. Then Transact button will be deactivated then just close it and go to next step.
Note:  All sub inventory on_hand_quantity will be stored in “MTL_ON_HAND_QUANTITY” table.
=> Shipping:                                                                                                                                      
Ship Confirm the Order:
Navigation:
Order Management Super User>Shipping >Transactions.
Query with the Order Number.
This will kick off concurrent programs like. INTERFACE TRIP Stop, Commercial Invoice, Packing Slip Report, Bill of Lading
Underlying tables affected:
RELEASED_STATUS in WSH_DELIVERY_DETAILS would be ‘C’ (Ship Confirmed)
FLOW_STATUS_CODE in OE_ORDER_HEADERS_ALL would beBOOKED
FLOW_STATUS_CODE in OE_ORDER_LINES_ALL would be SHIPPED
Create Invoice:
Run workflow background Process.
Navigation:  Order Management >view >Requests
Workflow Background Process inserts the records RA_INTERFACE_LINES_ALL with
INTERFACE_LINE_CONTEXT     =     ’ORDER ENTRY’
INTERFACE_LINE_ATTRIBUTE1=     Order_number
INTERFACE_LINE_ATTRIBUTE3=     Delivery_id
and spawns Auto invoice Master Program and Auto invoice import program which creates Invoice for that particular Order.

=> Auto Invoice:
What is inside AutoInvoice
AutoInvoice is a program set consists of 3 main programs. Each program will have unique nature of work to do and they are called internally except Purge program whose execution is derived on the setup otherwise ready to execute stand alone.
Master (RAXMTR)
Import (RAXTRX)
Purge (RAXDEL)

1. Auto Invoice Master program           RAXMTR
Selects and marks records in the interface tables to be processed based on the parameters the user entered and then calls the AutoInvoice Import program. Auto Invoice Master program has no report output.
•Gathers statistics, it means it gathers the stats on interface tables and set the stats on certain indices on interface tables
•Marks interface records for processing by marking request_id
•Submits multiple workers for Parallel Processing by creating instances for request.

2. Auto Invoice Import Program Validates the selected record and creates transaction if it passes validation. Any record that fails validation is left in the interface table with an error code. Depending on the setup, related records may be rejected as well. This program has an output file called Auto Invoice Execution report, which you can view by clicking the View Report button in the Requests window.Working of Auto invoice , Validates data, Inserts records, Deletes interface data Only when system option purge set to ‘Y’
3. Auto Invoice Purge Program Deletes records from the interface tables. If you set the Purge Interface Table system option to No in Define System Option window, Auto Invoice does not delete processed records from the interface tables after each run,and we must submit Auto Invoice Purge Program periodically to clean up the interface tables. This program only deletes transaction lines that have been successfully imported.
Deletes all rows where interface_status =‘P’
• Ra_interface_lines
• Ra_interface_distributions
• Ra_interface_salescredits
Oracle Receivable’s Auto Invoice program will be used to import and validate Invoices. A custom feeder program is required to transfer data from the Advantage extract files and populate the Auto Invoice interface tables (RA_INTERFACE_LINES_ALL and RA_INTERFACE_DISTRIBUTIONS_ALL).If there is need to run populate sales credit into RA_INTERFACE_SALESCREDITS_ALL table. When run, AutoInvoice produces the AutoInvoice Execution Report and the AutoInvoice Validation Report. Any entries which failed validation can be reviewed in Oracle Receivables’ AutoInvoice Interface Exceptions window. Depending on the error, changes may need to be made in Receivables, the feeder program or the imported records in the interface tables.
How Autoinvoice Execution works
Normally, Auto Invoice can be divided into three major phases, Pre-grouping: here the validates all of the line level data takes place, Grouping: groups lines based on the grouping rules and validates header level data, Transfer :validates information that exists in Receivables tables
What happen when AutoInvoice run?
Once the Auto invoice Program gets called, the following activity takes place is part of execution process. This can be analyzed by debug options.
Line, accounting, and sales credit information for each line populates 3 interface tables
Lines are ordered and grouped
Tax is calculated
GL date is determined
GL accounts are assigned using Auto Accounting
Tax, freight, commitments, and credit memos are linked to transaction lines
All transactions are batched
Validated lines are used to create the transaction

How Data is flowing?
Select, insert and update and delete take place on certain tables once it is logged out.
Selects
– RA_INTERFACE_LINES_ALL
– RA_INTERFACE_DISTRIBUTIONS_ALL
– RA_INTERFACE_SALESCREDITS_ALL
Updates/Insert
– RA_INTERFACE_ERRORS_ALL
– RA_CUSTOMER_TRX_ALL
– RA_CUSTOMER_TRX_LINES_ALL
– AR_PAYMENT_SCHEDULES_ALL
– AR_RECEIVABLE_APPLICATIONS_ALL
Inserts
– RA_INTERFACE_ERRORS_ALL
AutoInvoice Exception Handling
Records that fail validation are called ‘Exceptions’. Exceptions stay in Interface Tables which is RA_INTERFACE_ERRORS_ALL. Errors can be corrected in the Exception Handling window. Once corrections are made, Auto invoice must be resubmitted. Records that pass validation get transferred to Receivables tables
AutoInvoice Exception Handling Windows
-Interface Exception window displays exception messages associated with all invalid records
-Interface Lines window displays records that fail validation, provides an error message and can be used to correct the errors
-The Line Errors windows displays errors associated with a specific line, and can only be opened from Interface Lines window
-Interface Exceptions window displays Interface Id, Exception Type, Error Message and Invalid Value associated to the error
-Data cannot be edited in this window, but error can be viewed and corrected by clicking the Details button
-Error Message and Column name with invalid data are displayed in the Message column, and the invalid value that needs to be corrected is displayed in the Invalid Value column