Showing posts with label OM. Show all posts
Showing posts with label OM. Show all posts

Friday, 26 August 2011

order to cash Process

In this article, we will go through the Order to Cash cycle. The below are the steps in short:



1.       Enter the Sales Order
2.       Book the Sales Order
3.       Launch Pick Release
4.       Ship Confirm
5.       Create Invoice
6.       Create the Receipts either manually or using Auto Lockbox ( In this article we will concentrate on Manual creation)
7.       Transfer to General Ledger
8.       Journal Import
9.       Posting
Let's get into the details of each step mentioned above.
1.       Enter the Sales Order:
Navigation:
Order Management Super User Operations (USA)>Orders Returns >Sales Orders
Enter the Customer details (Ship to and Bill to address), Order type.
click on Lines Tab. Enter the Item to be ordered and the quantity required.
Line is scheduled automatically when the Line Item is saved.
Scheduling/unscheduling can be done manually by selecting Schedule/Un schedule from the Actions Menu.
You can check if the item to be ordered is available in the Inventory by clicking on Availability Button.
Save the work.
Underlying Tables affected:
In Oracle, Order information is maintained at the header and line level.
The header information is stored in OE_ORDER_HEADERS_ALL and the line information in OE_ORDER_LINES_ALL when the order is entered. The column called FLOW_STATUS_CODE is available in both the headers and lines tables which tell us the status of the order at each stage.
At this stage, the FLOW_STATUS_CODE in OE_ORDER_HEADERS_ALL is 'Entered'
2.       Book the Sales Order:
Book the Order by clicking on the Book Order button.
Now that the Order is BOOKED, the status on the header is change accordingly.
Underlying tables affected:
At this stage:
The FLOW_STATUS_CODE in the table OE_ORDER_HEADERS_ALL would be
 'BOOKED'
The FLOW_STATUS_CODE in OE_ORDER_LINES_ALL will be
 'AWAITING_SHIPPING'.
Record(s) will be created in the table WSH_DELIVERY_DETAILS with
RELEASED_STATUS='R' (Ready to Release)
Also Record(s) will be inserted into WSH_DELIVERY_ASSIGNMENTS.
At the same time DEMAND INTERFACE PROGRAM runs in the background and inserts
into MTL_DEMAND
3.       Launch Pick Release:
Navigation:
Shipping > Release Sales Order > Release Sales Orders.
Key in Based on Rule and Order Number
In the Shipping Tab key in the below:
Auto Create Delivery: Yes
Auto Pick Confirm: Yes
Auto Pack Delivery: Yes
In the Inventory Tab:
Auto Allocate: Yes
Enter the Warehouse
Click on Execute Now Button.
On successful completion, the below message would pop up as shown below.
Pick Release process in turn will kick off several other requests like Pick Slip Report,
Shipping Exception Report and Auto Pack Report
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).
4.       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.
5.       Ship Confirm the Order:
Navigation:Order Management Super User>Shipping >Transactions.
Query with the Order Number.
Click On Delivery Tab
Click on Ship Confirm.
The Status in Shipping Transaction screen will now be closed.
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 be "BOOKED"
FLOW_STATUS_CODE in OE_ORDER_LINES_ALL would be "SHIPPED"
6.       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.
The Invoice created can be seen using the Receivables responsibility
Navigation:Receivables Super User> Transactions> Transactions
Query with the Order Number as Reference.
Underlying tables:
RA_CUSTOMER_TRX_ALL will have the Invoice header information. The column INTERFACE_HEADER_ATTRIBUTE1 will have the Order Number.
RA_CUSTOMER_TRX_LINES_ALL will have the Invoice lines information. The column INTERFACE_LINE_ATTRIBUTE1 will have the Order Number.
7.       Create receipt:
Navigation:
Receivables> Receipts> Receipts
Enter the information.
Click on Apply Button to apply it to the Invoice.
Underlying tables:
AR_CASH_RECEIPTS_ALL

8.       Transfer to General Ledger:
To transfer the Receivables accounting information to general ledger, run General Ledger Transfer Program.
Navigation:
Receivables> View Requests
Parameters:
Give in the Start date and Post through date to specify the date range of the transactions to be transferred.
Specify the GL Posted Date, defaults to SYSDATE.
Post in summary: This controls how Receivables creates journal entries for your transactions in the interface table. If you select 'No', then the General Ledger Interface program creates at least one journal entry in the interface table for each transaction in your posting submission. If you select 'Yes', then the program creates one journal entry for each general ledger account.
If the Parameter Run Journal Import is set to 'Yes', the journal import program is kicked off automatically which transfers journal entries from the interface table to General Ledger, otherwise follow the topic Journal Import to import the journals to General Ledger manually.
Underlying tables:
This transfers data about your adjustments, chargeback, credit memos, commitments, debit memos, invoices, and receipts to the GL_INTERFACE table.
9.       Journal Import:

To transfer the data from General Ledger Interface table to General Ledger, run the Journal Import program from Oracle General Ledger.
Navigation: General Ledger > Journal> Import> Run
Parameters:
Select the appropriate Source.
Enter one of the following Selection Criteria:
No Group ID: To import all data for that source that has no group ID. Use this option if you specified a NULL group ID for this source.
All Group IDs: To import all data for that source that has a group ID. Use this option to import multiple journal batches for the same source with varying group IDs.
Specific Group ID: To import data for a specific source/group ID combination. Choose a specific group ID from the List of Values for the Specific Value field.
If you do not specify a Group ID, General Ledger imports all data from the specified journal entry source, where the Group_ID is null.
10.   Define the Journal Import Run Options (optional)
Choose Post Errors to Suspense if you have suspense posting enabled for your set of books to post the difference resulting from any unbalanced journals to your suspense account.
Choose Create Summary Journals to have journal import create the following:
• one journal line for all transactions that share the same account, period, and currency and that has a debit balance
• one journal line for all transactions that share the same account, period, and currency and that has a credit balance.
Enter a Date Range to have General Ledger import only journals with accounting dates in that range. If you do not specify a date range, General Ledger imports all journals data.
Choose whether to Import Descriptive Flexfields, and whether to import them with validation.

Click on Import button.
 Underlying tables:
GL_JE_BATCHES, GL_JE_HEADERS, GL_JE_LINES
11.   Posting:
We have to Post journal batches that we have imported previously to update the account balances in General Ledger.
Navigation:General Ledger> Journals > Enter
Query for the unposted journals for a specific period as shown below.
From the list of unposted journals displayed, select one journal at a time and click on Post button to post the journal.
If you know the batch name to be posted you can directly post using the Post window
Navigation:General Ledger> Journals> Post
Underlying tables:
GL_BALANCES.


--


Tuesday, 10 May 2011

API'S IN ORACLE APPLICATIONS(AR,OM,HRMS)


Lists of Receipts API's in Oracle Receivables
Below is the list of some of the Receipt API's in Oracle Receivables. Receipt APIs provide an extension to existing functionality for creating and manipulating receipts through standard AR Receipts forms and lockboxes.

AR_RECEIPT_API_PUB is the main package that has several procedures to perform different actions


1) AR_RECEIPT_API_PUB.APPLY & AR_RECEIPT_API_PUB.UNAPPLY:
Use this procedure to apply or unaply respectively, the cash receipts from a customer to an invoice, debit memo, or other debit item .
2) AR_RECEIPT_API_PUB.APPLY_ON_ACCOUNT & AR_RECEIPT_API_PUB.UNAPPLY_ON_ACCOUNT
Use this procedure to apply or unapply a cash receipt on account.
3) AR_RECEIPT_API_PUB.APPLY_OPEN_RECEIPT & AR_RECEIPT_API_PUB.UNAPPLY_OPEN_RECEIPT
To apply or unapply a cash receipt to another open receipt.
4) AR_RECEIPT_API_PUB.CREATE_CASH:
Procedure to create a single cash receipt for payment received in the form of a check or cash.
6) AR_RECEIPT_API_PUB.REVERSE
Procedure to reverse cash and miscellaneous receipts
Sales Order Import using API
Please note that this is just the sample code and should be used only for reference.
The code below creates a sales order in entered status with one line record. Also the price adjustment is done for the line.
DECLARE
l_api_version_number           NUMBER  := 1;
l_return_status                VARCHAR2 (2000);
l_msg_count                    NUMBER;
l_msg_data                     VARCHAR2 (2000);
/*****************PARAMETERS****************************************************/
l_debug_level                  NUMBER  := 1;    -- OM DEBUG LEVEL (MAX 5)
l_org                          NUMBER  := 5283;         -- OPERATING UNIT
l_no_orders                    NUMBER  := 1;              -- NO OF ORDERS
l_user                         NUMBER  := 28573;          -- USER
l_resp                         NUMBER  := 53073;        -- RESPONSIBLILTY
l_appl                         NUMBER  := 660;        -- ORDER MANAGEMENT
/*****************INPUT VARIABLES FOR PROCESS_ORDER API*************************/
l_header_rec                   oe_order_pub.header_rec_type;
l_line_tbl                     oe_order_pub.line_tbl_type;
l_action_request_tbl           oe_order_pub.request_tbl_type;
l_line_adj_tbl                 oe_order_pub.line_adj_tbl_type;
/*****************OUT VARIABLES FOR PROCESS_ORDER API***************************/
l_header_rec_out               oe_order_pub.header_rec_type;
l_header_val_rec_out           oe_order_pub.header_val_rec_type;
l_header_adj_tbl_out           oe_order_pub.header_adj_tbl_type;
l_header_adj_val_tbl_out       oe_order_pub.header_adj_val_tbl_type;
l_header_price_att_tbl_out     oe_order_pub.header_price_att_tbl_type;
l_header_adj_att_tbl_out       oe_order_pub.header_adj_att_tbl_type;
l_header_adj_assoc_tbl_out     oe_order_pub.header_adj_assoc_tbl_type;
l_header_scredit_tbl_out       oe_order_pub.header_scredit_tbl_type;
l_header_scredit_val_tbl_out   oe_order_pub.header_scredit_val_tbl_type;
l_line_tbl_out                 oe_order_pub.line_tbl_type;
l_line_val_tbl_out             oe_order_pub.line_val_tbl_type;
l_line_adj_tbl_out             oe_order_pub.line_adj_tbl_type;
l_line_adj_val_tbl_out         oe_order_pub.line_adj_val_tbl_type;
l_line_price_att_tbl_out       oe_order_pub.line_price_att_tbl_type;
l_line_adj_att_tbl_out         oe_order_pub.line_adj_att_tbl_type;
l_line_adj_assoc_tbl_out       oe_order_pub.line_adj_assoc_tbl_type;
l_line_scredit_tbl_out         oe_order_pub.line_scredit_tbl_type;
l_line_scredit_val_tbl_out     oe_order_pub.line_scredit_val_tbl_type;
l_lot_serial_tbl_out           oe_order_pub.lot_serial_tbl_type;
l_lot_serial_val_tbl_out       oe_order_pub.lot_serial_val_tbl_type;
l_action_request_tbl_out       oe_order_pub.request_tbl_type;
l_msg_index                    NUMBER;
l_data                         VARCHAR2 (2000);
l_loop_count                   NUMBER;
l_debug_file                   VARCHAR2 (200);
b_return_status                VARCHAR2 (200);
b_msg_count                    NUMBER;
b_msg_data                     VARCHAR2 (2000);
BEGIN
DBMS_APPLICATION_INFO.set_client_info (l_org);
MO_GLOBAL.SET_POLICY_CONTEXT('S',l_org);
mo_global.init('ONT');

/*****************INITIALIZE DEBUG INFO*************************************/
IF (l_debug_level > 0)
THEN
l_debug_file := oe_debug_pub.set_debug_mode ('FILE');
oe_debug_pub.initialize;
oe_debug_pub.setdebuglevel (l_debug_level);
oe_msg_pub.initialize;
END IF;

/*****************INITIALIZE ENVIRONMENT*************************************/
fnd_global.apps_initialize (l_user, l_resp, l_appl);-- pass in user_id, responsibility_id, and application_id
/*****************INITIALIZE HEADER RECORD******************************/
l_header_rec := oe_order_pub.g_miss_header_rec;
/*****************POPULATE REQUIRED ATTRIBUTES **********************************/
l_header_rec.operation := oe_globals.g_opr_create;
l_header_rec.order_type_id := 2159;                                                                         -- domestic return
l_header_rec.sold_to_org_id := 659018;
l_header_rec.ship_to_org_id := 635775;
l_header_rec.invoice_to_org_id := 635776;
l_header_rec.order_source_id := 9;
l_header_rec.booked_flag := 'N';
l_header_rec.price_list_id := 39825;
l_header_rec.pricing_date := SYSDATE;
l_header_rec.transactional_curr_code := 'USD';
l_header_rec.flow_status_code := 'ENTERED';
l_header_rec.cust_po_number := '1211314AFA';


/*****************INITIALIZE ACTION REQUEST RECORD*************************************/
l_action_request_tbl (1) := oe_order_pub.g_miss_request_rec;
/*****************INITIALIZE LINE RECORD********************************/
l_line_tbl (1) := oe_order_pub.g_miss_line_rec;
l_line_tbl (1).operation := oe_globals.g_opr_create;
l_line_tbl (1).inventory_item_id := 826543;
l_line_tbl (1).ordered_quantity := 1;
--l_line_tbl(1).unit_selling_price := 2000; -- The price is done using adjustments
--l_line_tbl(1).unit_list_price := 2000;
l_line_tbl (1).calculate_price_flag := 'Y';
l_line_tbl (1).return_reason_code := 'B2';
--l_line_tbl(1).line_number := 1;
l_line_adj_tbl (1) := oe_order_pub.g_miss_line_adj_rec;
l_line_adj_tbl (1).operation := oe_globals.g_opr_create;
l_line_adj_tbl (1).list_header_id := 148129;
l_line_adj_tbl (1).list_line_id := 651550;
l_line_adj_tbl (1).change_reason_code := 'MANUAL';
l_line_adj_tbl (1).change_reason_text := 'Manually applied adjustments';
l_line_adj_tbl (1).operand := 2000;
l_line_adj_tbl (1).pricing_phase_id := 2;
l_line_adj_tbl (1).updated_flag := 'Y';
l_line_adj_tbl (1).applied_flag := 'Y';
l_line_adj_tbl (1).line_index := 1;

FOR i IN 1 .. l_no_orders  
LOOP                                       
/*****************CALLTO PROCESS ORDER API*********************************/
oe_order_pub.process_order (
p_api_version_number          => l_api_version_number
, p_header_rec                  => l_header_rec
, p_line_tbl                    => l_line_tbl
, p_action_request_tbl          => l_action_request_tbl
, p_line_adj_tbl                => l_line_adj_tbl
-- OUT variables
, x_header_rec                  => l_header_rec_out
, x_header_val_rec              => l_header_val_rec_out
, x_header_adj_tbl              => l_header_adj_tbl_out
, x_header_adj_val_tbl          => l_header_adj_val_tbl_out
, x_header_price_att_tbl        => l_header_price_att_tbl_out
, x_header_adj_att_tbl          => l_header_adj_att_tbl_out
, x_header_adj_assoc_tbl        => l_header_adj_assoc_tbl_out
, x_header_scredit_tbl          => l_header_scredit_tbl_out
, x_header_scredit_val_tbl      => l_header_scredit_val_tbl_out
, x_line_tbl                    => l_line_tbl_out
, x_line_val_tbl                => l_line_val_tbl_out
, x_line_adj_tbl                => l_line_adj_tbl_out
, x_line_adj_val_tbl            => l_line_adj_val_tbl_out
, x_line_price_att_tbl          => l_line_price_att_tbl_out
, x_line_adj_att_tbl            => l_line_adj_att_tbl_out
, x_line_adj_assoc_tbl          => l_line_adj_assoc_tbl_out
, x_line_scredit_tbl            => l_line_scredit_tbl_out
, x_line_scredit_val_tbl        => l_line_scredit_val_tbl_out
, x_lot_serial_tbl              => l_lot_serial_tbl_out
, x_lot_serial_val_tbl          => l_lot_serial_val_tbl_out
, x_action_request_tbl          => l_action_request_tbl_out
, x_return_status               => l_return_status
, x_msg_count                   => l_msg_count
, x_msg_data                    => l_msg_data
);

/*****************CHECK RETURN STATUS***********************************/
IF l_return_status = fnd_api.g_ret_sts_success
THEN
IF (l_debug_level > 0)
THEN
DBMS_OUTPUT.put_line ('success');
END IF;

COMMIT;
ELSE
IF (l_debug_level > 0)
THEN
DBMS_OUTPUT.put_line ('failure');
END IF;

ROLLBACK;
END IF;
END LOOP; -- END LOOP
/*****************DISPLAY RETURN STATUS FLAGS******************************/
IF (l_debug_level > 0)
THEN
DBMS_OUTPUT.put_line ('process ORDER ret status IS: '
|| l_return_status);
DBMS_OUTPUT.put_line ('process ORDER msg data IS: '
|| l_msg_data);
DBMS_OUTPUT.put_line ('process ORDER msg COUNT IS: '
|| l_msg_count);
DBMS_OUTPUT.put_line ('header.order_number IS: '
|| TO_CHAR (l_header_rec_out.order_number));
DBMS_OUTPUT.put_line ('adjustment.return_status IS: '
|| l_line_adj_tbl_out (1).return_status);
DBMS_OUTPUT.put_line ('header.header_id IS: '
|| l_header_rec_out.header_id);
DBMS_OUTPUT.put_line ('line.unit_selling_price IS: '
|| l_line_tbl_out (1).unit_selling_price);
END IF;

/*****************DISPLAY ERROR MSGS*************************************/
IF (l_debug_level > 0)
THEN
FOR i IN 1 .. l_msg_count
LOOP
oe_msg_pub.get (p_msg_index => i, p_encoded => fnd_api.g_false, p_data => l_data, p_msg_index_out => l_msg_index);
DBMS_OUTPUT.put_line ('message is: ' || l_data);
DBMS_OUTPUT.put_line ('message index is: ' || l_msg_index);
END LOOP;
END IF;

IF (l_debug_level > 0)
THEN
DBMS_OUTPUT.put_line ('Debug = ' || oe_debug_pub.g_debug);
DBMS_OUTPUT.put_line ('Debug Level = ' || TO_CHAR (oe_debug_pub.g_debug_level));
DBMS_OUTPUT.put_line ('Debug File = ' || oe_debug_pub.g_dir || '/' || oe_debug_pub.g_file);
DBMS_OUTPUT.put_line ('****************************************************');
oe_debug_pub.debug_off;
END IF;
END;
/
Following API's are used for creating customers
1) The first step is to create Party.hz_party_v2pub.create_organization is used to create a party.
2) Once party is created then the customer accounts should be created.hz_cust_account_v2pub.create_cust_account API is used to create Customer Accounts. The p_organization_rec should have party information. The orig_system_reference for p_cust_account_Rec should be same as parties orig_system_reference.
3) Now that party and accounts are created, customer account sites and its uses should be created. But before that location and party_sites should be created and attached to party.
4) hz_location_v2pub.create_location API is used to create location. This is a simple API that takes address table type as input and returns location_id as a OUT parameter.
5) API hz_party_site_v2pub.create_party_site is used to create party_site. The party_id created in step 1 and location_id created in step 4 is passed in the party_site_rec parameter. This will return party_site_id as a OUT parameter.
6) Now that we have created the party_sites, its time to create customer site using APIhz_cust_account_site_v2pub.create_cust_acct_site. The cust_account_id created in step 2 and party_site_id created in step 5 is inputted in the cust_acct_site_rec record type. This returns cust_acct_site_id as a OUT parameter.
7) The site use(SHIP_TO, BILL_TO etc.) can be created using APIhz_cust_account_site_v2pub.create_cust_site_use. The cust_acct_site_id created in step 6
8) For BILL_TO the customer profiles can be created using APIhz_customer_profile_v2pub.create_customer_profile
Below is the code that can be used to create SO reservations

DECLARE
   p_rsv                    inv_reservation_global.mtl_reservation_rec_type;
   p_dummy_sn                inv_reservation_global.serial_number_tbl_type;
   x_msg_count               NUMBER;
   x_msg_data                VARCHAR2(240);
   x_rsv_id                  NUMBER;
   x_dummy_sn                inv_reservation_global.serial_number_tbl_type;
   x_status                  VARCHAR2(1);
   x_qty                     NUMBER;
BEGIN
--   fnd_global.APPS_Initialize(28270,53073,660);
   dbms_application_info.set_client_info(5283);
   --p_user_id, p_resp_id,  p_resp_appl_id
   --p_rsv.reservation_id            := NULL; -- cannot know
   p_rsv.requirement_date            := Sysdate+2;
   p_rsv.organization_id             := 5343; --mtl_parameters.organization id
   p_rsv.inventory_item_id           := 949729;--mtl_system_items.Inventory_item_id;
   p_rsv.demand_source_type_id       := inv_reservation_global.g_source_type_oe; -- which is 2
   p_rsv.demand_source_name          := NULL;
   p_rsv.demand_source_header_id     := 1334166 ; --mtl_sales_orders.sales_order_id
   p_rsv.demand_source_line_id       := 4912468 ; -- oe_order_lines.line_id
   p_rsv.primary_uom_code            := 'EA';
   p_rsv.primary_uom_id              := NULL;
   p_rsv.reservation_uom_code        := 'EA';
   p_rsv.reservation_uom_id          := NULL;
   p_rsv.reservation_quantity        := 10;
   p_rsv.primary_reservation_quantity := 10;
   p_rsv.supply_source_type_id       := inv_reservation_global.g_source_type_inv;
   
   inv_reservation_pub.create_reservation
   (
        p_api_version_number       =>       1.0
      , x_return_status            =>       x_status
      , x_msg_count                =>       x_msg_count
      , x_msg_data                 =>       x_msg_data
      , p_rsv_rec                  =>       p_rsv
      , p_serial_number            =>       p_dummy_sn
      , x_serial_number            =>       x_dummy_sn
      , x_quantity_reserved        =>       x_qty
      , x_reservation_id           =>       x_rsv_id
   );
   dbms_output.put_line('Return status    = '||x_status);
   dbms_output.put_line('msg count        = '||to_char(x_msg_count));
   dbms_output.put_line('msg data         = '||x_msg_data);
   dbms_output.put_line('Quantity reserved = '||to_char(x_qty));
   dbms_output.put_line('Reservation id   = '||to_char(x_rsv_id));
   IF x_msg_count >=1 THEN
     FOR I IN 1..x_msg_count
     LOOP
       dbms_output.put_line(I||'. '||SUBSTR(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ),1, 255));
       fnd_file.put_line(fnd_file.log,I||'. '||SUBSTR(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ),1, 255));
     END LOOP;
     
   END IF;
COMMIT;
END;
/

Similary we have update_reservations, relieve_reservations, delete_reservations API to respectively update, relieve or delete reservations.
The item categories can be created using item import when Items are created.
They can also be created using APIs discussed below
Following are the steps to Check and/or Create Item Categories
1) Create Category Segment combinations
2) If the enforce list is checked for category then insert category combinations in the enforce list
3) Create/Update/Delete Category Assignments on Item

In Detail
Create Category Segment combinations
Following APIs can be used to create/update/delete category combinations.

INV_ITEM_CATEGORY_PUB.CREATE_CATEGORY(
  P_API_VERSION  IN    NUMBER,
  P_INIT_MSG_LIST  IN    VARCHAR2 := FND_API.G_FALSE,
  P_COMMIT  IN    VARCHAR2 := FND_API.G_FALSE,
  X_RETURN_STATUS  OUT    VARCHAR2,
  X_ERRORCODE  OUT    NUMBER,
  X_MSG_COUNT  OUT    NUMBER,
  X_MSG_DATA  OUT    VARCHAR2,
  P_CATEGORY_REC  IN    INV_ITEM_CATEGORY_PUB.CATEGORY_REC_TYPE,
  X_CATEGORY_ID  OUT    NUMBER
)

INV_ITEM_CATEGORY_PUB.UPDATE_CATEGORY(
  P_API_VERSION  IN    NUMBER,
  P_INIT_MSG_LIST  IN    VARCHAR2 := FND_API.G_FALSE,
  P_COMMIT  IN    VARCHAR2 := FND_API.G_FALSE,
  X_RETURN_STATUS  OUT    VARCHAR2,
  X_ERRORCODE  OUT    NUMBER,
  X_MSG_COUNT  OUT    NUMBER,
  X_MSG_DATA  OUT    VARCHAR2,
  P_CATEGORY_REC  IN    INV_ITEM_CATEGORY_PUB.CATEGORY_REC_TYPE
)

INV_ITEM_CATEGORY_PUB.DELETE_CATEGORY(
  P_API_VERSION  IN    NUMBER,
  P_INIT_MSG_LIST  IN    VARCHAR2 := FND_API.G_FALSE,
  P_COMMIT  IN    VARCHAR2 := FND_API.G_FALSE,
  X_RETURN_STATUS  OUT    VARCHAR2,
  X_ERRORCODE  OUT    NUMBER,
  X_MSG_COUNT  OUT    NUMBER,
  X_MSG_DATA  OUT    VARCHAR2,
  P_CATEGORY_ID  IN    NUMBER
)


Use following API for assigning a category to a category set. A category will be available in the list of valid categoies for a category set only if it is assigned to the category set. This is a required step if for categories enforce list is checked on.

INV_ITEM_CATEGORY_PUB.CREATE_VALID_CATEGORY(
  P_API_VERSION  IN    NUMBER,
  P_INIT_MSG_LIST  IN    VARCHAR2 := FND_API.G_FALSE,
  P_COMMIT  IN    VARCHAR2 := FND_API.G_FALSE,
  P_CATEGORY_SET_ID  IN    NUMBER,
  P_CATEGORY_ID  IN    NUMBER,
  P_PARENT_CATEGORY_ID  IN    NUMBER,
  X_RETURN_STATUS  OUT    VARCHAR2,
  X_ERRORCODE  OUT    NUMBER,
  X_MSG_COUNT  OUT    NUMBER,
  X_MSG_DATA  OUT    VARCHAR2
)


Following APIs can be used to create/update/delete Item category assignments.

INV_ITEM_CATEGORY_PUB.CREATE_CATEGORY_ASSIGNMENT(
  P_API_VERSION  IN    NUMBER,
  P_INIT_MSG_LIST  IN    VARCHAR2 := FND_API.G_FALSE,
  P_COMMIT  IN    VARCHAR2 := FND_API.G_FALSE,
  X_RETURN_STATUS  OUT    VARCHAR2,
  X_ERRORCODE  OUT    NUMBER,
  X_MSG_COUNT  OUT    NUMBER,
  X_MSG_DATA  OUT    VARCHAR2,
  P_CATEGORY_ID  IN    NUMBER,
  P_CATEGORY_SET_ID  IN    NUMBER,
  P_INVENTORY_ITEM_ID  IN    NUMBER,
  P_ORGANIZATION_ID  IN    NUMBER
)

INV_ITEM_CATEGORY_PUB.UPDATE_CATEGORY_DESCRIPTION(
  P_API_VERSION  IN    NUMBER,
  P_INIT_MSG_LIST  IN    VARCHAR2 := FND_API.G_FALSE,
  P_COMMIT  IN    VARCHAR2 := FND_API.G_FALSE,
  X_RETURN_STATUS  OUT    VARCHAR2,
  X_ERRORCODE  OUT    NUMBER,
  X_MSG_COUNT  OUT    NUMBER,
  X_MSG_DATA  OUT    VARCHAR2,
  P_CATEGORY_ID  IN    NUMBER,
  P_DESCRIPTION  IN    VARCHAR2
)

INV_ITEM_CATEGORY_PUB.DELETE_CATEGORY_ASSIGNMENT(
  P_API_VERSION  IN    NUMBER,
  P_INIT_MSG_LIST  IN    VARCHAR2 := FND_API.G_FALSE,
  P_COMMIT  IN    VARCHAR2 := FND_API.G_FALSE,
  X_RETURN_STATUS  OUT    VARCHAR2,
  X_ERRORCODE  OUT    NUMBER,
  X_MSG_COUNT  OUT    NUMBER,
  X_MSG_DATA  OUT    VARCHAR2,
  P_CATEGORY_ID  IN    NUMBER,
  P_CATEGORY_SET_ID  IN    NUMBER,
  P_INVENTORY_ITEM_ID  IN    NUMBER,
  P_ORGANIZATION_ID  IN    NUMBER
)
The code below is very useful if you want to create a user without logging into application and avoid entering same information again and again. Also if the instances are refresed frequently and the user does not exist in production the script can be very handy.
The script below will prompt for user name and employee name. A commit is required at the end to have affect in the application.

DECLARE
 v_session_id INTEGER := userenv('sessionid');
 v_user_name  VARCHAR2(30) := upper('&User_Name');
 v_employee_name per_all_people_f.full_name%TYPE := '&employee_name';
 v_employee_id NUMBER;
 v_email_address per_all_people_f.email_address%TYPE;
BEGIN
   BEGIN
   SELECT person_id, email_address
   INTO   v_employee_id
       , v_email_address
   FROM   per_all_people_f
   WHERE  upper(full_name) LIKE Upper('%v_employee_name%')
   GROUP  BY person_id
           ,email_address;
   EXCEPTION
   WHEN NO_DATA_FOUND THEN
       dbms_output.put_line('Employee '||v_employee_name
              ||' does not exist');
   WHEN OTHERS THEN
       dbms_output.put_line('Unexpected Error '||SQLERRM);
       dbms_output.put_line('while selected person_id');   
   END;
 fnd_user_pkg.createuser(x_user_name                  => v_user_name
                        ,x_owner                      => ''
                        ,x_unencrypted_password       => 'welcome1'
                        ,x_session_number             => v_session_id
                        ,x_start_date                 => SYSDATE - 10
                        ,x_end_date                   => SYSDATE + 100
                        ,x_last_logon_date            => SYSDATE - 10
                        ,x_description                => v_user_name||' Created using API'
                        ,x_password_date              => SYSDATE - 10
                        ,x_password_accesses_left     => 10000
                        ,x_password_lifespan_accesses => 10000
                        ,x_password_lifespan_days     => 10000
                        ,x_employee_id                => v_employee_id
                        ,x_email_address => v_email_address
                        ,x_fax           => ''
                        ,x_customer_id   => ''
                        ,x_supplier_id   => '');
 fnd_user_pkg.addresp(username       => v_user_name
                     ,resp_app       => 'SYSADMIN'
                     ,resp_key       => 'SYSTEM_ADMINISTRATOR'
                     ,security_group => 'STANDARD'
                     ,description    => 'System Administrator'
                     ,start_date     => SYSDATE - 10
                     ,end_date       => SYSDATE + 1000);
-- Created by Suresh Vaishya
END;
/