Alternative for GL_FLEXFIELDS_PKG.get_description_sql to return segment description based on parent
We have a GL COA configured with 5 segments. Segment 5 (Sub-Account) is dependent on Segment 4 (Account). However, our business users used the same value (492) for the segment Sub Account (Segment 5) under two different parent accounts (7434 and 8433). For 7434, 492 is described as Tax not deductible and for 8433 it is Membership subscriptions.
We are using the standard GL API, GL_FLEXFIELDS_PKG.get_description_sql, recommended by Oracle to fetch the segment descriptions. This API takes Chart of Accounts and Segment Number as inputs and returns the Segment Values. This API considers only enabled segments to return the segment description.
In our case, both these segments are enabled and the GL API is returning the wrong value i.e "Tax Not Deductible" whereas it should be "Subscription". Please note that our business users confirmed that they cannot disable either of these Sub Accounts as the combinations are valid under different Parent Accounts.