Delete an Order or an Order Line

Delete an Order Using OE_ORDER_PUB:

DELETE Operation

In order to delete the entity record, its necessary to pass the operation like OE_GLOBALS.G_OPR_DELETE. The only attribute which needs to be passed is either the header id or the line id depending on the whether deletion is done for the order or the line. Deletes are cascaded down to the child entities. For example to delete a header record all the child entities i.e. lines, header sales credits, header adjustments are deleted.
Deleting the lines results in the deletion of line adjustments, line sales credits and line lot serial numbers as well.
Deletes would also result in the deletion of any holds and attachments associated with the deleted entity and its child entities. The workflow status information for this entity is also purged.

Delete Order:
–This is to delete an order
l_header_rec.header_id := &Order Header ID;
— Indicate to process order that the order is to be deleted
l_header_rec.operation := OE_GLOBALS.G_OPR_DELETE;

Delete Line:
— This is to delete an order line
l_line_tbl_index := 1;
–This is to delete an existing order line.
l_line_tbl(l_line_tbl_index) := OE_ORDER_PUB.G_MISS_LINE_REC;
l_line_tbl(l_line_tbl_index).header_id :=&Order Header ID;
l_line_tbl(l_line_tbl_index).line_id := &Order Line ID;
l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_DELETE;

Script to delete an existing sales order:

 Script to Delete an existing Sales Order Line:


Leave a Reply