Dbms_application_info.set_client_info(:Org_Id);

Hi,
Need to create workbook in Oracle Discoverer Desktop.
I need to know how can I initilize org Id in Oracle Discoverere or Admins
begin
dbms_application_info.set_client_info(:Org_Id);
end;
this need to execute before run the workbook
If anybody let me know how to do it in Oracle Discoverere or Oracle Adminstrator then it will be great.
Thanks

You need to write this dbms_application_info.set_client_info(:Org_Id) inside a function. Create a sheet & call this function as a calculation item...In the next sheet create your report.
Prasath.

Similar Messages

  • Using dbms_application_info.set_client_info('ORG_ID') in BI Publisher rep

    Hello,
    I have a problem here. I would appreciate if you could please provide me some suggestions on this.
    I am developing a report in BI publisher using database as data source. In my query i am using few views so in order to get the data from those views, i need to initialize those views. In case of rdf, this task could be achieved by using before report trigger but right now i am developing the report using BI Publisher without using RDF. I am writing the query in BI Publisher itself and will be creating the data template for the same and upload it into the BI Publisher. So my task is to use "Begin dbms_application_info.set_client_info('ORG_ID') end;" into BI Publisher query but i dont know ow can i achieve this target. I would appreciate if anyone could help me out on this.
    Please note that i am not planning to run the report from Oracle Apps through concurrent program but this report will be imported into OBIEE dashborad for view purpose.
    Thanks,
    Regards,
    AS

    Hello Rainer,
    As mentioned, i have changed he header section and have removed the package reference from the SQL query and now it is showing some different error: "Please define p_order_number component". If i remove datatrigger and package reference in the first line it works fine. Following are the package and data template:
    <dataTemplate name="ShipPacketReport" description="Ship Packet Report" dataSourceRef="IPOVIS" defaultPackage="xx_shpckt_init" Version="1.0">
         <parameters>
              <parameter name="p_order_number" dataType="character" defaultValue="14156"/>
         </parameters>
         <dataQuery>
              <sqlStatement name="Q1">
                   <![CDATA[SELECT order_number, ordered_date, request_date, sold_to_org_id, header_id, shipping_method_code
                FROM oe_order_headers_all
               WHERE ORDER_NUMBER = :p_order_number
             ]]>
              </sqlStatement>
         </dataQuery>
         <dataTrigger name="beforeReport" source="xx_shpckt_init.beforeReportTrigger"/>
    </dataTemplate>
    Package:
    Create or replace package xx_shpckt_init AS
    function beforeReportTrigger return boolean;
    END;
    CREATE OR REPLACE PACKAGE BODY xx_shpckt_init
    AS
    function beforeReportTrigger return boolean as
    begin
    dbms_application_info.set_client_info('ORG_ID');
    return(true);
    end;
    end;
    Please note that i have created a parameter called p_order_number in report except from this data template, and have referred that parameter in the datatemplate and have created a LOV on the same. Is this what creating the problem?
    Please suggest.
    Thanks,
    Regards,
    AS
    Edited by: user9959418 on Nov 11, 2008 2:38 PM

  • DBMS_APPLICATION_INFO.SET_CLIENT_INFO

    Can I call this procedure via ODP.NET? I have been trying, and it has not been successful. A small code sample would be appreciated if this is possible.

    Now I'm completely lost. Trying to call SET_CLIENT_INFO is only an example of what you're having a problem with? SET_CLIENT_INFO is an example of what you want your procedure to do? Something else?
    A stored procedure cannot return status information to the caller until the end of the call. You can use DBMS_APPLICATION_INFO to indicate where a long-running call is, but you will need another session to read the information. If session 1 makes a long-running call, for example, your application will need a second thread and a second session in order to read the information set by the first session.
    You will want to read up on all the procedures in the DBMS_APPLICATION_INFO package, particularly SET_SESSION_LONGOPS if you intend on tracking the progress of a long-running procedure.
    Justin

  • How I can set ORG_ID context (for Oracle Apps Views) in ODI designer tool?

    Hi All,
    I want to get data from apps views (like OE_ORDER_HEADER_V) into our data warehouse detination table using ‘Oracle Data Integrator’ tool.
    The issue is that when I reverse Oracle Table or Synonym directly, everything works fine i.e. after 'Interface' execution, I can see how many rows imported into destination table from this source Oracle table/synonym.
    But when I use Apps view as a source then 'Interface' executes fine with ‘no error’ but NO rows imports to the destination table.
    I believe, the only difference is that I am not able to set Org_Id before executing ODI interface so it is not picking the data.
    Please let me know the steps/instructions to set org_id context on apps view then reverse in ODI Designer tool.
    Please note that I can set org_id using SQLPlus successfully as given below (and see data using the same Apps view). What to do in ODI designer tool to achieve similar data:
    begin
    fnd_global.apps_initialize(0, 21623, 660);
    mo_global.init('ONT');
    end;
    -- connect using apps/apps at Vision SQLPlus
    -- User_Id -> 0 (<-- SYSADMIN )
    -- Responsibility_Id-> 21623 (<-- Order Management Super User )
    -- Application_id -> 660 (<-- ONT )
    -- select count(*) from oe_order_headers_v where rownum < = 100
    I would appreciate your quick help in this.
    Thanks in advance.

    Set org context in 11i:
    ===============
    The SQL command to set the ORG_ID prior to running a script is:
    SQL> execute dbms_application_info.set_client_info(&org_id);
    Enter the org_id when prompted.
    If using Toad
    Begin
    fnd_client_info.set_org_context(&org_id);
    End;
    Set org context in R12
    ================
    The SQL command to set the ORG_ID prior to running a script is:
    SQL> exec mo_global.init('AR');
    exec mo_global.set_policy_context('S','&org_id');
    Enter the org_id when prompted.
    The procedure - mo_global.set_policy_context has two parameters
    p_access_mode & p_org_id
    p_access_mode Description
    S In case you want your current session to work against Single ORG_ID
    M In case you want your current session to work against multiple ORG_IDs
    p_org_id: Only applicable if p_access_mode is passed value of "S"
    If using Toad
    Begin
    mo_global.set_policy_context(‘S’, &org_id);
    End;

  • Invoking XML Publisher Report from PL/SQL

    Hi,
    I have a PL/SQL procecedure which invokes the Concurrent Request for the XML Publisher Report. This one finishes with a warning and I get 'Unable to publish output' when I try to view the output. Exact Error: "Unable to find the published output for this request "
    But if I run the same report using Concurrent program, the Report executes with no error. Also the desired output is coming. I am not sure where I am doing wrong in code.
    My code which invokes the XML Publisher Report (from PL/SQL package)is something like this:
    declare
    x boolean;
    l_no_of_copies varchar2(45);
    l_printername varchar2(45);
    l_print_style varchar2(45);
    l_result boolean;
    y number;
    begin
    x := fnd_request.add_layout (template_appl_name => 'XXTMG', template_code => 'XXT_5001_BOL_T', template_language => 'EN', template_territory => 'US', output_format => 'XML');
    l_no_of_copies := fnd_profile.VALUE ('XXTMG_SH_BOL_REPORT_NO_OF_COPIES');
    l_printername := fnd_profile.VALUE ('XXTMG_SH_BOL_REPORT_PRINTER');
    l_print_style := NULL; --For setting the Printer Options
    l_result := fnd_request.set_print_options (l_printername, l_print_style, l_no_of_copies, TRUE, 'N');
    l_result := fnd_request.add_printer (l_printername, 0);
    y := fnd_request.submit_request ('XXTMG', 'XXT_5001_BOL', '', TO_CHAR (SYSDATE, 'YYYY/MM/DD HH24:MI:SS'), FALSE, 'CH-120079') ;
    end;
    Please let me know where I might be going wrong
    Thanks

    Hi Sumit,
    You can try with this code:
    exec dbms_application_info.set_client_info(org_id)
    exec fnd_global.APPS_INITIALIZE(user_id,resp_id,appl_id);
    declare
    x boolean;
    l_no_of_copies varchar2(45);
    l_printername varchar2(45);
    l_print_style varchar2(45);
    l_result boolean;
    y number;
    begin
    x := fnd_request.add_layout ('XXTMG' --template_appl_name 
              ,'XXT_5001_BOL_T' --template_code
              ,'en' --template_language 
         ,'US' --template_territory
         ,'XML' --output_format
    if (x=TRUE) then
    y := fnd_request.submit_request (
                        'XXTMG'           --application 
                        ,'XXT_5001_BOL'      --program
                        ,SYSDATE          --start_time
                        ,FALSE               --sub_request
                        ,'CH-120079'          --argument1 (Program's Parameter)
    if y>0 then
              dbms_output.put_line('Request ID '||y);
    end if;
    end if; --if (x=TRUE) then
    end;
    Make sure that program has only one input parameter. If program has other parameters then you can pass those parameters like argument1, argument2... etc.
    Now you can see this submited request in your application using your user id. If you able to see your request in concurrent request then you can add printer parameters in this programs.
    You don't need to pass all 100 parameters.
    I am executing many programs/reports using this code.
    Thanks
    Ravi
    [email protected]
    Message was edited by:
    Ravi Tripathi

  • Database view initialization in BP Publisher report

    Hi,
    I am novice to BI Publisher and trying to create some sample report in BI Publisher. The data source for my report is database, hence i have written a query based on view from APPS database. when i try to run the report, it does not show any data coz i did not make org id initialization for view. Can anyone suggest me how can i initialize the view in BI publisher.
    Thanks for your help,
    Regards,
    AS
    Edited by: user9959418 on Nov 4, 2008 9:35 PM

    I am sorry if my question was not clear. I meant to say is, when you develop a report in Oracle reports 6i that time in case multi-org env, if we use views in our query then in before report trigger we use :
    begin
    dbms_application_info.set_client_info('ORG_ID);
    end;
    Is there any provision to use the same in case of BI publisher?
    I hope i am clear with my question.
    Thanks,
    Regards,
    AS

  • Setting oracle apps  appscontext (user/organization/responsibility) in ODI

    Hi All - Is there anyway we can setup appscontext (used in oracle applications/ebs suite) (user id/organization id/responsibility) before executing any stored procedures from ODI. This can be achieved in BPEL. We can set these as properties for oracle apps adapter (in BPEL) which will inturn execute our stored procedures. How do we achieve this in ODI?
    Thanks!

    Hi,
    I found this in my notes:
    To set the ORG_ID (Business Group) in a SQL*Plus session, use the following anonymous PL/SQL block:
    BEGIN
    fnd_client_info.set_org_context('<ORG_ID>'); --ORG_ID for Business Group ID
    END;
    or even simpler:
    exec dbms_application_info.set_client_info('<ORG_ID>'); --ORG_ID for Business Group ID
    I remember using it in order to be able to query on some Views that don't display any record, as they are based on the Business Group you are logged to. Once I used the EXEC.... command in SQL*Plus, the view displayed the corresponding information.
    Try researching if package DBMS_APPLICATION_INFO could be used to set the ORGANIZATION_ID (to identify the Organization or Plant). Note that ORGANIZATION_ID is different than ORG_ID (ORG_ID is used to identify the Business Group).
    Hope this helps.
    By the way, please reply back with what you find and tell us if it worked and how you used it.
    Regards,
    Ramon

  • Anonymous PL SQL block runs in 2 minutes but runs for 4 hours in Applicatio

    We are facing an issue with a custom code. When we run the custom code as anonymous pl/sql block , it completes in 2 minutes.
    But when we run the same from Oracle Application as a concurrent program, it runs for more than 4 hours.
    There is absolute no change in the code.
    Anyone faced this issue?

    Does your code use context sensitive views such as po_headers?
    Maybe you have not set the context in the pl/sql block so the view returns 0 records.
    But when you run it in Apps, the context is automatically set and so it processes a large number of records.
    Set the context if you have not and then try again.
    begin
    dbms_application_info.set_client_info('&org_id'); --
    end;
    Sandeep Gandhi

  • Invoice distributions No data return in SQLPLUS

    Hi,
    Following is my issue in SQLPLUS.
    I have query for one of the Invoice from ap_invoices where invoice_id = 471722. System returns rows.
    From ap_invoice_lines where invoice_id = 471722, System return rows.
    But, ap_invoice_distributions where invoice_id = 471722. No ROWS RETURN.
    Whereas , if we query the Invoice in the AP Invoice workbench there are distributions.
    Can you please help in this regard.
    Regards/Prasanth

    ap_invoice_distributions is a view based on ap_invoice_distributions_all.
    Do a select from ap_invoice_distributions_all where invoice_id = 471722.
    Alternatively, you can setup your context by executing the following before running your queries.
    begin
    dbms_application_info.set_client_info('&org_id');
    end;
    The org_id in the above script is the org_id from the invoice tables. It is the operating unit id.
    Hope this helps,
    Sandeep Gandhi

  • PO나 RELEASE를 INCOMPLETE로 만들기

    제품 : MFG_PO
    작성날짜 : 2003-05-14
    PO나 RELEASE를 INCOMPLETE로 만들기
    ============================
    PURPOSE
    Retry POs 'stuck'ed in process.
    Explanation
    The status of these POs will be reset to INCOMPLETE.
    The following SQLs are to be run on the Ct's sql*plus console.
    1> Do this step if you are a multi-org. Supply the org_id
    of the operating unit to which the POs document belong.
    Exec Dbms_Application_Info.Set_Client_Info(&Org_id);
    2>
    Run the following SQL, once for each stuck PO.
    Supply the PO_header_id of the concerning PO.
    UPDATE po_headers_all
    SET authorization_status = 'INCOMPLETE',
    wf_item_key= '',
    wf_item_type = ''
    WHERE po_header_id = &PO_HEADER_ID;
    3> COMMIT;
    history table은 delete할 필요가 없다.
    `re-approval받거나 아님 여러 history가 있을 경우는 오히려 조금 곤란함
    po_action_history
    update po_releases_all
    set wf_item_type = null,
    wf_item_key = null,
    authorization_status = 'INCOMPLETE'
    where po_release_id = &release_id;
    Example
    Reference Documents
    -------------------

  • Apps 11i  SET_CLIENT_INFO in Multi-Org environment

    How do you set the client info (dbms_application_info.set_client_info) in a portal session so reports have access to correct Operations ORG data in a multi-org environment

    Hi Hussein,
    Thanks for the quick response.
    Yes, I've gone thru both the notes specified below:
    Discoverer Workbooks Based On Organization Enabled Views Are Not Populated [ID 1293438.1]
    - Tried this option; but this option is messing up a couple of Oracle Standard Functionalities.
    - For ex: If i set this profile option; we are not able to create any receipts using Custom Responsibilities.
    I am able to create the receipt, when i remove this profile option.
    No Data Shows for Reports in Discoverer 10g with Applications Release 12 [ID 1054380.1]
    - I see that the products i am running these reports from AR/GL - already exists in these tables.
    Anything other options??
    Thanks,
    Kesava

  • Can I use the dbms_application_info package with ADF BC?

    Hi,
    I am executing a PL/SQL package from my ADF BC Application module and need to set some audit information within the PL/SQL. The package does some intensive background processing that would be time consuming to do in ADF. Can I use the dbms_application_info pakage to store session information for the user?
    I am not sure if the application module has a true database session with the database or is it pooled/shared with other users that may be logged on to the application?
    I want to use dbms_application_info.set_client_info and dbms_application_info.read_client_info.
    thanks,
    Brenden

    >
    If I created the new user what are the privileges shoud I grant him.You should grant EXPORT FULL DATABASE for exporting and IMPORT FULL DATABASE for importing.
    >
    I created one user testdba and granted DBA privileges as well full_export_database.
    after that I run catexp.sql with sys credential.
    While running the schema level export using testdba I am getting the below error:
    My Export scripts is
    exp testdba/password FILE=ALLEDW_edw2.dmp log=ALLEDW_edw2.log owner=ALLEDW grants=y indexes=y direct=y compress=y
    EXP-00008: ORACLE error 4068 encountered
    ORA-04068: existing state of packages has been discarded
    ORA-04063: view "TESTDBA.V_$OPTION" has errors
    ORA-06512: at "SYS.DBMS_AW", line 151
    ORA-06512: at "SYS.DBMS_AW_EXP", line 225
    ORA-06512: at line 1
    EXP-00083: The previous problem occurred when calling SYS.DBMS_AW_EXP.schema_inf
    o_exp
    EXP-00008: ORACLE error 980 encountered
    ORA-00980: synonym translation is no longer valid
    ORA-06512: at "SYS.DBMS_RULE_EXP_RULES", line 133
    ORA-06512: at line 1
    EXP-00083: The previous problem occurred when calling SYS.DBMS_RULE_EXP_RULES.sc
    hema_info_exp
    . exporting foreign function library names for user ALLEDW
    . exporting PUBLIC type synonymsDo You have any invalid objects in database?
    recompile them with $OARCLE_HOME/rdbms/admin/utlrp.sql

  • XML Publisher/Bi Publisher Using Oracle Package and MS Word Template builde

    My Question is I want to know more about grouping of elements while creating reports in E business suite.
    my approach should be 1. pl sql package with embedded XML data to create xml output. 2. Formatting the xml output using ms word template builder plugin.
    My question is if grouping is required, then where should it be? While creating package to generate xml output or while formatting xml o/p in ms word?
    I wanted to create a check cancellation report where the report should look like below.
    Bank Name American express
    Bank address 1 Cape town city Road
    bank address 2 Lane 2
    Bank City Cape town
    Branch Docara v'dola
    Check number Amount Vendor Status
    1023423 225 huawei Voided
    1023430 500 Ericson Voided
    Signature
    Now for above grouping I Written some thing like below package:
    But I want to know Had I not done the grouping in Package, would it have still be possible to do the grouping in MS Word template builder?
    To simply fy question: If I had not written 2 cursors and written 1 simple cursor and had got simple 1 after 1 fields without any specific grouping in ora package, would it have been possible to do the same grouping while formatting the xml output in MS word template builder?
    the part of code enclosed.
    begin
    DBMS_APPLICATION_INFO.SET_CLIENT_INFO(FND_PROFILE.VALUE('ORG_ID'));
    --fnd_file.put_line (fnd_file.output, '<?xml version = "1.0" encoding="ISO-8859-1"?>');
    fnd_file.put_line(fnd_file.output, '<G_HEAD>');
    for rec1 in c_bank_main
    loop
    fnd_file.put_line(fnd_file.output, '<G_BANK>');
    fnd_file.put_line (fnd_file.output,'<c_bank><![CDATA['|| rec1.c_bank ||']]></c_bank>');
    fnd_file.put_line (fnd_file.output,'<c_bank_acc><![CDATA['|| rec1.c_bank_acc ||']]></c_bank_acc>');
    fnd_file.put_line (fnd_file.output,'<c_bankadress1><![CDATA['|| rec1.c_bankadress1 ||']]></c_bankadress1>');
    fnd_file.put_line (fnd_file.output,'<c_bankadress2><![CDATA['|| rec1.c_bankadress2 ||']]></c_bankadress2>');
    fnd_file.put_line (fnd_file.output,'<c_bankadress3><![CDATA['|| rec1.c_bankadress3 ||']]></c_bankadress3>');
    fnd_file.put_line (fnd_file.output,'<c_bankcity><![CDATA['|| rec1.c_bankcity ||']]></c_bankcity>');
    fnd_file.put_line (fnd_file.output,'<c_branch><![CDATA['|| rec1.c_branch ||']]></c_branch>');
    for rec in c_bank_child(rec1.c_bank)
    loop
    fnd_file.put_line(fnd_file.output, '<G_CHECK>');
    fnd_file.put_line (fnd_file.output,'<c_currency_code><![CDATA['|| rec.c_currency_code ||']]></c_currency_code>');
    fnd_file.put_line (fnd_file.output,'<c_pay_currency_code><![CDATA['|| rec.c_pay_currency_code ||']]></c_pay_currency_code>');
    fnd_file.put_line (fnd_file.output,'<c_cleared_amount><![CDATA['|| rec.c_cleared_amount ||']]></c_cleared_amount>');
    fnd_file.put_line (fnd_file.output,'<c_nls_status><![CDATA['|| rec.c_nls_status ||']]></c_nls_status>');
    fnd_file.put_line (fnd_file.output,'<c_nls_status><![CDATA['|| rec.c_nls_status||']]></c_nls_status>');
    fnd_file.put_line (fnd_file.output,'<c_check_stock_name><![CDATA['|| rec.c_check_stock_name ||']]></c_check_stock_name>');
    fnd_file.put_line (fnd_file.output,'<status_lookup_code><![CDATA['|| rec.status_lookup_code ||']]></status_lookup_code>');
    fnd_file.put_line (fnd_file.output,'<c_check_number><![CDATA['|| rec.c_check_number ||']]></c_check_number>');
    fnd_file.put_line (fnd_file.output,'<c_sum_amount><![CDATA['|| rec.c_sum_amount ||']]></c_sum_amount>');
    fnd_file.put_line (fnd_file.output,'<c_vendor_name><![CDATA['|| rec.c_vendor_name ||']]></c_vendor_name>');
    fnd_file.put_line (fnd_file.output,'<c_doc_sequence_value><![CDATA['|| rec.c_doc_sequence_value ||']]></c_doc_sequence_value>');
    fnd_file.put_line(fnd_file.output, '</G_CHECK>');
    end loop;
    fnd_file.put_line(fnd_file.output, '</G_BANK>');
    end loop;
    fnd_file.put_line(fnd_file.output, '</G_HEAD>');
    end

    Hi,
    You can do grouping in either place. But ideally to avoid re-grouping in the BI Publisher Template your XML would be generated such that it is appropriate for your template.
    This is really important when it comes to very large datasets as you should avoid regrouping in the template in this case.
    Regards,
    Gareth
    http://garethroberts.blogspot.com
    http://www.virtuate.com

  • Process_Order API Error

    Hi to all,
    I want to create a new Sales Order using PL/SQL, so i used the process_order API to achieve this.
    I first set the client info using fnd_client_info.set_org_context(82) and then set the initialization parameters using fnd_global.apps_initilize (1090,21623,660).
    To get the initialization parameters i used this query:
    select fu.user_Id ,
    fur.responsibility_Id,
    fur.responsibility_application_Id,
    frt.responsibility_name
    from fnd_user fu,
    fnd_responsibility_tl frt,
    fnd_user_resp_groups fur
    where user_name = '<USER>'
    and fu.user_Id = fur.user_Id
    and fur.responsibility_Id = frt.responsibility_Id
    order by fur.responsibility_Id
    I then called my api but i get errors, such as ORA-01403: no data found and ORA-06512 at APPS.OE_ORDER_CACHE and ORA-01403 no data found in Package OE_ORDER_UTIL Procedure GET_ATTRIBUTE_NAME.
    Below is my code:
    BEGIN
         fnd_client_info.set_org_context(82);
         fnd_global.apps_initialize(1090,21623,660); -- pass in user_id, responsibility_id, and application_id     
    END;
    DECLARE
    --for get order
    x_return_status VARCHAR2(1000);
    x_msg_count NUMBER(20);
    x_msg_data VARCHAR2(1000);
    x_header_rec Oe_Order_Pub.Header_Rec_Type;
    x_header_val_rec Oe_Order_Pub.Header_Val_Rec_Type;
    x_Header_Adj_tbl Oe_Order_Pub.Header_Adj_Tbl_Type;
    x_Header_Adj_val_tbl Oe_Order_Pub.Header_Adj_Val_Tbl_Type;
    x_Header_price_Att_tbl Oe_Order_Pub.Header_Price_Att_Tbl_Type;
    x_Header_Adj_Att_tbl Oe_Order_Pub.Header_Adj_Att_Tbl_Type;
    x_Header_Adj_Assoc_tbl Oe_Order_Pub.Header_Adj_Assoc_Tbl_Type;
    x_Header_Scredit_tbl Oe_Order_Pub.Header_Scredit_Tbl_Type;
    x_Header_Scredit_val_tbl Oe_Order_Pub.Header_Scredit_Val_Tbl_Type;
    x_line_tbl Oe_Order_Pub.Line_Tbl_Type;
    x_line_val_tbl Oe_Order_Pub.Line_Val_Tbl_Type;
    x_Line_Adj_tbl Oe_Order_Pub.Line_Adj_Tbl_Type;
    x_Line_Adj_val_tbl Oe_Order_Pub.Line_Adj_Val_Tbl_Type;
    x_Line_price_Att_tbl Oe_Order_Pub.Line_Price_Att_Tbl_Type;
    x_Line_Adj_Att_tbl Oe_Order_Pub.Line_Adj_Att_Tbl_Type;
    x_Line_Adj_Assoc_tbl Oe_Order_Pub.Line_Adj_Assoc_Tbl_Type;
    x_Line_Scredit_tbl Oe_Order_Pub.Line_Scredit_Tbl_Type;
    x_Line_Scredit_val_tbl Oe_Order_Pub.Line_Scredit_Val_Tbl_Type;
    x_Lot_Serial_tbl Oe_Order_Pub.Lot_Serial_Tbl_Type;
    x_Lot_Serial_val_tbl Oe_Order_Pub.Lot_Serial_Val_Tbl_Type;
    --for adding a new line to process order
    x_header_rec2 Oe_Order_Pub.Header_Rec_Type;
    x_line_tbl2 Oe_Order_Pub.Line_Tbl_Type;
    x_action_request_tbl Oe_Order_Pub.Request_Tbl_Type;
    --for getting messages
    v_msg_data VARCHAR2(8000);
    v_msg_index_out NUMBER(10);
    CCIDGOOD varchar2(1);
    X_RETURN_CCID number;
    X_CONCAT_SEGS varchar2(250);
    X_CONCAT_IDS varchar2(250);
    X_CONCAT_DESCRS varchar2(250);
    -- X_MSG_COUNT number;
    X_ERRMSG varchar2(1000);
    X_ORDER_LINE_ID number;
    X_FLEX_NUMBER number;
    X_DEBUG_FILE varchar2(100);
    x_fnd_debug varchar2(32000);
    x_status boolean;
    p_ship_from number;
    BEGIN
    fnd_global.apps_initialize(1318,21623,660); pass in user_id, responsibility_id, and application_id
    --dbms_application_info.SET_CLIENT_INFO('82');
    fnd_global.apps_initialize(1090,21623,660); pass in user_id, responsibility_id, and application_id
    oe_debug_pub.initialize;
    X_DEBUG_FILE := OE_DEBUG_PUB.Set_Debug_Mode('TABLE');
    oe_debug_pub.SetDebugLevel(1); -- Use 5 for the most debuging output, I warn you its a lot of data
    Oe_Msg_Pub.initialize;
    -- Setting Up the Header Record
    -- initialize record to (a record template?)
    x_header_rec2 := OE_ORDER_PUB.G_MISS_HEADER_REC;
    -- required attributes (e.g. Order Type and Customer)
    x_header_rec2.order_type_id := 1001; -- You need a valid Order_Type
    x_header_rec2.sold_to_org_id := 1049; -- You need to have a valid Org_id for your Customer AR_CUSTOMERS_V.CUSTOMER_ID
    --x_header_rec2.invoice_to_org_id := 1025;
    x_header_rec2.ship_to_org_id := 1040; -- You need to have a valid SHIP_TO_ORG_ID
    --x_header_rec2.ship_from_org_id := 207;
    --x_header_rec2.sold_from_org_id := 204;
    --x_header_rec2.payment_term_id := 1020;
    x_header_rec2.cust_po_number := 'PONUMBERORDER';
    -- Pricing
    --x_header_rec2.price_list_id := 6041;
    -- Null attribute: no defaulting for freight terms
    -- check biz rules on this, copied from sample code
    --x_header_rec2.freight_terms_code := NULL;
    -- Indicates to process order that a new header is being created
    x_header_rec2.operation := OE_GLOBALS.G_OPR_CREATE;
    -- FIRST LINE RECORD
    --x_line_tbl2(1) := Oe_Order_Pub.G_MISS_LINE_REC;
    -- x_line_tbl2(1).inventory_item_id := 3178; -- Your INVENTORY_ITEM_ID VALUE goes here
    --x_line_tbl2(1).ordered_quantity := 2;
    --x_line_tbl2(1).operation := Oe_Globals.G_OPR_CREATE;
    IF TRUE THEN -- enable/disable toggle for Process_Order
    Oe_Order_Pub.Process_Order
    ( 1
    , Fnd_Api.G_FALSE
    , Fnd_Api.G_FALSE
    , Fnd_Api.G_FALSE
    , x_return_status
    , x_msg_count
    , x_msg_data
    --IN PARAMETERS
    , p_line_tbl => x_line_tbl2
    , p_header_rec => x_header_rec2
    --OUT PARAMETERS
    , x_header_rec => x_header_rec
    , x_header_val_rec => x_header_val_rec
    , x_Header_Adj_tbl => x_Header_Adj_tbl
    , x_Header_Adj_val_tbl => x_Header_Adj_val_tbl
    , x_Header_price_Att_tbl => x_Header_price_Att_tbl
    , x_Header_Adj_Att_tbl => x_Header_Adj_Att_tbl
    , x_Header_Adj_Assoc_tbl => x_Header_Adj_Assoc_tbl
    , x_Header_Scredit_tbl => x_Header_Scredit_tbl
    , x_Header_Scredit_val_tbl => x_Header_Scredit_val_tbl
    , x_line_tbl => x_line_tbl
    , x_line_val_tbl => x_line_val_tbl
    , x_Line_Adj_tbl => x_Line_Adj_tbl
    , x_Line_Adj_val_tbl => x_Line_Adj_val_tbl
    , x_Line_price_Att_tbl => x_Line_price_Att_tbl
    , x_Line_Adj_Att_tbl => x_Line_Adj_Att_tbl
    , x_Line_Adj_Assoc_tbl => x_Line_Adj_Assoc_tbl
    , x_Line_Scredit_tbl => x_Line_Scredit_tbl
    , x_Line_Scredit_val_tbl => x_Line_Scredit_val_tbl
    , x_Lot_Serial_tbl => x_Lot_Serial_tbl
    , x_Lot_Serial_val_tbl => x_Lot_Serial_val_tbl
    , x_action_request_tbl => x_action_request_tbl
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('process ORDER ret status IS: ' || x_return_status);
    DBMS_OUTPUT.PUT_LINE('process ORDER msg data IS: ' || x_msg_data);
    DBMS_OUTPUT.PUT_LINE('process ORDER msg COUNT IS: ' || x_msg_count);
    DBMS_OUTPUT.PUT_LINE('header.order_number IS: ' || x_header_rec.order_number);
    DBMS_OUTPUT.PUT_LINE('header.return_status IS: ' || x_header_rec.return_status);
    DBMS_OUTPUT.PUT_LINE('header.booked_flag IS: ' || x_header_rec.booked_flag);
    DBMS_OUTPUT.PUT_LINE('header.header_id IS: ' || x_header_rec.header_id);
    DBMS_OUTPUT.PUT_LINE('header.order_source_id IS: ' || x_header_rec.order_source_id);
    DBMS_OUTPUT.PUT_LINE('header.flow_status_code IS: ' || x_header_rec.flow_status_code);
    END IF;
    FOR i IN 1 .. x_msg_count LOOP
    Oe_Msg_Pub.get(
    p_msg_index => i
    ,p_encoded => Fnd_Api.G_FALSE
    ,p_data => v_msg_data
    ,p_msg_index_out => v_msg_index_out);
    DBMS_OUTPUT.PUT_LINE('message is: ' || v_msg_data);
    DBMS_OUTPUT.PUT_LINE('message index is: ' || v_msg_index_out);
    END LOOP;
    DBMS_OUTPUT.PUT_LINE('oe_msg_pub.count_msg = ' || Oe_Msg_Pub.count_msg);
    DBMS_OUTPUT.PUT_LINE('****************************************************');
    DBMS_OUTPUT.PUT_LINE('* OUTPUT FROM OM: DEBUG LEVEL PROFILE SETTING *');
    DBMS_OUTPUT.PUT_LINE('****************************************************');
    for i in 1..OE_DEBUG_PUB.g_debug_count loop
    dbms_output.put_line(OE_DEBUG_PUB.G_debug_tbl(i));
    end loop;
    OE_DEBUG_PUB.DEBUG_OFF;
    DBMS_OUTPUT.PUT_LINE('****************************************************');
    DBMS_OUTPUT.PUT_LINE('* SUMMARY OF RETURNED RESULTS *');
    DBMS_OUTPUT.PUT_LINE('****************************************************');
    DBMS_OUTPUT.PUT_LINE('Output Parameters: ');
    DBMS_OUTPUT.PUT_LINE('Debug = ' || OE_DEBUG_PUB.G_DEBUG);
    DBMS_OUTPUT.PUT_LINE('Debug Level = ' || to_char(OE_DEBUG_PUB.G_DEBUG_LEVEL));
    DBMS_OUTPUT.PUT_LINE('Debug File = ' || OE_DEBUG_PUB.G_DIR||'/'||
    OE_DEBUG_PUB.G_FILE);
    DBMS_OUTPUT.PUT_LINE('X_RETURN_CCID = ' || to_char(X_RETURN_CCID));
    DBMS_OUTPUT.PUT_LINE('X_CONCAT_SEGS = ' || X_CONCAT_SEGS);
    DBMS_OUTPUT.PUT_LINE('X_CONCAT_IDS = ' || X_CONCAT_IDS);
    DBMS_OUTPUT.PUT_LINE('X_CONCAT_DESCRS = ' || X_CONCAT_DESCRS);
    DBMS_OUTPUT.PUT_LINE('X_ERRMSG = ' || X_ERRMSG);
    DBMS_OUTPUT.PUT_LINE('****************************************************');
    END;
    Please someone help me as i am stuck for days and i need to complete this as soon as possible.
    Thanks
    Antonis

    Antonis,
    I am using following process which is working fine
    create or replace procedure tnq_so_import_api ( retcode number,errbuff
    varchar2)
    is
    --gmigapi.item_rec_typ;
    l_header_rec OE_Order_PUB.Header_Rec_Type;
    l_line_tbl OE_Order_PUB.Line_Rec_Type;
    l_line_adj_tbl OE_Order_PUB.Line_Adj_Rec_Type;
    l_header_scr_tbl OE_Order_PUB.Header_Scredit_Tbl_Type;
    l_header_adj_tbl OE_Order_PUB.Header_Adj_Val_Tbl_Type;
    l_line_scredit_tbl OE_Order_PUB.Line_Scredit_Rec_Type;
    l_return_status VARCHAR2 (1) := fnd_api.g_ret_sts_success;
    l_msg_count NUMBER;
    l_msg_data VARCHAR2 (10000);
    begin --@1
    -- SETTING UP THE HEADER RECORD
    -- Initialize record to missing
    l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
    -- Required attributes (e.g. Order Type and Customer)
    l_header_rec.order_type_id := 1000;
    l_header_rec.sold_to_org_id := 100;
    -- Other attributes
    l_header_rec.price_list_id := 10;
    -- Null attribute: no defaulting for freight terms
    l_header_rec.freight_terms_code := NULL;
    -- Indicates to process order that a new header is being created
    l_header_rec.operation := OE_GLOBALS.G_OPR_CREATE;
    -- FIRST LINE RECORD
    -- Initialize record to missing
    l_line_tbl := OE_ORDER_PUB.G_MISS_LINE_REC;
    -- Line attributes
    l_line_tbl.inventory_item_id := 311;
    l_line_tbl.ordered_quantity := 1;
    l_line_tbl.operation := OE_GLOBALS.G_OPR_CREATE;
    -- SECOND LINE RECORD
    -- Initialize record to missing
    --l_line_tbl(2) := OE_ORDER_PUB.G_MISS_LINE_REC;
    -- Line attributes
    --l_line_tbl(2).inventory_item_id := 312;
    --l_line_tbl(2).ordered_quantity := 2;
    --l_line_tbl(2).operation := OE_GLOBALS.G_OPR_CREATE;
    -- CALL TO PROCESS ORDER
    OE_Order_PUB.Process_Order
    ( -- Passing just the entity records that are a part of this order
    p_header_rec => l_header_rec
         ,p_line_tbl => l_line_tbl
         ,p_line_adj_tbl => l_line_adj_tbl
         -- OUT variables
         ,x_header_rec => l_header_rec
         ,x_header_scredit_tbl => l_header_scr_tbl
         ,x_header_adj_tbl => l_header_adj_tbl
         ,x_line_tbl => l_line_tbl
         ,x_line_scredit_tbl => l_line_scredit_tbl
         ,x_line_adj_tbl => l_line_adj_tbl
         ,x_return_status => l_return_status
         ,x_msg_count => l_msg_count
         ,x_msg_data => l_msg_data
    OE_Order_PUB.Process_Order
    ( -- Passing just the entity records that are a part of this order
    p_api_version_number IN NUMBER
    , p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
    , p_return_values IN VARCHAR2 := FND_API.G_FALSE
    , p_action_commit IN VARCHAR2 := FND_API.G_FALSE
    , x_return_status OUT VARCHAR2
    , x_msg_count OUT NUMBER
    , x_msg_data OUT VARCHAR2
    , p_header_rec IN Header_Rec_Type :=
    G_MISS_HEADER_REC
    , p_old_header_rec IN Header_Rec_Type :=
    G_MISS_HEADER_REC
    , p_header_val_rec IN Header_Val_Rec_Type :=
    G_MISS_HEADER_VAL_REC
    , p_old_header_val_rec IN Header_Val_Rec_Type :=
    G_MISS_HEADER_VAL_REC
    , p_Header_Adj_tbl IN Header_Adj_Tbl_Type :=
    G_MISS_HEADER_ADJ_TBL
    , p_old_Header_Adj_tbl IN Header_Adj_Tbl_Type :=
    G_MISS_HEADER_ADJ_TBL
    , p_Header_Adj_val_tbl IN Header_Adj_Val_Tbl_Type :=
    G_MISS_HEADER_ADJ_VAL_TBL
    , p_old_Header_Adj_val_tbl IN Header_Adj_Val_Tbl_Type :=
    G_MISS_HEADER_ADJ_VAL_TBL
    , p_Header_price_Att_tbl IN Header_Price_Att_Tbl_Type :=
    G_MISS_HEADER_PRICE_ATT_TBL
    , p_old_Header_Price_Att_tbl IN Header_Price_Att_Tbl_Type :=
    G_MISS_HEADER_PRICE_ATT_TBL
    , p_Header_Adj_Att_tbl IN Header_Adj_Att_Tbl_Type :=
    G_MISS_HEADER_ADJ_ATT_TBL
    , p_old_Header_Adj_Att_tbl IN Header_Adj_Att_Tbl_Type :=
    G_MISS_HEADER_ADJ_ATT_TBL
    , p_Header_Adj_Assoc_tbl IN Header_Adj_Assoc_Tbl_Type :=
    G_MISS_HEADER_ADJ_ASSOC_TBL
    , p_old_Header_Adj_Assoc_tbl IN Header_Adj_Assoc_Tbl_Type :=
    G_MISS_HEADER_ADJ_ASSOC_TBL
    , p_Header_Scredit_tbl IN Header_Scredit_Tbl_Type :=
    G_MISS_HEADER_SCREDIT_TBL
    , p_old_Header_Scredit_tbl IN Header_Scredit_Tbl_Type :=
    G_MISS_HEADER_SCREDIT_TBL
    , p_Header_Scredit_val_tbl IN Header_Scredit_Val_Tbl_Type :=
    G_MISS_HEADER_SCREDIT_VAL_TBL
    , p_old_Header_Scredit_val_tbl IN Header_Scredit_Val_Tbl_Type :=
    G_MISS_HEADER_SCREDIT_VAL_TBL
    , p_line_tbl IN Line_Tbl_Type :=
    G_MISS_LINE_TBL
    , p_old_line_tbl IN Line_Tbl_Type :=
    G_MISS_LINE_TBL
    , p_line_val_tbl IN Line_Val_Tbl_Type :=
    G_MISS_LINE_VAL_TBL
    , p_old_line_val_tbl IN Line_Val_Tbl_Type :=
    G_MISS_LINE_VAL_TBL
    , p_Line_Adj_tbl IN Line_Adj_Tbl_Type :=
    G_MISS_LINE_ADJ_TBL
    , p_old_Line_Adj_tbl IN Line_Adj_Tbl_Type :=
    G_MISS_LINE_ADJ_TBL
    , p_Line_Adj_val_tbl IN Line_Adj_Val_Tbl_Type :=
    G_MISS_LINE_ADJ_VAL_TBL
    , p_old_Line_Adj_val_tbl IN Line_Adj_Val_Tbl_Type :=
    G_MISS_LINE_ADJ_VAL_TBL
    , p_Line_price_Att_tbl IN Line_Price_Att_Tbl_Type :=
    G_MISS_LINE_PRICE_ATT_TBL
    , p_old_Line_Price_Att_tbl IN Line_Price_Att_Tbl_Type :=
    G_MISS_LINE_PRICE_ATT_TBL
    , p_Line_Adj_Att_tbl IN Line_Adj_Att_Tbl_Type :=
    G_MISS_LINE_ADJ_ATT_TBL
    , p_old_Line_Adj_Att_tbl IN Line_Adj_Att_Tbl_Type :=
    G_MISS_LINE_ADJ_ATT_TBL
    , p_Line_Adj_Assoc_tbl IN Line_Adj_Assoc_Tbl_Type :=
    G_MISS_LINE_ADJ_ASSOC_TBL
    , p_old_Line_Adj_Assoc_tbl IN Line_Adj_Assoc_Tbl_Type :=
    G_MISS_LINE_ADJ_ASSOC_TBL
    , p_Line_Scredit_tbl IN Line_Scredit_Tbl_Type :=
    G_MISS_LINE_SCREDIT_TBL
    , p_old_Line_Scredit_tbl IN Line_Scredit_Tbl_Type :=
    G_MISS_LINE_SCREDIT_TBL
    , p_Line_Scredit_val_tbl IN Line_Scredit_Val_Tbl_Type :=
    G_MISS_LINE_SCREDIT_VAL_TBL
    , p_old_Line_Scredit_val_tbl IN Line_Scredit_Val_Tbl_Type :=
    G_MISS_LINE_SCREDIT_VAL_TBL
    , p_Lot_Serial_tbl IN Lot_Serial_Tbl_Type :=
    G_MISS_LOT_SERIAL_TBL
    , p_old_Lot_Serial_tbl IN Lot_Serial_Tbl_Type :=
    G_MISS_LOT_SERIAL_TBL
    , p_Lot_Serial_val_tbl IN Lot_Serial_Val_Tbl_Type :=
    G_MISS_LOT_SERIAL_VAL_TBL
    , p_old_Lot_Serial_val_tbl IN Lot_Serial_Val_Tbl_Type :=
    G_MISS_LOT_SERIAL_VAL_TBL
    , p_action_request_tbl     IN Request_Tbl_Type :=
                             G_MISS_REQUEST_TBL
    , x_header_rec OUT Header_Rec_Type
    , x_header_val_rec OUT Header_Val_Rec_Type
    , x_Header_Adj_tbl OUT Header_Adj_Tbl_Type
    , x_Header_Adj_val_tbl OUT Header_Adj_Val_Tbl_Type
    , x_Header_price_Att_tbl OUT Header_Price_Att_Tbl_Type
    , x_Header_Adj_Att_tbl OUT Header_Adj_Att_Tbl_Type
    , x_Header_Adj_Assoc_tbl OUT Header_Adj_Assoc_Tbl_Type
    , x_Header_Scredit_tbl OUT Header_Scredit_Tbl_Type
    , x_Header_Scredit_val_tbl OUT Header_Scredit_Val_Tbl_Type
    , x_line_tbl OUT Line_Tbl_Type
    , x_line_val_tbl OUT Line_Val_Tbl_Type
    , x_Line_Adj_tbl OUT Line_Adj_Tbl_Type
    , x_Line_Adj_val_tbl OUT Line_Adj_Val_Tbl_Type
    , x_Line_price_Att_tbl OUT Line_Price_Att_Tbl_Type
    , x_Line_Adj_Att_tbl OUT Line_Adj_Att_Tbl_Type
    , x_Line_Adj_Assoc_tbl OUT Line_Adj_Assoc_Tbl_Type
    , x_Line_Scredit_tbl OUT Line_Scredit_Tbl_Type
    , x_Line_Scredit_val_tbl OUT Line_Scredit_Val_Tbl_Type
    , x_Lot_Serial_tbl OUT Lot_Serial_Tbl_Type
    , x_Lot_Serial_val_tbl OUT Lot_Serial_Val_Tbl_Type
    , x_action_request_tbl     OUT Request_Tbl_Type
    --For bug 3390458
    , p_rtrim_data IN Varchar2 :='N'
    -- Retrieve messages
    if l_msg_count > 0 then
    for l_index in 1..l_msg_count loop
         l_msg_data := oe_msg_pub.get(p_msg_index => l_index, p_encoded => 'F');
    end loop;
    end if;
    -- Check the return status
    if l_return_status = FND_API.G_RET_STS_SUCCESS then
    DBMS_OUTPUT.put_line ('Return Status =' || l_msg_data ||' Success ');
    else
    DBMS_OUTPUT.put_line ('Return Status =' || l_msg_data ||' Failure ');
    end if;
    exception --@1
    when others then
    fnd_file.put_line(fnd_file.log,' Exception others in main procedure @1
    :'||sqlerrm);
    end tnq_so_import_api;
    Check if you can get any help from this
    *** Regards
    Narender

  • Empty PO_DOCUMENT_TYPES table

    Hi,
    I am implementing an interface from a custom application to Oracle Financials, using the provided interface table.
    I also need to be able to cancel Purchase Orders on database level using
    po_document_control_pub.control_document (...)
    I keep getting the same error
    You do not have sufficient authority to control the status of this document.
    no matter which user, responsibility and application I initialize with.
    By looking at the stored procedure code line by line I deducted that the problem is, that there aren't any records in
    PO_DOCUMENT_TYPES (a synonym for PO_DOCUMENT_TYPES_VL)
    The control_document procedure uses this table to check the document type and document subtype and the access rights for the document type.
    If I take a look at PO_DOCUMENT_TYPES_ALL_B, I have all the records for the document types (f.i PO STANDARD, PO BLANKETT) and settings in there, but when selecting from PO_DOCUMENT_TYPES returns no records.
    Additionally, when I cancel a PO in the application itself, it works swimmingly. Only when I try to execute the stored procedure on the database level I can't read the document types.
    Therefore I am assuming, it is a security issue, or some configuration issue.
    I am not a Oracle developer or dba, so I don't know the first thing on how to proceed... please help.
    cheers, Heino

    You have initialized the user/resp/application but have you set your context?
    Select org_id from po_document_types_all. Let's say it is 123.
    This is the org_id you need to initialize your environment with.
    If you are on 11.5.10, add the following code before calling the api
    begin
    dbms_application_info.set_client_info(123);
    end;
    If you are on R12, use mo_global.set_policy_context.
    Hope this helps,
    Sandeep Gandhi

Maybe you are looking for