fnd_flex_keyval.validate_segs call fails to validate flexfield segment Company with message value do
I am using following code to validate KFF code combination but despite providing valid value 02 for company segment, it always fails with error 'Value 02 for the flexfield segment Company does not exist in the value set COMPANY SEGMENT'.
Any pointers to resolve will be highly appreciated.
DECLARE
p_concat_segs VARCHAR2(1000) := '02.202.51101.0000.0000000.0000';
l_keyval_status BOOLEAN;
l_coa_id NUMBER;
begin
begin
select chart_of_accounts_id
into l_coa_id
from gl_sets_of_books
where set_of_books_id = fnd_profile.value('GL_SET_OF_BKS_ID');
exception
when no_data_found then
dbms_output.put_line('Chart of Accounts ID not found from profile option GL_SET_OF_BKS_ID');