<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3606928189641079230</id><updated>2011-10-27T23:40:01.547+05:30</updated><category term='Payroll Balances'/><category term='Practice Notes'/><category term='ERD'/><category term='Assignment Type'/><category term='QuickPay'/><category term='OBIEE Answers'/><category term='Payroll'/><category term='OBIEE Administration'/><category term='Short Writeups'/><category term='DAC'/><category term='Fast Formula'/><category term='Published Code'/><category term='OBIEE'/><category term='OBIEE Variables'/><category term='Key flex fields'/><title type='text'>Oracle Apps Diary</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://oracleapps-diary.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://oracleapps-diary.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Parameshwaran Venkataraman</name><uri>http://www.blogger.com/profile/09595228760962787569</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3606928189641079230.post-1813247053594838163</id><published>2011-10-20T13:39:00.003+05:30</published><updated>2011-10-20T14:54:36.667+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='OBIEE'/><category scheme='http://www.blogger.com/atom/ns#' term='Practice Notes'/><category scheme='http://www.blogger.com/atom/ns#' term='DAC'/><title type='text'>Practice Notes: Query for DAC metadata</title><content type='html'>Time and Again there may a situation where one may need find the DAC tasks which populate particular target table be it a temporary table or staging table or the warehouse table. This information could easily be found from the DAC interface. But if we need to get this data from a TOAD/SQL developer, the following query would do the work.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;code&gt;select &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;step.name     as "DAC TASK",&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;tbl.name      as "TARGET TABLE",&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;step.app_wid  as "ETL LAYER",&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;step.priority&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;  from &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;w_etl_step_tbl step_tbl, &lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;       &lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;w_etl_step step, &lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;       &lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;w_etl_table tbl&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt; where &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;tbl.row_wid = step_tbl.table_wid&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;   and &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;step.row_wid = step_tbl.step_wid&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;   and &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;tbl.name = 'W_EMPLOYEE_D'&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;   and &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;step_tbl.type_cd = 'Target'&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;order by step.priority, step.name&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3606928189641079230-1813247053594838163?l=oracleapps-diary.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oracleapps-diary.blogspot.com/feeds/1813247053594838163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oracleapps-diary.blogspot.com/2011/10/practice-notes-query-for-dac-metadata.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/1813247053594838163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/1813247053594838163'/><link rel='alternate' type='text/html' href='http://oracleapps-diary.blogspot.com/2011/10/practice-notes-query-for-dac-metadata.html' title='Practice Notes: Query for DAC metadata'/><author><name>Parameshwaran Venkataraman</name><uri>http://www.blogger.com/profile/09595228760962787569</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3606928189641079230.post-3369921581591773842</id><published>2011-09-30T12:26:00.004+05:30</published><updated>2011-09-30T12:30:44.270+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Practice Notes'/><category scheme='http://www.blogger.com/atom/ns#' term='Assignment Type'/><title type='text'>Practice Notes: PER_ALL_ASSINGMENTS_F ASSINGMENT_TYPE</title><content type='html'>Probably not worth blogging. But don't have mind to just leave it after having searched for quite sometime.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The lookup type for the PER_ALL_ASSINGMENTS_F.ASSINGMENT_TYPE is ALL_ASGN_TYPE&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So next time i can just look at my diary.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3606928189641079230-3369921581591773842?l=oracleapps-diary.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oracleapps-diary.blogspot.com/feeds/3369921581591773842/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oracleapps-diary.blogspot.com/2011/09/practice-notes-perallassingmentsf.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/3369921581591773842'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/3369921581591773842'/><link rel='alternate' type='text/html' href='http://oracleapps-diary.blogspot.com/2011/09/practice-notes-perallassingmentsf.html' title='Practice Notes: PER_ALL_ASSINGMENTS_F ASSINGMENT_TYPE'/><author><name>Parameshwaran Venkataraman</name><uri>http://www.blogger.com/profile/09595228760962787569</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3606928189641079230.post-7977442905097566883</id><published>2011-08-23T15:52:00.006+05:30</published><updated>2011-08-23T16:21:54.516+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='OBIEE Answers'/><category scheme='http://www.blogger.com/atom/ns#' term='OBIEE Variables'/><category scheme='http://www.blogger.com/atom/ns#' term='OBIEE Administration'/><title type='text'>OBIEE : Beware of Session Variables</title><content type='html'>&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;Blogging after a long time. It may be interesting to note some interesting outcomes in the usage of server variables. You may refer to the syntax of using different OBIEE variables &lt;a href="http://4.bp.blogspot.com/_f689sAiiG-E/SKv8Fxu7wNI/AAAAAAAAAPk/pppwQ1DdEhg/s1600-h/obi-ee-variables-overview.jpg"&gt;here&lt;/a&gt;. We may note that the syntax for referring a session variables is&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;VALUEOF(NQ_SESSION.sess_var_name) -------- (1)&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To refer a repository variable,&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;VALUEOF("rep_var_name") --------------- (2)&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;But what if you refer a session variable using syntax (2)?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I have taken two such session variables CURRENT_FSCL_YEAR and CURRENT_FSCL_PERIOD from the BI Apps RPD.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The incorrect way of using a session variable CURRENT_FSCL_YEAR:&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://2.bp.blogspot.com/-_VO-zCSsjOA/TlOEQRqDXDI/AAAAAAAAAws/ul1lpcbC-m8/s1600/Fscl_year_i.bmp" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img src="http://2.bp.blogspot.com/-_VO-zCSsjOA/TlOEQRqDXDI/AAAAAAAAAws/ul1lpcbC-m8/s320/Fscl_year_i.bmp" border="0" alt="" id="BLOGGER_PHOTO_ID_5644000173177920562" style="text-align: left; display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 320px; height: 246px; " /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;The incorrect way of using a session variable CURRENT_FSCL_PERIOD:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;a href="http://3.bp.blogspot.com/-xOZNk7Bkjok/TlOEzKlFyRI/AAAAAAAAAw0/AmiqYT0xEJo/s1600/Fscl_Period_i.bmp" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img src="http://3.bp.blogspot.com/-xOZNk7Bkjok/TlOEzKlFyRI/AAAAAAAAAw0/AmiqYT0xEJo/s320/Fscl_Period_i.bmp" border="0" alt="" id="BLOGGER_PHOTO_ID_5644000772573481234" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 216px; " /&gt;&lt;/a&gt;The result is :&lt;/div&gt;&lt;a href="http://2.bp.blogspot.com/-tYhAh_pWLLI/TlOE_9PRS1I/AAAAAAAAAw8/Ec_CP0WMD6Y/s1600/result.bmp" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 98px;" src="http://2.bp.blogspot.com/-tYhAh_pWLLI/TlOE_9PRS1I/AAAAAAAAAw8/Ec_CP0WMD6Y/s320/result.bmp" border="0" alt="" id="BLOGGER_PHOTO_ID_5644000992330599250" /&gt;&lt;/a&gt;As everyone can see, it has fetched the default value of the session variable for the incorrect representations. Internally repository or session, they are server variables hence this behavior. Hence it may not be good idea to mix the syntax of both the variable types.&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3606928189641079230-7977442905097566883?l=oracleapps-diary.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oracleapps-diary.blogspot.com/feeds/7977442905097566883/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oracleapps-diary.blogspot.com/2011/08/obiee-beware-of-session-variables.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/7977442905097566883'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/7977442905097566883'/><link rel='alternate' type='text/html' href='http://oracleapps-diary.blogspot.com/2011/08/obiee-beware-of-session-variables.html' title='OBIEE : Beware of Session Variables'/><author><name>Parameshwaran Venkataraman</name><uri>http://www.blogger.com/profile/09595228760962787569</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-_VO-zCSsjOA/TlOEQRqDXDI/AAAAAAAAAws/ul1lpcbC-m8/s72-c/Fscl_year_i.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3606928189641079230.post-5621432100977868117</id><published>2010-05-25T19:54:00.002+05:30</published><updated>2010-05-25T20:01:13.157+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='OBIEE'/><category scheme='http://www.blogger.com/atom/ns#' term='OBIEE Administration'/><title type='text'>OBIEE - Script for creating Time Dimension</title><content type='html'>A basic plsql script for creating time dimension table and populating it with data for years together. &lt;div&gt;&lt;code&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;CREATE TABLE mh_time_periods&lt;/div&gt;&lt;div&gt;(&lt;/div&gt;&lt;div&gt;        time_period_id            NUMBER       NOT NULL&lt;/div&gt;&lt;div&gt;        ,YEAR                     NUMBER(4)    NOT NULL&lt;/div&gt;&lt;div&gt;        ,quarter                  NUMBER(1)    NOT NULL&lt;/div&gt;&lt;div&gt;        ,MONTH                    NUMBER(2)    NOT NULL&lt;/div&gt;&lt;div&gt;        ,DAY                      NUMBER(2)    NOT NULL&lt;/div&gt;&lt;div&gt;        ,month_end_flag           char(1)      DEFAULT 'N'&lt;/div&gt;&lt;div&gt;        ,year_end_flag            char(1)      default 'N'&lt;/div&gt;&lt;div&gt;        ,quarter_end_flag         CHAR(1)      DEFAULT 'N'&lt;/div&gt;&lt;div&gt;        ,period_date              DATE         NOT NULL&lt;/div&gt;&lt;div&gt;        ,CONSTRAINT mh_time_periods_pk         PRIMARY KEY(time_period_id)&lt;/div&gt;&lt;div&gt;        ,CONSTRAINT mh_time_periods_chk1       CHECK(month_end_flag IN ('N','Y'))&lt;/div&gt;&lt;div&gt;        ,constraint mh_time_periods_chk2       check(year_end_flag in ('N','Y'))&lt;/div&gt;&lt;div&gt;        ,CONSTRAINT mh_time_periods_chk3       CHECK(quarter_end_flag IN ('N','Y'))&lt;/div&gt;&lt;div&gt;);&lt;/div&gt;&lt;div&gt;/&lt;/div&gt;&lt;div&gt;&lt;div&gt;CREATE SEQUENCE mh_time_period_seq START WITH 1 INCREMENT BY 1;&lt;/div&gt;&lt;div&gt;/&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Currently the time dimension table has basic settings. More columns can be added as and when required. &lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;CREATE OR REPLACE PROCEDURE mh_fill_time_data(&lt;/div&gt;&lt;div&gt;                                p_end_date DATE&lt;/div&gt;&lt;div&gt;                                )&lt;/div&gt;&lt;div&gt;IS&lt;/div&gt;&lt;div&gt;  l_year            NUMBER(4) := 2005;&lt;/div&gt;&lt;div&gt;  l_month           NUMBER(2) := 1;&lt;/div&gt;&lt;div&gt;  l_day             NUMBER(2) := 1;&lt;/div&gt;&lt;div&gt;  l_quarter         NUMBER(1) := 0;&lt;/div&gt;&lt;div&gt;  --l_flag            BOOLEAN   := FALSE;&lt;/div&gt;&lt;div&gt;  l_month_end_flag  CHAR(1)   := 'N';&lt;/div&gt;&lt;div&gt;  l_year_end_flag   char(1)   := 'N';&lt;/div&gt;&lt;div&gt;  l_quarter_end_flag CHAR(1)  := 'N';&lt;/div&gt;&lt;div&gt;  &lt;/div&gt;&lt;div&gt;  l_loop_day_end  NUMBER(2);&lt;/div&gt;&lt;div&gt;  l_end_year      NUMBER(4) := TO_NUMBER(TO_CHAR(p_end_date,'yyyy'));&lt;/div&gt;&lt;div&gt;  l_end_month     NUMBER(2) := TO_NUMBER(TO_CHAR(p_end_date,'mm'));&lt;/div&gt;&lt;div&gt;  l_end_day       NUMBER(2) := TO_NUMBER(TO_CHAR(p_end_date,'dd'));&lt;/div&gt;&lt;div&gt;BEGIN&lt;/div&gt;&lt;div&gt;  SAVEPOINT start_insert;&lt;/div&gt;&lt;div&gt;  LOOP    &lt;/div&gt;&lt;div&gt;    LOOP&lt;/div&gt;&lt;div&gt;      IF l_month IN (1,2,3) THEN&lt;/div&gt;&lt;div&gt;        l_quarter := 1;&lt;/div&gt;&lt;div&gt;      ELSIF l_month IN (4,5,6) THEN&lt;/div&gt;&lt;div&gt;        l_quarter := 2;&lt;/div&gt;&lt;div&gt;      ELSIF l_month IN (7,8,9) THEN&lt;/div&gt;&lt;div&gt;        l_quarter := 3;&lt;/div&gt;&lt;div&gt;      ELSE&lt;/div&gt;&lt;div&gt;        l_quarter := 4;&lt;/div&gt;&lt;div&gt;      END IF;&lt;/div&gt;&lt;div&gt;      IF l_month IN (1,3,5,7,8,10,12) THEN&lt;/div&gt;&lt;div&gt;        l_loop_day_end := 31;&lt;/div&gt;&lt;div&gt;      ELSIF l_month IN (4,6,9,11) THEN&lt;/div&gt;&lt;div&gt;        l_loop_day_end := 30;&lt;/div&gt;&lt;div&gt;      ELSE&lt;/div&gt;&lt;div&gt;        l_loop_day_end := get_feb_day(l_year);&lt;/div&gt;&lt;div&gt;      end if;&lt;/div&gt;&lt;div&gt;      &lt;/div&gt;&lt;div&gt;      IF l_year = l_end_year AND l_month = l_end_month THEN&lt;/div&gt;&lt;div&gt;        l_loop_day_end := l_end_day;&lt;/div&gt;&lt;div&gt;      END IF;&lt;/div&gt;&lt;div&gt;      &lt;/div&gt;&lt;div&gt;      LOOP&lt;/div&gt;&lt;div&gt;        IF l_day = l_loop_day_end THEN&lt;/div&gt;&lt;div&gt;          l_month_end_flag := 'Y';&lt;/div&gt;&lt;div&gt;          IF l_month = 12 THEN&lt;/div&gt;&lt;div&gt;            l_year_end_flag := 'Y';&lt;/div&gt;&lt;div&gt;          END IF;        &lt;/div&gt;&lt;div&gt;        end if;&lt;/div&gt;&lt;div&gt;        if l_month_end_flag = 'Y' then&lt;/div&gt;&lt;div&gt;          if l_month IN (3,6,9,12) then&lt;/div&gt;&lt;div&gt;            l_quarter_end_flag := 'Y';&lt;/div&gt;&lt;div&gt;          END IF;&lt;/div&gt;&lt;div&gt;        END IF;&lt;/div&gt;&lt;div&gt;        INSERT INTO mh_time_periods(&lt;/div&gt;&lt;div&gt;                          time_period_id&lt;/div&gt;&lt;div&gt;                          ,YEAR&lt;/div&gt;&lt;div&gt;                          ,quarter&lt;/div&gt;&lt;div&gt;                          ,MONTH&lt;/div&gt;&lt;div&gt;                          ,DAY&lt;/div&gt;&lt;div&gt;                          ,month_end_flag&lt;/div&gt;&lt;div&gt;                          ,year_end_flag&lt;/div&gt;&lt;div&gt;                          ,quarter_end_flag&lt;/div&gt;&lt;div&gt;                          ,period_date&lt;/div&gt;&lt;div&gt;                          )&lt;/div&gt;&lt;div&gt;                    VALUES(&lt;/div&gt;&lt;div&gt;                      mh_time_period_seq.NEXTVAL&lt;/div&gt;&lt;div&gt;                      ,l_year&lt;/div&gt;&lt;div&gt;                      ,l_quarter&lt;/div&gt;&lt;div&gt;                      ,l_month&lt;/div&gt;&lt;div&gt;                      ,l_day&lt;/div&gt;&lt;div&gt;                      ,l_month_end_flag&lt;/div&gt;&lt;div&gt;                      ,l_year_end_flag&lt;/div&gt;&lt;div&gt;                      ,l_quarter_end_flag&lt;/div&gt;&lt;div&gt;                      ,TO_DATE(TO_CHAR(l_day)||'-'||TO_CHAR(l_month)||'-'||TO_CHAR(l_year),'DD-MM-YYYY')&lt;/div&gt;&lt;div&gt;                    );&lt;/div&gt;&lt;div&gt;        l_day := l_day + 1;&lt;/div&gt;&lt;div&gt;        EXIT WHEN l_day &gt; l_loop_day_end;&lt;/div&gt;&lt;div&gt;      END LOOP; -- end of day loop&lt;/div&gt;&lt;div&gt;      &lt;/div&gt;&lt;div&gt;      l_quarter_end_flag := 'N';&lt;/div&gt;&lt;div&gt;      l_month_end_flag := 'N';&lt;/div&gt;&lt;div&gt;      l_day := 1;&lt;/div&gt;&lt;div&gt;      l_month := l_month + 1;&lt;/div&gt;&lt;div&gt;      EXIT WHEN l_month &gt; 12 OR (l_year = l_end_year AND l_month &gt; l_end_month);&lt;/div&gt;&lt;div&gt;    END LOOP; -- End of month loop&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    l_year_end_flag := 'N';&lt;/div&gt;&lt;div&gt;    l_month := 1;&lt;/div&gt;&lt;div&gt;    l_year := l_year + 1;&lt;/div&gt;&lt;div&gt;    EXIT WHEN l_year &gt; l_end_year;&lt;/div&gt;&lt;div&gt;  END LOOP; -- End of year loop&lt;/div&gt;&lt;div&gt;  COMMIT;&lt;/div&gt;&lt;div&gt;  dbms_output.put_line('Done');&lt;/div&gt;&lt;div&gt;EXCEPTION&lt;/div&gt;&lt;div&gt;  WHEN others THEN&lt;/div&gt;&lt;div&gt;    dbms_output.put_line(SQLERRM);&lt;/div&gt;&lt;div&gt;    ROLLBACK TO start_insert;&lt;/div&gt;&lt;div&gt;END mh_fill_time_data;&lt;/div&gt;&lt;div&gt;/&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;CREATE OR REPLACE FUNCTION get_feb_day (nYr IN NUMBER) RETURN NUMBER IS &lt;/div&gt;&lt;div&gt;  v_day varchar2(2); &lt;/div&gt;&lt;div&gt;begin &lt;/div&gt;&lt;div&gt;  select to_char(last_day(to_date( '01-FEB-'|| to_char(nYr), 'DD-MON-YYYY')), 'DD') into v_day from dual; &lt;/div&gt;&lt;div&gt;  return to_number(v_day);   &lt;/div&gt;&lt;div&gt;END;&lt;/div&gt;&lt;div&gt;/&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The above plsql populates from 01-JAN-2005. But can be changed to any starting date. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Note:&lt;/div&gt;&lt;div&gt;The code is open for scrutiny&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3606928189641079230-5621432100977868117?l=oracleapps-diary.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oracleapps-diary.blogspot.com/feeds/5621432100977868117/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oracleapps-diary.blogspot.com/2010/05/obiee-script-for-creating-time.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/5621432100977868117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/5621432100977868117'/><link rel='alternate' type='text/html' href='http://oracleapps-diary.blogspot.com/2010/05/obiee-script-for-creating-time.html' title='OBIEE - Script for creating Time Dimension'/><author><name>Parameshwaran Venkataraman</name><uri>http://www.blogger.com/profile/09595228760962787569</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3606928189641079230.post-2355408869261667221</id><published>2010-05-19T11:51:00.002+05:30</published><updated>2010-05-19T11:55:06.966+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='OBIEE'/><category scheme='http://www.blogger.com/atom/ns#' term='OBIEE Answers'/><title type='text'>OBIEE Datetime Functions</title><content type='html'>&lt;div&gt;To get the start date of the last 4 quarters in OBIEE Answers&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;TIMESTAMPADD(SQL_TSI_QUARTER, -3, &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;TIMESTAMPADD(&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;SQL_TSI_DAY,-1*(DAY_OF_QUARTER(CURRENT_DATE)-1), CURRENT_DATE&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;)       &lt;/div&gt;&lt;div&gt;     &lt;/div&gt;&lt;div&gt;)&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3606928189641079230-2355408869261667221?l=oracleapps-diary.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oracleapps-diary.blogspot.com/feeds/2355408869261667221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oracleapps-diary.blogspot.com/2010/05/obiee-datetime-functions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/2355408869261667221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/2355408869261667221'/><link rel='alternate' type='text/html' href='http://oracleapps-diary.blogspot.com/2010/05/obiee-datetime-functions.html' title='OBIEE Datetime Functions'/><author><name>Parameshwaran Venkataraman</name><uri>http://www.blogger.com/profile/09595228760962787569</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3606928189641079230.post-5249239322501768251</id><published>2010-05-07T11:11:00.007+05:30</published><updated>2010-05-14T15:57:23.881+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Practice Notes'/><title type='text'>Practice Notes: UTL_FILE mess</title><content type='html'>It is most common for apps developer to create outbound interfaces in text files and the usual requirement will of delivering 40 - 60 columns of data.  Typical choice for a developer is to use UTL_FILE package. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Crux of the mess is we have to deliver above said number of column data on the average. Usually beginners would start like this&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;l_utl_file UTL_FILE.FILE_TYPE;&lt;/div&gt;&lt;div&gt;l_utl_file := UTL_FILE.FOPEN(p_dir, p_file_name,'w');&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Then goes on to write to this file. All things set, compiles successfully and when run, produces following error:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;ORA-29285: file write error&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;What happened here? we do have permission to write to that directory but still we get this error. It happens because, on average utl file with 40 - 60 columns takes at least 1500 - 2000 characters each line with proper formatting while default for an utl file line size is around 1000. The following is the procedure declaration for FOPEN. &lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  color: rgb(16, 32, 95); white-space: pre; font-family:monospace;font-size:12px;"&gt;function &lt;b style="color: rgb(0, 0, 0); "&gt;fopen&lt;/b&gt; returns record&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  color: rgb(16, 32, 95); white-space: pre; font-family:monospace;font-size:12px;"&gt;(&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  color: rgb(16, 32, 95); white-space: pre; font-family:monospace;font-size:12px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;location in varchar2,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  color: rgb(16, 32, 95); white-space: pre; font-family:monospace;font-size:12px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;filename in varchar2,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  color: rgb(16, 32, 95); white-space: pre; font-family:monospace;font-size:12px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;open_mode in varchar2,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  color: rgb(16, 32, 95); white-space: pre; font-family:monospace;font-size:12px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;max_linesize in binary_integer default&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  color: rgb(16, 32, 95); white-space: pre; font-family:monospace;font-size:12px;"&gt;); --courtesy from &lt;span class="Apple-style-span"  style="color: rgb(0, 0, 0);  white-space: normal; font-family:verdana, helvetica, sans-serif;"&gt;&lt;a href="http://www.adp-gmbh.ch/ora/plsql/utl_file.html"&gt;http://www.adp-gmbh.ch/ora/plsql/utl_file.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Most references we find for FOPEN miss the fourth default parameter set to 32K of characters. Hence for a typical interface flat file, it is necessary to open the file with required line size to not to see the write error.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3606928189641079230-5249239322501768251?l=oracleapps-diary.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oracleapps-diary.blogspot.com/feeds/5249239322501768251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oracleapps-diary.blogspot.com/2010/05/practice-notes-utlfile-mess.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/5249239322501768251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/5249239322501768251'/><link rel='alternate' type='text/html' href='http://oracleapps-diary.blogspot.com/2010/05/practice-notes-utlfile-mess.html' title='Practice Notes: UTL_FILE mess'/><author><name>Parameshwaran Venkataraman</name><uri>http://www.blogger.com/profile/09595228760962787569</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3606928189641079230.post-6889112772889530773</id><published>2010-04-28T14:08:00.010+05:30</published><updated>2010-05-03T19:06:38.863+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Payroll'/><category scheme='http://www.blogger.com/atom/ns#' term='Fast Formula'/><category scheme='http://www.blogger.com/atom/ns#' term='Practice Notes'/><title type='text'>Practice Notes: Payroll Fast Formula</title><content type='html'>&lt;div style="text-align: justify"&gt;Fast formulas exist not only for payroll calculation but also for many other purposes. One of them being input value validation i.e. using these type of formulas we will be able to validate the screen entry values of element's input values. &lt;/div&gt; &lt;br /&gt;&lt;div style="text-align: justify"&gt;We can add these validations against particular elements in &lt;/div&gt;  &lt;div style="text-align: justify"&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div style="text-align: justify"&gt;&lt;b&gt;Form Functions(ctrl + L) -&gt; element entries &lt;/b&gt;&lt;/div&gt;  &lt;div style="text-align: justify"&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div style="text-align: justify"&gt;Here search for the person and select the element's entry value button and in the popup form, horizontal scroll to formula text box and from the LOV select the formula which validates the screen entries against this input value.&lt;/div&gt;  &lt;div style="text-align: justify"&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div style="text-align: justify"&gt;Such custom formula can be created in&lt;/div&gt;  &lt;div style="text-align: justify"&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div style="text-align: justify"&gt;&lt;b&gt;Form Functions(ctrl + L) -&gt; write formula&lt;/b&gt;&lt;/div&gt;  &lt;div style="text-align: justify"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;  &lt;div style="text-align: justify"&gt;Create the formula with formula type as Element Input Validation. A very useful article on element input validation formulas can be found in &lt;a href="http://download.oracle.com/docs/cd/A60725_05/html/comnls/us/per/ffugax08.htm"&gt;oracle manual here&lt;/a&gt;. &lt;/div&gt;  &lt;div style="text-align: justify"&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div style="text-align: justify"&gt;Two basic rules for writing an input value validation formula are &lt;/div&gt;  &lt;ol&gt;   &lt;li&gt;     &lt;div style="text-align: justify"&gt;There should be only one INPUT for the formula named ENTRY_VALUE of text data type i.e. &lt;code&gt; INPUTS are entry_value(text)&lt;/code&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div style="text-align: justify"&gt;entry_value input can be converted to number types using to_num conversion functions for any validation&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div style="text-align: justify"&gt;There should be a mandatory return parameter called formula_result that can take either ‘S’ (success) or ‘E’ (error)&lt;/div&gt;   &lt;/li&gt; &lt;/ol&gt;  &lt;div&gt;Let us consider an example of validating an entry value which must be atleast 10 i.e. consider an HRA element where we will be using this validation to enforce a rule that the employee gets a minimum of 10% HRA. A simple formula validation may be as follows&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div&gt; &lt;/div&gt;  &lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;  &lt;div&gt;INPUTS are Entry_Value(text)&lt;/div&gt;  &lt;div&gt;FORMULA_RESULT = ‘S’&lt;/div&gt;  &lt;div&gt;IF TO_NUM(Entry_Value) &amp;lt; 10 THEN&lt;/div&gt;  &lt;div&gt;(&lt;/div&gt;&lt;div&gt;  FORMULA_RESULT = ‘E’&lt;/div&gt;&lt;div&gt;  FORMULA_MESSAGE = ‘Entry Value must be minimum 10 and above’&lt;/div&gt;&lt;div&gt;)&lt;/div&gt;&lt;div&gt;RETURN FORMULA_RESULT, FORMULA_MESSAGE&lt;/div&gt;  &lt;/code&gt;&lt;div style="text-align: justify"&gt;&lt;code&gt;&lt;code&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style="text-align: justify"&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style="text-align: justify"&gt;After attaching this above formula against hra_pct of test_hra and when used for an employee, the above validation is fired whenever we enter some screen entry value for the hra_pct. Notice that when hra_pct value entered is less than 10, application throws error from the formula_message but eventually saves the transaction.&lt;/div&gt;&lt;br /&gt;The formula validation we try to do will merely give warning to the user and no way prevent one from overriding the formula validation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3606928189641079230-6889112772889530773?l=oracleapps-diary.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oracleapps-diary.blogspot.com/feeds/6889112772889530773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oracleapps-diary.blogspot.com/2010/04/practice-notes-payroll-fast-formula.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/6889112772889530773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/6889112772889530773'/><link rel='alternate' type='text/html' href='http://oracleapps-diary.blogspot.com/2010/04/practice-notes-payroll-fast-formula.html' title='Practice Notes: Payroll Fast Formula'/><author><name>Parameshwaran Venkataraman</name><uri>http://www.blogger.com/profile/09595228760962787569</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3606928189641079230.post-2974456893962391064</id><published>2010-04-27T14:07:00.005+05:30</published><updated>2010-04-28T14:09:58.871+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Payroll'/><category scheme='http://www.blogger.com/atom/ns#' term='Practice Notes'/><category scheme='http://www.blogger.com/atom/ns#' term='QuickPay'/><title type='text'>Practice Notes: Payroll QuickPay</title><content type='html'>&lt;div style="text-align: justify;"&gt;Try running quick pay for an employee with an effective date in the past. The quick-pay results in error even though there is no payroll was run for this employee. Let situation be evaluated with a simple example.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;On 27th Apr 2010, we create following objects as of 01-Jan-2000:&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;ul&gt;&lt;li&gt;Create two recurring elements called test_salary and test_hra. The input values for test_salary are Pay Value and Basic Salary. Similarly for test_hra, Pay Value and hra_pct are the input values&lt;/li&gt;&lt;li&gt;Create a salary basis test_salary_basis including test_salary as its element&lt;/li&gt;&lt;li&gt;Write a formula test_formula which reads basic salary of test_salary and hra_pct of test_hra and computes the total salary which is equal to (monthly_salary + monthly_salary*hra_pct/100)&lt;/li&gt;&lt;li&gt;Attach this formula to test_salary and return the total_salary to Pay Value of test_salary using formula results form&lt;/li&gt;&lt;li&gt;Link both the element to a payroll test_payroll&lt;/li&gt;&lt;li&gt;Create a new employee 'Mahindrasingh Dhoni', create address and attach the test_salary_basis to his assignment. Add test_payroll to his payroll&lt;/li&gt;&lt;li&gt;Create a new salary for this employee effective from 01-Jan-2000. say $10000 basic per month&lt;/li&gt;&lt;li&gt;From Element entries form, add test_hra element to this employee&lt;/li&gt;&lt;li&gt;Run the quick pay for this employee as of 31-jan-2000&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Above process typically results in error. The above process works perfectly when the same steps are repeated for effective date of today and for future periods whereas it does not work backwards even though we have not run any payroll for this employee later than 31-Jan-2000&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Inference:&lt;/div&gt;&lt;div style="text-align: justify;"&gt;It is best to do all setup works in the past and start running the payroll from current date. &lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3606928189641079230-2974456893962391064?l=oracleapps-diary.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oracleapps-diary.blogspot.com/feeds/2974456893962391064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oracleapps-diary.blogspot.com/2010/04/practice-notes-payroll-quickpay.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/2974456893962391064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/2974456893962391064'/><link rel='alternate' type='text/html' href='http://oracleapps-diary.blogspot.com/2010/04/practice-notes-payroll-quickpay.html' title='Practice Notes: Payroll QuickPay'/><author><name>Parameshwaran Venkataraman</name><uri>http://www.blogger.com/profile/09595228760962787569</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3606928189641079230.post-1940317648182665245</id><published>2010-04-23T11:02:00.016+05:30</published><updated>2010-04-28T14:10:19.196+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Short Writeups'/><category scheme='http://www.blogger.com/atom/ns#' term='Payroll'/><category scheme='http://www.blogger.com/atom/ns#' term='Fast Formula'/><title type='text'>Short Writeup: Fast Formula - Overview</title><content type='html'>&lt;div align="justify"&gt;Oracle Fast Formula can be written using formula form found in&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Navigation -&gt; Total Compensation -&gt; Basic -&gt; Fast Formula -&gt; Write Formula &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Once written, usually Fast formulas are attached to elements of Payroll for any computation. But FF can be of any type including payroll, accruals etc.&lt;br /&gt;&lt;br /&gt;Different Components of Fast Formulas:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Input Statement &lt;/li&gt;&lt;li&gt;Assignment Statements&lt;/li&gt;&lt;li&gt;Return Statements&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;b&gt;Data Types:&lt;/b&gt;&lt;br /&gt;There are three types of data available in fast formula. They are text, numeric and date types. By default a variable is of numeric type. If the data type is not numeric then it must be specified like&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div align="justify"&gt;INPUTS are x,y (date),z (text)&lt;/div&gt;&lt;/code&gt;&lt;br /&gt;&lt;b&gt;Fast Formula Variables:&lt;/b&gt;&lt;br /&gt;Fast formula variables are of three types. Local, Global and database variables.&lt;br /&gt;&lt;br /&gt;Variables usually get their values when values are input to them during a formula call or through database objects.  &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;b&gt;Formula Structure:&lt;/b&gt;&lt;br /&gt;A simple formula may look like this with input, assignment and return statements.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;INPUTS are x,y&lt;br /&gt;&lt;br /&gt;x = y + 1&lt;br /&gt;&lt;br /&gt;RETURN x&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Note:&lt;/div&gt;&lt;div align="justify"&gt;&lt;ul&gt;&lt;li&gt;RETURN statement is used to return the specific value to outside usually a payroll     run&lt;/li&gt;&lt;li&gt;There can be many RETURN statement in a formula but only one INPUTS statement is allowed in a formula&lt;/li&gt;&lt;li&gt;Values of input variables can not be changed&lt;/li&gt;&lt;li&gt;When the element input value is passed to the formula, the input name must be same as that of the input values of the element and the multiple words must be joined by an underscore.&lt;/li&gt;&lt;/ul&gt;&lt;b&gt;Contexts:&lt;/b&gt;&lt;br /&gt;Contexts are similar to environment variables. Since fast formulas are attached to elements, the contexts change for each assignment. Typical context info include&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Business group&lt;/li&gt;&lt;li&gt;Element and element links&lt;/li&gt;&lt;li&gt;Employee and his assignments&lt;/li&gt;&lt;/ul&gt;&lt;b&gt;Order of processing:&lt;/b&gt;&lt;br /&gt;Calculation begins from inner most braces starting left to right.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conditional Statements:&lt;/b&gt;&lt;/div&gt;&lt;div align="justify"&gt;We can use If-else statement like we use it in any other languages.&lt;/div&gt;&lt;div align="justify"&gt;&lt;b&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/b&gt;&lt;code&gt;IF &lt;condition&gt; THEN&lt;br /&gt;(   &lt;/condition&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div align="justify"&gt;&lt;condition&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;statements&lt;/span&gt;&lt;statements&gt;&lt;/statements&gt;&lt;/condition&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;condition&gt;)&lt;br /&gt;ELSE&lt;br /&gt;( &lt;/condition&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;condition&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;statements&lt;/span&gt;&lt;statements&gt;&lt;/statements&gt;&lt;/condition&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;condition&gt;)&lt;/condition&gt;&lt;/div&gt;&lt;/code&gt;&lt;div align="justify"&gt;&lt;code&gt;&lt;condition&gt;&lt;/condition&gt;&lt;/code&gt;&lt;br /&gt;Here we can use the normal conditional operators and logical operators(AND,OR,NOT). There is one more clause called 'WAS DEFAULTED' which when used in if condition, results in true condition if the particular value passed is null. &lt;/div&gt;&lt;div align="justify"&gt;&lt;condition&gt;For eg.&lt;br /&gt;&lt;b&gt;&lt;code&gt;&lt;/code&gt;&lt;/b&gt;&lt;code&gt;&lt;br /&gt;DEFAULT for x is 10&lt;br /&gt;&lt;br /&gt;IF x WAS DEFAULTED THEN&lt;br /&gt;&lt;div align="justify"&gt;&lt;condition&gt;(   &lt;/condition&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;condition&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;statements&lt;/span&gt;&lt;statements&gt;&lt;/statements&gt;&lt;/condition&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;condition&gt;)&lt;/condition&gt;&lt;/div&gt;ELSE&lt;br /&gt;&lt;div align="justify"&gt;&lt;condition&gt;(   &lt;/condition&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;condition&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;statements&lt;/span&gt;&lt;statements&gt;&lt;/statements&gt;&lt;/condition&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;condition&gt;)&lt;/condition&gt;&lt;/div&gt;&lt;b&gt;&lt;/b&gt;&lt;/code&gt;&lt;b&gt;&lt;/b&gt;&lt;br /&gt;When no value/null value is passed to x then the condition evaluates to TRUE oterwise FALSE.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Comments:&lt;/b&gt;&lt;br /&gt;The commenting is similar to that of pl/sql and C++&lt;br /&gt;/* Comments */&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Aliases:&lt;/b&gt;&lt;br /&gt;The database items are often longer and referencing them in formulas becomes tedious without aliases.&lt;br /&gt;ALIAS database_name &lt;database_name&gt; &lt;object_name&gt;AS alias_name&lt;alias_name&gt;&lt;alias_name&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Fast Formula Functions:&lt;/b&gt;&lt;br /&gt;FF Functions can be of following types.&lt;/alias_name&gt;&lt;/alias_name&gt;&lt;/object_name&gt;&lt;/database_name&gt;&lt;/condition&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;ul&gt;&lt;li&gt;Text Functions&lt;/li&gt;&lt;li&gt;Numeric Functions&lt;/li&gt;&lt;li&gt;Date Functions&lt;/li&gt;&lt;li&gt;Data conversion Functions&lt;/li&gt;&lt;li&gt;NULL Functions&lt;/li&gt;&lt;/ul&gt;&lt;condition&gt;&lt;object_name&gt;&lt;alias_name&gt;&lt;b&gt;Database items:&lt;/b&gt;&lt;br /&gt;Database items are the procedures that exist in database. These items can be referenced in fast formula to arrive at the result values. There are two types of database items.&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Static DB Items: are predefined and include standard type of information. For example, date of birth of an employee.&lt;/li&gt;&lt;li&gt;Dynamic DB Items: are generated by the definitions of elements, balances, absence types, flex field segments etc. For example, for each of the input value entry of an element one DB Item is created with preceding element name.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;/alias_name&gt;&lt;/object_name&gt;&lt;/condition&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3606928189641079230-1940317648182665245?l=oracleapps-diary.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oracleapps-diary.blogspot.com/feeds/1940317648182665245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oracleapps-diary.blogspot.com/2010/04/short-writeup-fast-formula-overview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/1940317648182665245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/1940317648182665245'/><link rel='alternate' type='text/html' href='http://oracleapps-diary.blogspot.com/2010/04/short-writeup-fast-formula-overview.html' title='Short Writeup: Fast Formula - Overview'/><author><name>Parameshwaran Venkataraman</name><uri>http://www.blogger.com/profile/09595228760962787569</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3606928189641079230.post-7763944542788089278</id><published>2010-04-22T16:19:00.010+05:30</published><updated>2010-04-28T14:10:45.455+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Short Writeups'/><category scheme='http://www.blogger.com/atom/ns#' term='Payroll'/><category scheme='http://www.blogger.com/atom/ns#' term='ERD'/><category scheme='http://www.blogger.com/atom/ns#' term='Payroll Balances'/><title type='text'>Short Writeup: Oracle Payroll Balances</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_GmrGi9sZDTg/S9BDk2Go3PI/AAAAAAAAArU/rTff6qyhOIo/s1600/Balance_ERD.bmp"&gt;&lt;img id="BLOGGER_PHOTO_ID_5462940648278121714" style="display: block; margin: 0px auto 10px; width: 320px; cursor: hand; height: 144px; text-align: center" alt="" src="http://2.bp.blogspot.com/_GmrGi9sZDTg/S9BDk2Go3PI/AAAAAAAAArU/rTff6qyhOIo/s320/Balance_ERD.bmp" border="0" /&gt;&lt;/a&gt;&lt;div align="justify"&gt;Balances in oracle payroll is nothing but addition/subtraction of 'run result values'. Considering a lay man example of showing year to date salary payment made for particular employee, it may be computed through summing up run result values generated after each payroll through specified time period or one could use Balances.  &lt;br /&gt;&lt;/div&gt;  &lt;div align="justify"&gt; &lt;br /&gt;We could define our own balance or use one of the seeded balance to take particular element feeds.  &lt;br /&gt;&lt;b&gt;   &lt;br /&gt;Navigation -&amp;gt; Total Compensation -&amp;gt; Basic -&amp;gt; Banlances    &lt;br /&gt;&lt;/b&gt;  &lt;br /&gt;Again, balances can be fed by individual elements or through element classification(at the larger level). We should note that both are mutually exclusive. Basic balance information is stored in PAY_BALANCE_TYPES table in R12 .&lt;/div&gt;  &lt;div align="justify"&gt; &lt;br /&gt;&lt;span style="font-weight: bold"&gt;Dimension:&lt;/span&gt;   &lt;br /&gt;Dimensions talk about period context of balance i.e. in our previous example, 'one financial year' forms the dimension. similarly dimension can be quarter to date, month to date types. Dimension details are stored in PAY_BALANCE_DIMENSIONS.&lt;/div&gt;  &lt;div align="justify"&gt; &lt;br /&gt;&lt;span style="font-weight: bold"&gt;Balance Feeds:&lt;/span&gt;  &lt;br /&gt;As we saw previously, balance feed is nothing but how element types are used to feed balances. The input values of element type is linked to balance type via PAY_BALANCE_FEEDS_F table. &lt;/div&gt;  &lt;div align="justify"&gt; &lt;br /&gt;&lt;span style="font-weight: bold"&gt;Defined Balances:&lt;/span&gt;  &lt;br /&gt;Balances by itself does not hold the accrued balance values. Because the context in which balance is going to be used may change depending on the dimension with which we query it. Hence PAY_DEFINED_BALANCES links the valid combination of balance types and dimension types. This table has defined_balance_id as the primary key which will be extensively referred in latest balances.&lt;/div&gt;  &lt;div align="justify"&gt; &lt;br /&gt;&lt;span style="font-weight: bold"&gt;Balance Dimension Types:&lt;/span&gt;  &lt;br /&gt;Usually balances are associated at the assignment level. But there are five different types of dimensions based on which the balances may be used differs.  &lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;N type - Not Fed, Not stored &lt;/li&gt;&lt;li&gt;F type - Fed, but not stored &lt;/li&gt;&lt;li&gt;A type - stored at assignment level &lt;/li&gt;&lt;li&gt;P type - stored at person level &lt;/li&gt;&lt;li&gt;R type - Run level balances &lt;/li&gt;&lt;/ol&gt;The balances for N and F types are not stored in the database tables whereas it is stored for other types. &lt;/div&gt;  &lt;div align="justify"&gt; &lt;br /&gt;&lt;span style="font-weight: bold"&gt;Latest Balance:&lt;/span&gt;  &lt;br /&gt;In R12, the latest balances, be it in assignment level or at person level are stored commonly in a table called PAY_LATEST_BALANCES. The latest balances at assignment level are stored in PAY_ASSIGNMENT_LATEST_BALANCES and linked to PAY_LATEST_BALANCES through latest_balance_id. This table also holds assignment_id and assignment_action_id also. Similarly PAY_PERSON_LATEST_BALANCES is also linked to PAY_LATEST_BALANCES.  &lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3606928189641079230-7763944542788089278?l=oracleapps-diary.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oracleapps-diary.blogspot.com/feeds/7763944542788089278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oracleapps-diary.blogspot.com/2010/04/short-writeup-oracle-payroll-balances.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/7763944542788089278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/7763944542788089278'/><link rel='alternate' type='text/html' href='http://oracleapps-diary.blogspot.com/2010/04/short-writeup-oracle-payroll-balances.html' title='Short Writeup: Oracle Payroll Balances'/><author><name>Parameshwaran Venkataraman</name><uri>http://www.blogger.com/profile/09595228760962787569</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_GmrGi9sZDTg/S9BDk2Go3PI/AAAAAAAAArU/rTff6qyhOIo/s72-c/Balance_ERD.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3606928189641079230.post-705906999247682305</id><published>2010-04-20T14:42:00.006+05:30</published><updated>2010-04-28T14:11:14.065+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Key flex fields'/><category scheme='http://www.blogger.com/atom/ns#' term='Published Code'/><title type='text'>Retrieving Code Combination ID for any key flex fields</title><content type='html'>&lt;blockquote&gt;&lt;p style="text-align: justify"&gt;&lt;span style="font-size:1em;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;It may required to validate the segments of key flex fields and retrieve the code combination id so that such ids may be used in APIs. Typical example includes validating soft coding key flex fields(in update_emp_asg), job,position, cost allocation key flex etc in element links API.&lt;br /&gt;&lt;br /&gt;During conversion/interfacing type of projects we may be required to validate the kff descriptions and get back the code combination id. In such cases the following procedure may be useful. It internally uses hr_kflex_utility.ins_or_sel_keyflex_comb API&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;code&gt; ---&lt;br /&gt;--- Name                          : validate_keyflex&lt;br /&gt;--- Description                   : takes the kff desciptions concatenated by ~         &lt;br /&gt;---                                 and returns the code combination id. Other&lt;br /&gt;---                                 mandatory parameters to be supplied are&lt;br /&gt;---                                 flex code and flex num&lt;br /&gt;--- Note                          : p_error_msg_io is just varchar2 type to take back&lt;br /&gt;---                                 generated error messages.&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;PROCEDURE validate_keyflex(&lt;br /&gt;           p_concat_des_i IN VARCHAR2&lt;br /&gt;           ,p_flex_code_i IN fnd_id_flex_segments.id_flex_code%TYPE&lt;br /&gt;           ,p_flex_num_i IN fnd_id_flex_segments.id_flex_num%TYPE&lt;br /&gt;           ,p_error_msg_io IN OUT VARCHAR2&lt;br /&gt;           ,p_cost_allocation_keyflex_id_o OUT pay_element_links_f.cost_allocation_keyflex_id%TYPE&lt;br /&gt;           ,p_concat_segments_o OUT VARCHAR2&lt;br /&gt;           )&lt;br /&gt;IS&lt;br /&gt; l_id_concat_segments pay_cost_allocation_keyflex.concatenated_segments%TYPE;&lt;br /&gt; l_segment_delimiter fnd_id_flex_structures.concatenated_segment_delimiter%TYPE;&lt;br /&gt; l_application_shortname fnd_application.application_short_name%TYPE;&lt;br /&gt;&lt;br /&gt; TYPE flex_des_table_type IS TABLE OF fnd_flex_values_vl.description%TYPE&lt;br /&gt;                     INDEX BY PLS_INTEGER;&lt;br /&gt;&lt;br /&gt; TYPE flex_value_table_type IS TABLE OF fnd_flex_values.flex_value%TYPE&lt;br /&gt;                     INDEX BY PLS_INTEGER;&lt;br /&gt;&lt;br /&gt; TYPE flex_value_set_table_type IS TABLE OF fnd_flex_values_vl.flex_value_set_id%TYPE&lt;br /&gt;                     INDEX BY PLS_INTEGER;&lt;br /&gt;                  &lt;br /&gt; CURSOR value_set_cur IS&lt;br /&gt;   SELECT flex_value_set_id&lt;br /&gt;   FROM fnd_id_flex_segments&lt;br /&gt;   WHERE id_flex_code=p_flex_code_i&lt;br /&gt;   AND id_flex_num = p_flex_num_i&lt;br /&gt;   ORDER BY segment_num;&lt;br /&gt;&lt;br /&gt; flex_des_table flex_des_table_type;&lt;br /&gt; flex_value_table flex_value_table_type;&lt;br /&gt; flex_value_set_table flex_value_set_table_type;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; l_index_des PLS_INTEGER;&lt;br /&gt; l_index_val PLS_INTEGER;&lt;br /&gt;&lt;br /&gt; l_count NUMBER := 1;&lt;br /&gt; l_loc NUMBER := 1;&lt;br /&gt; l_position NUMBER;&lt;br /&gt; l_des VARCHAR2(40);&lt;br /&gt;&lt;br /&gt; BEGIN&lt;br /&gt; ----------- Get the segment delimiter for the structure ----------------&lt;br /&gt; SELECT concatenated_segment_delimiter&lt;br /&gt; INTO l_segment_delimiter&lt;br /&gt; FROM fnd_id_flex_structures&lt;br /&gt; WHERE id_flex_code = p_flex_code_i&lt;br /&gt; AND id_flex_num = p_flex_num_i;&lt;br /&gt; --DBMS_OUTPUT.PUT_LINE('Find Delimiter: Passed');&lt;br /&gt; ------------ Get all value set id for the flex structure used ----------&lt;br /&gt; OPEN value_set_cur;&lt;br /&gt; FETCH value_set_cur BULK COLLECT INTO flex_value_set_table;&lt;br /&gt; CLOSE value_set_cur;&lt;br /&gt;&lt;br /&gt; --DBMS_OUTPUT.PUT_LINE('Get value sets: Passed');&lt;br /&gt; ------------ Populate Description table ----------------------------------&lt;br /&gt; l_index_des := 1;&lt;br /&gt; LOOP&lt;br /&gt;   l_position := instr(p_concat_des_i, '~', 1, l_loc);&lt;br /&gt;   EXIT WHEN l_position = 0;&lt;br /&gt;   l_des := substr(p_concat_des_i, l_count, l_position-l_count);&lt;br /&gt;   flex_des_table(l_index_des) := l_des;&lt;br /&gt;   l_count := l_position+1;&lt;br /&gt;   l_loc := l_loc +1;&lt;br /&gt;   l_index_des := l_index_des + 1;&lt;br /&gt; END LOOP;&lt;br /&gt; l_des := substr(p_concat_des_i, l_count, length(p_concat_des_i)-l_count+1);&lt;br /&gt; flex_des_table(l_index_des) := l_des;&lt;br /&gt; DBMS_OUTPUT.PUT_LINE('Get flex des table: Passed');&lt;br /&gt;&lt;br /&gt; ---------- Populate value table for corresponding description ---------&lt;br /&gt; ---------- and create value concat segments ----------------------------&lt;br /&gt; l_index_des := NULL;&lt;br /&gt; l_index_val := flex_des_table.FIRST;&lt;br /&gt; l_index_des := flex_value_set_table.FIRST;&lt;br /&gt;&lt;br /&gt; WHILE l_index_val IS NOT NULL AND l_index_des IS NOT NULL&lt;br /&gt; LOOP&lt;br /&gt;   SELECT flex_value&lt;br /&gt;   INTO flex_value_table(l_index_val)&lt;br /&gt;   FROM fnd_flex_values_vl&lt;br /&gt;   WHERE flex_value_set_id = flex_value_set_table(l_index_des)&lt;br /&gt;   AND description = flex_des_table(l_index_val);&lt;br /&gt;&lt;br /&gt;   ---Create concat segments with delimiter at the begining&lt;br /&gt;   l_id_concat_segments := l_id_concat_segments || l_segment_delimiter||flex_value_table(l_index_val);&lt;br /&gt;   l_index_val := flex_des_table.NEXT(l_index_val);&lt;br /&gt;   l_index_des := flex_value_set_table.NEXT(l_index_des);&lt;br /&gt; END LOOP;&lt;br /&gt;&lt;br /&gt; -- Remove the preceeding delimiter&lt;br /&gt; l_id_concat_segments := substr(l_id_concat_segments, 2, length(l_id_concat_segments));&lt;br /&gt;&lt;br /&gt; --DBMS_OUTPUT.PUT_LINE('Get concatenated flex ids: Passed');&lt;br /&gt; ----------- Get the Application Short Name ---------------------------&lt;br /&gt; SELECT application_short_name&lt;br /&gt; INTO l_application_shortname&lt;br /&gt; FROM fnd_application&lt;br /&gt; WHERE application_id = (&lt;br /&gt;   SELECT application_id&lt;br /&gt;   FROM fnd_id_flex_structures&lt;br /&gt;   WHERE id_flex_code = p_flex_code_i&lt;br /&gt;   AND id_flex_num = p_flex_num_i&lt;br /&gt;   );&lt;br /&gt;&lt;br /&gt; --DBMS_OUTPUT.PUT_LINE('Get Application Short Name: Passed');&lt;br /&gt; --DBMS_OUTPUT.PUT_LINE('Des Segments: '|| p_concat_des_i );&lt;br /&gt; --DBMS_OUTPUT.PUT_LINE('ID Segments: '|| l_id_concat_segments);&lt;br /&gt;&lt;br /&gt; ----------- Call Kflex utility to get the code combination id ---------&lt;br /&gt; apps.hr_kflex_utility.ins_or_sel_keyflex_comb(&lt;br /&gt;           p_appl_short_name =&gt; l_application_shortname&lt;br /&gt;           ,p_flex_code =&gt; p_flex_code_i&lt;br /&gt;           ,p_flex_num =&gt; p_flex_num_i&lt;br /&gt;           ,p_concat_segments_in =&gt; l_id_concat_segments&lt;br /&gt;           ,p_ccid =&gt; p_cost_allocation_keyflex_id_o&lt;br /&gt;           ,p_concat_segments_out =&gt; p_concat_segments_o&lt;br /&gt;           );&lt;br /&gt;&lt;br /&gt; DBMS_OUTPUT.PUT_LINE('Key Flex Validation: Passed');&lt;br /&gt;EXCEPTION&lt;br /&gt; WHEN TOO_MANY_ROWS THEN&lt;br /&gt;   p_error_msg_io := p_error_msg_io ||'KeyFlex:Ambiguous Values~';&lt;br /&gt;   DBMS_OUTPUT.PUT_LINE('Key Flex Validation: Failed');&lt;br /&gt;   p_cost_allocation_keyflex_id_o := NULL;&lt;br /&gt;   p_concat_segments_o := NULL;&lt;br /&gt; WHEN NO_DATA_FOUND THEN&lt;br /&gt;   p_error_msg_io := p_error_msg_io ||'KeyFlex:Invalid parameter passed~';&lt;br /&gt;   DBMS_OUTPUT.PUT_LINE('Key Flex Validation: Failed');&lt;br /&gt;   p_cost_allocation_keyflex_id_o := NULL;&lt;br /&gt;   p_concat_segments_o := NULL;&lt;br /&gt; WHEN others THEN&lt;br /&gt;   p_error_msg_io := p_error_msg_io ||' '|| SQLERRM|| '~';&lt;br /&gt;   DBMS_OUTPUT.PUT_LINE('Key Flex Validation: Failed');&lt;br /&gt;   p_cost_allocation_keyflex_id_o := NULL;&lt;br /&gt;   p_concat_segments_o := NULL;&lt;br /&gt;END validate_keyflex;&lt;/code&gt;&lt;p style="text-align: justify"&gt;The above code simply assumes that the validation sets used by the kffs are of either independent/dependent types. And the code is open for scrutiny.&lt;/p&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3606928189641079230-705906999247682305?l=oracleapps-diary.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oracleapps-diary.blogspot.com/feeds/705906999247682305/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oracleapps-diary.blogspot.com/2010/04/retrieving-code-combination-id-for-any.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/705906999247682305'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3606928189641079230/posts/default/705906999247682305'/><link rel='alternate' type='text/html' href='http://oracleapps-diary.blogspot.com/2010/04/retrieving-code-combination-id-for-any.html' title='Retrieving Code Combination ID for any key flex fields'/><author><name>Parameshwaran Venkataraman</name><uri>http://www.blogger.com/profile/09595228760962787569</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
