How to write Trigger in Sales Order Line Interface
/* Formatted on 2023/07/11 10:22 (Formatter Plus v4.8.8) */
CREATE OR REPLACE TRIGGER apps.xxfah_iriso_default_lin_trig
BEFORE INSERT
ON "ONT"."OE_LINES_IFACE_ALL"
FOR EACH ROW
DECLARE
l_seg1 NUMBER;
l_seg2 VARCHAR2 (50);
l_seg3 VARCHAR2 (50);
l_city VARCHAR2 (50);
l_hdr_context VARCHAR2 (50);
l_item_id NUMBER;
l_orgn_id NUMBER;
l_lin_context VARCHAR2 (50);
l_segment1 VARCHAR2 (50);
BEGIN
IF :NEW.order_source_id = 10
THEN
IF INSERTING
THEN
--BEGIN
:NEW.calculate_price_flag := 'Y';
:NEW.CONTEXT := 'XXTECHHARDS Domestic';
--:NEW.ship_from_org_id :=l_seg1;
BEGIN
UPDATE ont.oe_headers_iface_all a1
SET a1.ship_from_org_id = :NEW.ship_from_org_id
WHERE a1.orig_sys_document_ref = :NEW.orig_sys_document_ref
AND order_source_id = 10;
EXCEPTION
WHEN OTHERS
THEN
fnd_file.put_line
(fnd_file.LOG,
'Error in XXTECHHARDS_IRISO_DEFAULT_LIN_TRIG trigger..wXXTECHHARDSe updating ont.Oe_headers_iface_all: a1.ship_from_org_id '
|| SQLERRM
);
END;
--commit;
BEGIN
SELECT attribute11
INTO l_seg2
FROM po.po_requisition_headers_all
WHERE TO_CHAR (requisition_header_id) =
:NEW.orig_sys_document_ref;
EXCEPTION
WHEN OTHERS
THEN
fnd_file.put_line (fnd_file.LOG,
'Error in fetching l_seg2' || SQLERRM
);
END;
BEGIN
SELECT attribute10
INTO l_seg3
FROM po.po_requisition_headers_all
WHERE TO_CHAR (requisition_header_id) =
:NEW.orig_sys_document_ref;
EXCEPTION
WHEN OTHERS
THEN
fnd_file.put_line (fnd_file.LOG,
'Error in fetching l_seg3' || SQLERRM
);
END;
BEGIN
SELECT item_id
INTO l_item_id
FROM po.po_requisition_lines_all a1
WHERE requisition_header_id = :NEW.orig_sys_document_ref
AND ROWNUM = 1;
EXCEPTION
WHEN OTHERS
THEN
fnd_file.put_line (fnd_file.LOG,
'Error in fetching l_item_id' || SQLERRM
);
END;
:NEW.attribute18 := :NEW.ship_to_city;
END IF;
END IF;
EXCEPTION
WHEN OTHERS
THEN
fnd_file.put_line (fnd_file.LOG, 'Error in trigger ' || SQLERRM);
END;
/
EXIT
**********************************************************************************
#Oracle Apps #EBS #Trigger #PLSQL
#How to write trigger in Standard Interface Table