PROCEDURE csi_create_relationship(
p_relationship_tbl IN csi_datastructures_pub.ii_relationship_tbl
, x_return_status OUT VARCHAR2
, x_return_msg OUT VARCHAR2)
IS
l_relationship_id NUMBER;
l_txn_rec csi_datastructures_pub.transaction_rec;
l_msg_index_out NUMBER;
x_msg_count NUMBER;
x_msg_data VARCHAR2(500);
BEGIN
fnd_msg_pub.initialize;
l_relationship_id := csi_ii_relationships_s.NEXTVAL;
p_relationship_tbl( 1).relationship_id := l_relationship_id;
p_relationship_tbl( 1).relationship_type_code := 'COMPONENT-OF';
p_relationship_tbl( 1).object_id := 4959909;
p_relationship_tbl( 1).subject_id := 4959910;
p_relationship_tbl( 1).subject_has_child := 'N';
p_relationship_tbl( 1).position_reference := NULL;
p_relationship_tbl( 1).active_start_date := SYSDATE;
p_relationship_tbl( 1).active_end_date := NULL;
p_relationship_tbl( 1).display_order := NULL;
p_relationship_tbl( 1).mandatory_flag := 'N';
p_relationship_tbl( 1).context := NULL;
p_relationship_tbl( 1).attribute1 := NULL;
p_relationship_tbl( 1).attribute2 := NULL;
p_relationship_tbl( 1).attribute3 := NULL;
p_relationship_tbl( 1).attribute4 := NULL;
p_relationship_tbl( 1).attribute5 := NULL;
p_relationship_tbl( 1).attribute6 := NULL;
p_relationship_tbl( 1).attribute7 := NULL;
p_relationship_tbl( 1).attribute8 := NULL;
p_relationship_tbl( 1).attribute9 := NULL;
p_relationship_tbl( 1).attribute10 := NULL;
p_relationship_tbl( 1).attribute11 := NULL;
p_relationship_tbl( 1).attribute12 := NULL;
p_relationship_tbl( 1).attribute13 := NULL;
p_relationship_tbl( 1).attribute14 := NULL;
p_relationship_tbl( 1).attribute15 := NULL;
p_relationship_tbl( 1).object_version_number := 1;
-- Setting the transaction record type
l_txn_rec.transaction_date := TRUNC( SYSDATE);
l_txn_rec.source_transaction_date := TRUNC( SYSDATE);
l_txn_rec.transaction_type_id := 1;
l_txn_rec.object_version_number := 1;
--
csi_ii_relationships_pub.create_relationship(
p_api_version => 1.0
, p_commit => fnd_api.g_false
, p_init_msg_list => fnd_api.g_true
, p_validation_level => fnd_api.g_valid_level_full
, p_relationship_tbl => p_relationship_tbl
, p_txn_rec => l_txn_rec
, x_return_status => x_return_status
, x_msg_count => x_msg_count
, x_msg_data => x_msg_data);
IF x_return_status = fnd_api.g_ret_sts_success
THEN
DBMS_OUTPUT.put_line( 'Relationship created successfully ');
COMMIT;
ELSE
IF x_msg_count > 0
THEN
FOR i IN 1 .. x_msg_count
LOOP
fnd_msg_pub.get(
p_msg_index => i
, p_encoded => fnd_api.g_false
, p_data => x_msg_data
, p_msg_index_out => l_msg_index_out);
IF x_return_msg IS NULL
THEN
x_return_msg :=
l_msg_index_out
|| ':'
|| x_msg_data;
ELSE
x_return_msg :=
x_return_msg
|| '/'
|| l_msg_index_out
|| ':'
|| x_msg_data;
END IF;
END LOOP;
END IF;
DBMS_OUTPUT.put_line( 'Relationship creation failure : '
|| x_return_msg);
END IF;
END;
p_relationship_tbl IN csi_datastructures_pub.ii_relationship_tbl
, x_return_status OUT VARCHAR2
, x_return_msg OUT VARCHAR2)
IS
l_relationship_id NUMBER;
l_txn_rec csi_datastructures_pub.transaction_rec;
l_msg_index_out NUMBER;
x_msg_count NUMBER;
x_msg_data VARCHAR2(500);
BEGIN
fnd_msg_pub.initialize;
l_relationship_id := csi_ii_relationships_s.NEXTVAL;
p_relationship_tbl( 1).relationship_id := l_relationship_id;
p_relationship_tbl( 1).relationship_type_code := 'COMPONENT-OF';
p_relationship_tbl( 1).object_id := 4959909;
p_relationship_tbl( 1).subject_id := 4959910;
p_relationship_tbl( 1).subject_has_child := 'N';
p_relationship_tbl( 1).position_reference := NULL;
p_relationship_tbl( 1).active_start_date := SYSDATE;
p_relationship_tbl( 1).active_end_date := NULL;
p_relationship_tbl( 1).display_order := NULL;
p_relationship_tbl( 1).mandatory_flag := 'N';
p_relationship_tbl( 1).context := NULL;
p_relationship_tbl( 1).attribute1 := NULL;
p_relationship_tbl( 1).attribute2 := NULL;
p_relationship_tbl( 1).attribute3 := NULL;
p_relationship_tbl( 1).attribute4 := NULL;
p_relationship_tbl( 1).attribute5 := NULL;
p_relationship_tbl( 1).attribute6 := NULL;
p_relationship_tbl( 1).attribute7 := NULL;
p_relationship_tbl( 1).attribute8 := NULL;
p_relationship_tbl( 1).attribute9 := NULL;
p_relationship_tbl( 1).attribute10 := NULL;
p_relationship_tbl( 1).attribute11 := NULL;
p_relationship_tbl( 1).attribute12 := NULL;
p_relationship_tbl( 1).attribute13 := NULL;
p_relationship_tbl( 1).attribute14 := NULL;
p_relationship_tbl( 1).attribute15 := NULL;
p_relationship_tbl( 1).object_version_number := 1;
-- Setting the transaction record type
l_txn_rec.transaction_date := TRUNC( SYSDATE);
l_txn_rec.source_transaction_date := TRUNC( SYSDATE);
l_txn_rec.transaction_type_id := 1;
l_txn_rec.object_version_number := 1;
--
csi_ii_relationships_pub.create_relationship(
p_api_version => 1.0
, p_commit => fnd_api.g_false
, p_init_msg_list => fnd_api.g_true
, p_validation_level => fnd_api.g_valid_level_full
, p_relationship_tbl => p_relationship_tbl
, p_txn_rec => l_txn_rec
, x_return_status => x_return_status
, x_msg_count => x_msg_count
, x_msg_data => x_msg_data);
IF x_return_status = fnd_api.g_ret_sts_success
THEN
DBMS_OUTPUT.put_line( 'Relationship created successfully ');
COMMIT;
ELSE
IF x_msg_count > 0
THEN
FOR i IN 1 .. x_msg_count
LOOP
fnd_msg_pub.get(
p_msg_index => i
, p_encoded => fnd_api.g_false
, p_data => x_msg_data
, p_msg_index_out => l_msg_index_out);
IF x_return_msg IS NULL
THEN
x_return_msg :=
l_msg_index_out
|| ':'
|| x_msg_data;
ELSE
x_return_msg :=
x_return_msg
|| '/'
|| l_msg_index_out
|| ':'
|| x_msg_data;
END IF;
END LOOP;
END IF;
DBMS_OUTPUT.put_line( 'Relationship creation failure : '
|| x_return_msg);
END IF;
END;
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.