Thursday, August 27, 2009

OTL Time Attribute Update API issue

OTL time attribute API fails in few cases due to the timecard attribute record table passed as IN OUT parameter doesnt contain all the attributes entry.

So in case there is no entry for a time attribute in record table, we need to use create_attribute else use update attribute. Following is the piece of code which does so

lt_attribute_tbl(1).att_name :=
lt_attribute_tbl(1).att_value :=
....
....
....
....
lt_attribute_tbl(10).att_name := ...
lt_attribute_tbl(10).att_value := ...

FOR x IN 1..10 LOOP

IF (g_tbl_attributes_info.COUNT <> 0)
THEN
l_attribute_index := hxc_timestore_deposit_util.get_index_in_attr_table
(p_attr_table => g_tbl_attributes_info,
p_attr_id_to_find => l_time_attribute_id,
p_attribute_name_to_find => lt_attribute_tbl(x).att_name );

IF (l_attribute_index < 0) THEN
hxc_timestore_deposit.create_attribute
(p_building_block_id => p_detail_block_id ,p_attribute_name => lt_attribute_tbl(x).att_name ,p_attribute_value => lt_attribute_tbl(x).att_value ,p_attribute_id => l_time_attribute_id ,p_app_attributes => g_tbl_attributes_info );
ELSE
hxc_timestore_deposit.update_attribute
(p_time_attribute_id => l_time_attribute_id
,p_attribute_name => lt_attribute_tbl(x).att_name
,p_attribute_value => lt_attribute_tbl(x).att_value
,p_app_blocks => g_tbl_timecard_info
,p_app_attributes => g_tbl_attributes_info
);
END IF;
END IF;
END LOOP;

1 comment:

Oracle Fusion said...

That is a good tip especially to those new to the blogs here but very accurate information. Very nice blog post!! Thanks for the posting that is a really neatly written blog.
Oracle Fusion HCM Technical Training