Friday, March 12, 2010

How to set context and profile values from backend in R12 Oracle apps

FUNCTION set_context( i_user_name    IN  VARCHAR2
                     ,i_resp_name    IN  VARCHAR2
                     ,i_org_id       IN  NUMBER)
v_user_id             NUMBER;
v_resp_id             NUMBER;
v_resp_appl_id NUMBER;
v_lang                   VARCHAR2(100);
v_session_lang VARCHAR2(100):=fnd_global.current_language;
v_return              VARCHAR2(10):='T';
v_nls_lang          VARCHAR2(100);
v_org_id              NUMBER:=i_org_id;
/* Cursor to get the user id information based on the input user name */
CURSOR cur_user
    SELECT     user_id
    FROM       fnd_user
    WHERE      user_name  =  i_user_name;
/* Cursor to get the responsibility information */
CURSOR cur_resp
    SELECT     responsibility_id
    FROM       fnd_responsibility_tl
    WHERE      responsibility_name  =  i_resp_name;
/* Cursor to get the nls language information for setting the language context */
CURSOR cur_lang(p_lang_code VARCHAR2)
    SELECT    nls_language
    FROM      fnd_languages
    WHERE     language_code  = p_lang_code;
    /* To get the user id details */
    OPEN cur_user;
    FETCH cur_user INTO v_user_id;
    IF cur_user%NOTFOUND
    END IF; --IF cur_user%NOTFOUND
    CLOSE cur_user;

    /* To get the responsibility and responsibility application id */
    OPEN cur_resp;
    FETCH cur_resp INTO v_resp_id, v_resp_appl_id,v_lang;
    IF cur_resp%NOTFOUND
    END IF; --IF cur_resp%NOTFOUND
    CLOSE cur_resp;

    /* Setting the oracle applications context for the particular session */
    fnd_global.apps_initialize ( user_id      => v_user_id
                                ,resp_id      => v_resp_id
                                ,resp_appl_id => v_resp_appl_id);

    /* Setting the org context for the particular session */

    /* setting the nls context for the particular session */
    IF v_session_lang != v_lang
        OPEN cur_lang(v_lang);
        FETCH cur_lang INTO v_nls_lang;
        CLOSE cur_lang;
    END IF; --IF v_session_lang != v_lang

    RETURN v_return;
    RETURN 'F';
END set_context;

9 Responses to “How to set context and profile values from backend in R12 Oracle apps”

waqar said...
February 19, 2016 at 2:23 AM

Very Helpfull Thanks

Unknown said...
December 4, 2017 at 10:26 PM

Nice it seems to be good post... It will get readers engagement on the article since readers engagement plays an vital role in every blog.i am expecting more updated posts from your hands.
iOS App Development Company
Android App Development Company
Mobile App Development Company

Joan said...
April 1, 2021 at 11:48 PM

Considering all the moving parts, this was a project management masterpiece
user experience consulting

Aubrey Dickey said...
June 17, 2021 at 4:18 AM

Regardless of whether you need assistance generating traffic to some big advanced site or just easy methods to use
SF design studios

daisoftware said...
July 14, 2021 at 2:45 AM

The blog is absolutely fantastic! Lot of great information which can be helpful about benefits of developing website. Keep updating the blogs.
home services app development

Cheryl Terrell said...
October 7, 2021 at 12:50 AM

Thanks friends, for providing such enlightening data.
digital agencies San Francisco

Window Repair said...
October 7, 2021 at 12:53 AM

I agree. You have made the nice blogs with the great info in the contents.
Bay Area web design companies

OTT app development said...
March 11, 2022 at 8:44 AM

It looks great to know about the backend process for this, Try to use it for the OTT apps to make more effective

Anonymous said...
July 28, 2022 at 2:09 PM

Я давно пытаюсь привести себя в порядок, но если вижу разные вкусности, не могу сдержаться. Я долго искала средство для похудения, подруга посоветовала onetwoslim капли (Вантуслим). Они мне нравятся, они снижают аппетит и сжигают жир, я даже ем запрещенные продукты, но отныне в умеренных количествах, и это сейчас крайне важно. Я не набираю лишних нагрузок, а наоборот, постепенно теряю лишнее.

Post a Comment


The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.