How to find org id for a cost center

I want to find org id for a cost center which is segment1.segment2.segment4.segment6(le.div.acctclass.other-516.203897.343.8978) of gl_code_combinations table from database. When I log on to a responsibility in apps, I can find out org id as a profile value. But how to find it from a database for that cost center?

Thanks Nagamohan. This functionality itself is working fine. But now when I am selecting the cost center from the table(the file is actually stored as an external table), lets say cc values are 010, 709, 840 each belongs to different responsibility, I get the value of the first responsibility initialized. So I think I will need to know the responsibility for each costcenter, pass resp id to initialize and then find out org id.
This is my code:
create or replace
PROCEDURE XXIU_AA_COSTCTR_FILE
p_file_path VARCHAR2,
P_FILE_NAME VARCHAR2)
AS
c_file_handle_w UTL_FILE.FILE_TYPE;
--end_of_file BOOLEAN := FALSE;
v_record VARCHAR2(1000);
V_ORG_ID VARCHAR2(3):= '123';
v_le varchar2(3);
CURSOR C_COSTCTR IS
SELECT cost_center_no, cost_center_name, LEVEL1 LE, LEVEL2 DIVISION, LEVEL3 ACCT_CLASS, STATUS, INTERCOMPANY_LE
FROM XXIU_AA_COSTCENTERS; {color:#993300}-- file stored as external table
{color}
BEGIN
c_file_handle_w := UTL_FILE.FOPEN(p_file_path, p_file_name, 'w');
FOR r in (select responsibility_id from fnd_responsibility where responsibility_id in ( 50001,50002,50822)) {color:#993300}--{color} {color:#993300}I have to find out resp id for each cost center in the loop to initialize apps for that cost center and get org id
{color}loop
fnd_global.apps_initialize(1234,r.responsibility_id,101);
FOR i in c_costctr loop
SELECT d.organization_id org_id, e.flex_value cost_center into v_org_id, v_le
FROM fnd_segment_attribute_values a, fnd_id_flex_segments b, gl_sets_of_books c, hr_operating_units d, fnd_flex_values e
WHERE a.id_flex_code = 'GL#'
AND a.segment_attribute_type = 'FA_COST_CTR'
AND b.flex_value_set_id = 1002590
AND a.id_flex_code = b.id_flex_code
AND a.attribute_value = 'Y'
AND a.application_id = b.application_id
AND a.id_flex_num = b.id_flex_num
AND b.id_flex_num = c.chart_of_accounts_id
AND c.set_of_books_id = d.set_of_books_id
AND b.flex_value_set_id = e.flex_value_set_id
AND e.flex_value = i.le
and d.organization_id=fnd_profile.value('ORG_ID')
and c.set_of_books_Id=fnd_profile.value('GL_SET_OF_BKS_ID')
and is_valid_on_security_rules(1002590,i.le)='T';
V_RECORD := RPAD(nvl(i.cost_center_no,' '),19, ' ')
|| RPAD(nvl(i.cost_center_name, ' '),100,' ')
|| RPAD(nvl(i.le, ' '),3, ' ')
|| RPAD(nvl(i.division, ' '), 6, ' ')
|| RPAD(nvl(i.acct_class, ' '), 6, ' ')
|| nvl(SUBSTR(i.STATUS,1,1), ' ')
|| RPAD(NVL(V_ORG_ID,' '),3,' ')
|| RPAD(NVL(i.intercompany_le, ' '),3,' ');
dbms_output.put_line(v_record);
utl_file.PUT_line(c_file_handle_w, v_record);
end loop;
end loop;
END XXIU_AA_COSTCTR_FILE;
Thanks,
Sravanthi
Edited by: SRANAY on Dec 6, 2008 8:49 PM

Similar Messages

  • How to set activity type for a cost center

    i was practicing the split valuation topic and for the that i was making a routing for a product so that i can have that product for inhouse production.
    while using ca01(to create routing), i am facing a problem with the activity type.
    when i am setting up the operation i am getting an error " activity type # is not set up for cost center 10004220 in year 2007"
    can you please tell me how should i come out of it.
    thankyou very much

    hi Nandha, i am sorry but i could not do it. i am new in this. let me make my problem more clear to you.
    i was creating a routing using ca01
    after puttig all the details i switched to operations tab and in operation tab i put workcenter as (1111 - lathe, may be i am wrong as i told you i am just practicing).
    i did not put anything on that screen and then when i pressed enter it took me to another screen with name Operation check.
    here is the layout of the problem on that screen
                          std val      unit     activity type     efficiency
    set up                            min        1422
    machine                         min        1421
    labor                              min        1420
    and then curser being on the std value i am getting this error "activity type 1422 is not set up for cost center 1000 4220 in the year 2007.when i am ignoring it it is switching to next std val coloumn and the same error.
    thankyou for your time

  • How to find table information for a datasource?

    Hi,
    Can you please tell me how to find table information for a datasource. I am not getting much help from help.sap.
    I am trying to find table information for below datasources. We are creating DSO's for the below mentioned datasources, for some we have standard DSO's(0WBS_O06), for others I am trying to create
    0CO_OM_NWA_1,
    0CO_OM_NWA_2,
    0CO_OM_WBS_1,
    0CO_OM_WBS_6
    Please help me.
    Regards,
    Bob.

    Hi BOB,
    Another option to find the table information...
    inorder to get the tables names involved in that particular data source follow the below steps.
    1) ST05 --> activate the Trace
    2) RSA3 --> enter your data source (for ex: 0CO_OM_NWA_1)
    3) Execute
    4) Now goto ST05 -> deactivate the trace
    5) click on Display trace(F7) button
    6) Execute
    7) It will display the complete SQL trace
    8) Now from the Menu "Trace list" --> select "Combined Table Access"
    it will display the complete tables list involved in that data source...
    From Table name section you can get the list of tables involved in that data source.
    I had traced and took the information of tables involved in that data source 0CO_OM_NWA_1
    0CO_OM_NWA_1     
    AFKO     Order header data PP orders
    AFVC     Operation within an order
    AUFK     Order master data
    COSP     CO Object: Cost Totals for External Postings
    COSPP     Transfer of the Order in the COSP Table to the Project
    COSS     CO Object: Cost Totals for Internal Postings
    COSSP     Transfer of the Order COSS Table to the Project
    COVREF     Coverage Reference Table: All Processing Blocks
    COVRES     Table of Coverage Results
    You can follow the same steps and find the tables for the rest.
    Regards
    KP

  • How to find serial Number for BCC Plugin?

    Hi,
    How to find serial number for Bcc plugin on FCP?
    I need format my Mac so before that I to find the serial number?
    Please anyone can help me....

    The serial number has the format like E-111-aaa-222-bbb-333-ccc-444-ddd-5ee-ffff, it can be found on a piece of paper which has 3 stickers with it inside the box.

  • How to find function code for buttons on toolbar in oops alv

    Hi experts,
    I want to remove some buttons from toolbar in oops alv, i know the procedure like get function code and pass the value in a table and pass that table to IT_TOOLBAR_EXCLUDING of
    method set_table_for_first_display but I WANT TO KNOW HOW TO FIND FUNCTION CODE FOR BUTTONS ON TOOLBAR IN OOPS ALV

    Hi Prakash,
    -->First you have to set the pf status in your alv program by,
    {FORM pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'FIRST'.
    ENDFORM.                    "PF_STATUS}
    -->Pass this Subroutine name in the Function module, Reuse_alv_grid_display's parameters i.e,
          i_callback_pf_status_set          = 'PF_STATUS'}
    *-->Then doble click on that pf status,
    From the menu bar, select Extras->Adjust Template->List Viewer,
    This will give you the existing statndard gui status of the program*
    ->Then catch that function codes in the User command Parameter of the Function module Reuse.. i.e,
          i_callback_user_command           = 'COMM'
    And make a subroutine of the name 'COMM'i.e,
    FORM comm USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
      DATA: okcode TYPE sy-ucomm.
      okcode = ucomm.
      CASE okcode.
        WHEN 'REF'.
        CALL FUNCTION 'POPUP_TO_INFORM'
          EXPORTING
            titel         = 'MANSI'
            txt1          = 'CREATED BY'
            txt2          = SY-UNAME
          TXT3          = ' '
          TXT4          = ' '
    endcase.
    Hope it helps you
    Regrds
    Mansi

  • How to find workarea ID for the work area name.

    Hi Experts..
    How to find workarea ID for the work area name.(Work area name CCIHT_WAH-WAID and I want to fetch characteristic data from table AUSP matching the OBJEK field,but I only have Work area name).Can anybody help me to find tables or relationship between Workarea ID and Workarea name for the same.I am using TCODE - CHIB02.Once I select a workarea and click on IHS Data button,I get data for that workarea.I need to find where this data comes from and How is this fetched.
    Points would be rewarded for helpful answers..
    Thanks
    Kunal Halarnakar

    U want to fetch the workarea description ?
    we can fetch it from CCIHT_WALD table with the RECN value.
    The informations are stored in AUSP table with the characterstic(ATINN) value.

  • How to find the Names of Most costly Views or Most Time consuming views

    Hi All,
    I had a database consisting of almost 200 views,as a part of Optimization process i want to find out the most costlier views.How to do that.Actually i want the names of the VIEWS,so that i can optimize that.Can any one help me out?
    I had one more doubt in our Database a view is created like view A( which is created by joining several tables).so do i need to add index on this view separately or does it take the index of the tables which i joined? And in our Database i  had created
    a VIEW which is derived from other views(the Joining objects are views not tables),so while i select recoreds from this views which is derived from other views it is taking a lot of time.Is tehre any problem with that?

    Please avoid such double post spread over several forums:
    http://social.msdn.microsoft.com/Forums/en-US/bae4042a-10b8-4d12-aa46-88a05ea37a76/how-to-find-the-names-of-most-costly-views-or-most-time-consuming-views?forum=sqldataaccess
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • How to find print preview for purchase order like what we find in va03

    hi guru's
    how to find print preview for purchase order like what we find in va03
    let me share ur information
    thank u

    Hi
    You can see the Print Preview/printout etc using the Transaction ME9F for Purchase Order
    Execute the ME9F tcode and execute you will get lot of PO's select any Po and press display message
    you will see the print preview
    Similarly for RFQ output use the Tcode ME9A
    for Contrat use ME9K
    for GR output use MB90
    Reward points for useful Answers
    Regards
    Anji

  • How to find the difference between Project costs & Cost center costs?

    Hi all,
    Can you please explain me ? What is project Cost & Cost center cost and which are the tables having those fields of project cost & cost center Costs? And how to find the difference between their costs ? And please give me the functional Idea about it?
    Thanking you all in Advance...
    Regards,
    Chandru

    Hi,
    goto table COSP:
    1) object-no. beginning with 'KS' refer to cost-centre
       example: 'KSKOKA4711'
       with KS, KOKA = controlling area and 4711 = cost centre
    2) OBJNR beginning with 'PR' refer to projects / WBS-element
       example PR00001234
    Message was edited by: Andreas Mann

  • How to find the patches for perticular concurrent program

    HI
    How to find the patches for perticular concurrent program. suppose for one concurrent program we create the patch and applied now i want know the which patch applied for perticular concurrent program through back end.
    Thank's

    Query the concurrent program in Sysadmin responsibility.
    Note the concurrent executable.
    Query the concurrent executable in Sysadmin.
    Note the file name.
    If it is a package, open the package in TOAD and note down the file name.
    If it is a report/form, open it in form developer and note down the file name.
    Go to patch find screen in metalink. In the advanced search screen, enter the file name and you will see patches that contain it.
    Hope this answers your question
    Sandeep Gandhi
    Independent Consultant
    513-325-9026

  • HOw to  find the text for PERSK field in infotype 0001

    hi all
    HOw to  find the text for PERSK field in infotype 0001

    Hi
    T503T : contained the similar informative text for PERSK . read this for T503T-PTEXT.
    ..lakhan

  • How to find MATCH count for #  in a String

    Hi all,
    How to find MATCH count for #  in a String.
    Ex:  6170#0400-0002-00#API3PT#AL#AUST#DEVE#KG#100.00#100.00#100.00#0.00##10.20
    Regards,
    Balavardhan.K

    >
    balavardhan k wrote:
    > I have used below syntax to find count but it is not returning the value and SY-SUBRC  = 4.
    >
    >
    > Data : l_text type string.
    >
    > l_text = '6170#0400-0002-00#API3PT#AL#AUST#DEVE#KG#100.00#100.00#100.00#0.00##10.20'.
    >
    >
    > FIND ALL OCCURRENCES OF '#' IN L_TEXT MATCH COUNT mcnt .
    Then it's not a # but possible a horizontal tab-sign.
    Do a find on cl_abap_char_utilities=>horizontal_tab instead.
    Edited by: Maen Anachronos on Nov 23, 2010 2:48 PM

  • How to find system status for production orders?

    How to find system status for production orders?
    looked into table AUFK, AFKO and AFVC but none of these tables, carry
    system status as part of the fields(STTXT)
    I tried to filter in COOIS, but not much help
    Able to find system status information in COHV,Is there any other way where
    I can find system status information for production orders
    Kindly guide

    Hi,
    Look into table, JEST, JSTO, AFPO & AFKO. CAUFV filed OBJNR, TJ02T filed ISTAT.
    But, it is very difficult to combine the details like Order and System status.
    Take the help of your ABAPer to generate Report for you.
    Regards,
    Siva

  • How to find condition  type for a particular material document no.

    hiiiiii
    How to find condition type for a particular material document no.

    Hi
    Condition types are maintained at PO level
    Take the EKKO-KNUMV and pass to
    KONV-KNUMV field and take the different condition types values from KONV
    Take the Material Document No (MBLNR) and pass to MSEG table and take the EBELN field and from EKKO table take EKKO-KNUMV field and pass to KONV
    see the table T685 for different condition types.
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • How to find condition type for a material???

    How to find condition type for a material??

    Hi Suman.
    Refer the following
    tcodes:http://www.tcodesearch.com/sap-tables/search?q=condition+types
    and http://wiki.scn.sap.com/wiki/display/Snippets/Get?original_fqdn=wiki.sdn.sap.com
    Please search for condition type with pricing condition/pricing procedure.
    Regards,
    Kannan

Maybe you are looking for

  • How to get my_text in the CENTER aligned on my_form?

    Hello I put  a text field (say, its name is 'my_field' 80 characters length) WITH OUT caption and NONE appearence (not Solid box, no Sunken box). And i am populating/filling this field with some value PROGRAMATICALLY. Pre-Populating value is vary in

  • I want to create an ID for my company for client review

    I have a personal account, ID but I want to set up an ID for my company to share edits for the client review option in cs live

  • 2nd display turns black  - yet can be prompted on for brief time

    This morning the 2nd monitor went black.  Power is fine and cables have been checked.  When I push power button to the monitor on and off the screen will display for roughly one second.  then black again.  same happens on a restart. any ideas? Thanks

  • Vendor Classification Issue very urgent

    Hi Guys     I have to show the report with Geo Characteristics in my Vendor Master . When I see the attributes I can see 0POSTCD_GIS . Which is Geo relavant. I have also 0LONGITUDE and  0LATITUDE etc....Now when Load Master Data for vendor I found no

  • 2 AM Advertising for VZ Navigator - LG Cosmos Touch

    Ever since I purchased my LG Cosmos Touch I've been bombarded nightly at around 2 AM  among other times to download the VZ Navigator application. This is not a phone call, but the same advertisement that plays as if you don't have VZ Navigator instal