How to find out company code from a plant ?

Hello friends,
I have to modify a program that uses FM "BAPI_COMPANYCODE_GET_PERIOD".   For that, we have to export company code ID.  Currently it is hard coded with one company code.  Now we want to make this program usable by all company codes.  So instead of hard coding, I would like to dynamically find out company code based on the plant.   So I want to know - how to find out company code from a plant ?  Is there any table that has plant to company-code assignment data, or any other FM/BAPI to get this info ?
Thanks,
- Chetan

hi
u can find this from table T001K
or just goto EC01
here click on STRUCTURE>NAVIGATION
double click on co code u will get the list
u can slo try this in EC02
regards
kunal

Similar Messages

  • How to find out Company code from Plant in BW

    Hi,                                                      This is probably a very basic question.                                 
    In one of my ODSs, I have 0PLANT infoobject but do not have the Company Code. I thought 0COMP_CODE should have been an attribute of 0PLANT. But it is not and I am NOT finding anyway to derive the company code from the Plant code.                              
    I guess I can change my datasource to get that value but thought the Plant-->Company Code link is one of the most basic things in SAP R/3.    
    I cannot imagine it can be missed in the Business Content design by SAP.  
    So thought I would check with you to see if my expectation is correct.    
    If not, what might have been the reason behind the exclusion of the link between Plant and Company Code from the Business Content.                                                                               
    Thanks and regards,                                                       
    Atul Kulkarni

    Hi,
    we are running RETAIL and by design:
    a plant (0PLANT ) belongs to a sales organization (0SALESORG attr of 0PLANT) which belongs to a company code (0COMP_CODE attr of 0SALESORG)
    this defines a unique comp_code for a plant.
    You can therefore put the following two fields in an internal table of a start routine
    SELECT pPLANT sCOMP_CODE
    INTO CORRESPONDING FIELDS OF TABLE lt_internal
    FROM /BI0/PPLANT p
    INNER JOIN  /BI0/PSALESORG s ON sSALESORG = pSALESORG
      AND sOBJVERS= pOBJVERS
      AND s~OBJVERS = 'A'.
    and look it up in your IObj routine.
    In R/3 that's true WERKS (T001W9 belongs to a BWKEY (T001K) which belongs to a BUKRS.
    hope that helps...

  • HOW TO  FIND OUT TABLE DESCRIPTION FROM JDBC?

    HOW WILL FIND OUT TABLE DESCRIPTION FROM JDBC?

    Have a look at ResultSetMetaData
    getColumnCount()
    getColumnName(int)
    getColumnTypeName(int)
    getColumnDisplaySize(int)
    ***Annie***

  • How to find out the user from the Jobs queue in Report server

    Hello All!
    I have a doubt about finding out the user from the scheduled jobs queue. Say I go ahead and schedule a report on Reports Server how can I find out the user name. When I view the jobs using showjobs I could see that the DBMS_JOBS table has a column under "Job Owner". But it invariantly shows it is "rwuser". So is there a way to find out which user has scheduled which job?
    Regards
    Shobha

    hi,
    The below tables will give only the name .
    USER_ADDRS
    USER_ADDR
    USER_ADDRP
    USR02
    i think you need email address .
    you can use this Tcode : su01d
    and give the user name and excute it
    i hope it will help you.
    Ram
    Edited by: Ram velanati on Jun 30, 2008 6:57 PM

  • How to find out histotry command from other session

    Hi gurus,
    I use RHEL 5.4
    Some user log onto server with root and make change at some files. How can I find out history command from other session with the same user.
    history command is just give me history commands of my own session.
    Thanks
    Ch

    The file which holds the commandline history is .bash_history in the home directory of the user.
    So in the case of root, /root/.bash_history
    Please mind that if you log in as root, or become root your session will add to that file as well.
    Another issue with the history file is that when multiple sessions are logged in, every session writes in its own version of the same file. So the last one "wins", which means that version is the one which is truly stored.
    If files are changed, a find command with the 'mtime' parameter should be helpful.

  • How to find out the metachian from subchain

    hello friends,
    could you please let me know , how to find out the meta chain from subchian .
    I know the subchain name and wanted to check that this chian is included in which meta chian ,
    actaully here so many chain , so its confusing .
    Is there any way ?

    Hi,
    Pls chk this links,
    Re: Meta chains - how to create n example scenerios
    Re: How to create process chains, infopackage groups & Meta chains
    Hope this helps,
    regards
    CSM reddy

  • How to find out the tables from extract structures

    Hi All,
    As I know my data sources are 2lis_04_p_matnr,2lis_04_p_comp,2lis_04_p_arbpl.
    How to find out the tables concerned with the fields in the extract structure.
    Thanks

    Pl check this link:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/29/79eb3cad744026e10000000a11405a/frameset.htm
    OR navigate to: help.sap.com - netweaver - bi content - supply chain - look for your application area and the extractor and you will see the source tables and fields.
    Ravi Thothadri

  • How to find out material code using web services?

    Hi,
    Is there a WSDL to find out material code of a componet if only inventory ID is known?
    Regards
    Kari

    Thanks

  • How to find out source code of portal

    Hi all,
        I'm working ECC6.0.
        In the portal there is a field managers substitute , when ever manager enteres . managers substitute name will populate.   the portal is constructed long back . it uses jsp.  I found out that portal applicarion calls from the jsp link of another server. i can view only  the application but i want to know where the souce code is available . potal calls the function module or table to get managers substite .i need to find out FM or filed name.
    thanks
    Naveen

    Hi all,
        I'm working ECC6.0.
        In the portal there is a field managers substitute , when ever manager enteres . managers substitute name will populate.   the portal is constructed long back . it uses jsp.  I found out that portal applicarion calls from the jsp link of another server. i can view only  the application but i want to know where the souce code is available . potal calls the function module or table to get managers substite .i need to find out FM or filed name.
    thanks
    Naveen

  • How to find out T code wise BADI and userexits

    Hi,
    Is there any standard way of finding out the BADIs and User exits Tcode wise.
    regards,
    Kannan.

    Hi,
    Use the following program to get the T code wise BADI and user exits.
    *& Report  ZSD_FINDEXIT_BADI                                           *
    REPORT  ZUSEREXIT                      .
    TABLES : TSTC,
    TADIR,
    MODSAPT,
    MODACT,
    TRDIR,
    TFDIR,
    ENLFDIR,
    SXS_ATTRT ,
    TSTCT.
    DATA : JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE.
    DATA : FIELD1(30).
    DATA : V_DEVCLASS LIKE TADIR-DEVCLASS.
    PARAMETERS : P_TCODE LIKE TSTC-TCODE,
    P_PGMNA LIKE TSTC-PGMNA .
    DATA wa_tadir type tadir.
    START-OF-SELECTION.
    IF NOT P_TCODE IS INITIAL.
    SELECT SINGLE * FROM TSTC WHERE TCODE EQ P_TCODE.
    ELSEIF NOT P_PGMNA IS INITIAL.
    TSTC-PGMNA = P_PGMNA.
    ENDIF.
    IF SY-SUBRC EQ 0.
    SELECT SINGLE * FROM TADIR
    WHERE PGMID = 'R3TR'
    AND OBJECT = 'PROG'
    AND OBJ_NAME = TSTC-PGMNA.
    MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
    IF SY-SUBRC NE 0.
    SELECT SINGLE * FROM TRDIR
    WHERE NAME = TSTC-PGMNA.
    IF TRDIR-SUBC EQ 'F'.
    SELECT SINGLE * FROM TFDIR
    WHERE PNAME = TSTC-PGMNA.
    SELECT SINGLE * FROM ENLFDIR
    WHERE FUNCNAME = TFDIR-FUNCNAME.
    SELECT SINGLE * FROM TADIR
    WHERE PGMID = 'R3TR'
    AND OBJECT = 'FUGR'
    AND OBJ_NAME EQ ENLFDIR-AREA.
    MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
    ENDIF.
    ENDIF.
    SELECT * FROM TADIR INTO TABLE JTAB
    WHERE PGMID = 'R3TR'
    AND OBJECT in ('SMOD', 'SXSD')
    AND DEVCLASS = V_DEVCLASS.
    SELECT SINGLE * FROM TSTCT
    WHERE SPRSL EQ SY-LANGU
    AND TCODE EQ P_TCODE.
    FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
    WRITE:/(19) 'Transaction Code - ',
    20(20) P_TCODE,
    45(50) TSTCT-TTEXT.
    SKIP.
    IF NOT JTAB[] IS INITIAL.
    WRITE:/(105) SY-ULINE.
    FORMAT COLOR COL_HEADING INTENSIFIED ON.
    Sorting the internal Table
    sort jtab by OBJECT.
    data : wf_txt(60) type c,
    wf_smod type i ,
    wf_badi type i ,
    wf_object2(30) type C.
    clear : wf_smod, wf_badi , wf_object2.
    Get the total SMOD.
    LOOP AT JTAB into wa_tadir.
    at first.
    FORMAT COLOR COL_HEADING INTENSIFIED ON.
    WRITE:/1 SY-VLINE,
    2 'Enhancement/ Business Add-in',
    41 SY-VLINE ,
    42 'Description',
    105 SY-VLINE.
    WRITE:/(105) SY-ULINE.
    endat.
    clear wf_txt.
    at new object.
    if wa_tadir-object = 'SMOD'.
    wf_object2 = 'Enhancement' .
    elseif wa_tadir-object = 'SXSD'.
    wf_object2 = ' Business Add-in'.
    endif.
    FORMAT COLOR COL_GROUP INTENSIFIED ON.
    WRITE:/1 SY-VLINE,
    2 wf_object2,
    105 SY-VLINE.
    endat.
    case wa_tadir-object.
    when 'SMOD'.
    wf_smod = wf_smod + 1.
    SELECT SINGLE MODTEXT into wf_txt
    FROM MODSAPT
    WHERE SPRSL = SY-LANGU
    AND NAME = wa_tadir-OBJ_NAME.
    FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
    when 'SXSD'.
    For BADis
    wf_badi = wf_badi + 1 .
    select single TEXT into wf_txt
    from SXS_ATTRT
    where sprsl = sy-langu
    and EXIT_NAME = wa_tadir-OBJ_NAME.
    FORMAT COLOR COL_NORMAL INTENSIFIED ON.
    endcase.
    WRITE:/1 SY-VLINE,
    2 wa_tadir-OBJ_NAME hotspot on,
    41 SY-VLINE ,
    42 wf_txt,
    105 SY-VLINE.
    AT END OF object.
    write : /(105) sy-ULINE.
    ENDAT.
    ENDLOOP.
    WRITE:/(105) SY-ULINE.
    SKIP.
    FORMAT COLOR COL_TOTAL INTENSIFIED ON.
    WRITE:/ 'No.of Exits:' , wf_smod.
    WRITE:/ 'No.of BADis:' , wf_badi.
    ELSE.
    FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
    WRITE:/(105) 'No userexits or BADis exist'.
    ENDIF.
    ELSE.
    FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
    WRITE:/(105) 'Transaction does not exist'.
    ENDIF.
    AT LINE-SELECTION.
    data : wf_object type tadir-object.
    clear wf_object.
    GET CURSOR FIELD FIELD1.
    CHECK FIELD1(8) EQ 'WA_TADIR'.
    read table jtab with key obj_name = sy-lisel+1(20).
    move jtab-object to wf_object.
    case wf_object.
    when 'SMOD'.
    SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).
    CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
    when 'SXSD'.
    SET PARAMETER ID 'EXN' FIELD SY-LISEL+1(20).
    CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.
    endcase.
    Hope this will help u.
    regards,
    Naidu
    Edited by: KANNAN on Apr 13, 2009 1:44 PM

  • How to find out portal user from sso cookie ?

    Hi,
    I want to find out the portal user id from Portal30_sso cookie. It is required for security in my java servlet.
    Thanks
    Vikas

    First of all, you can't get anything from the portal30_sso cookie or the portal30 cookie or the SSO_ID cookie. These are cookies established for (1) The login server session; (2) The Portal session; (3) The login server single sign-on cookie - visible only to the login server.
    When you want to know who the current user is, you need to establish the context. If your servlet is standalone and not a partner application to the login server and it's not a portlet, etc., then what context does it have? What concept of users does it have? If you are really asking what Portal is currently logged on, that is still a loaded question. The user's browser could be accessing several portal's at the same time, each with a different identity. What I am getting at is that your servlet needs to somehow be associated with a particular portal before it can even think of asking this question.
    The ways to associate your servlet with a portal would be
    [list=1]
    [*]Make it a partner application
    [*]Make it a portlet
    [*]Make it an external application
    [list]
    Hope that helps.

  • How to find out the code behind a button

    Hi,
    What technique should I use to find out what java code is invoked when I click on a button in the portal?
    More concrete: I want to know the code behind the button I'm talking about <a href="https://forums.sdn.sap.com/thread.jspa?threadID=188251">here</a>.
    T h a n k s !
    Jeroen

    I would suggest you use HTTPWatch in your browser to see what is happening behind you button click.
    You can get it here
    <a href="http://www.simtec.ltd.uk/">http://www.simtec.ltd.uk/</a>

  • How to find out spool number from a jobname.

    Hi,
    If I know the jobname and jobcount how to find the spool number of it. Jobname and Jobcount are in table TBTCO and spool number is in TSP01. Is there any link between these tables.
    Your help will be appreciated.
    Thanks & Regards,
    Soumya.

    Hi,
    Check the below link
    [Re:Spool request;
    Regards,
    Surinder

  • How to find out  fn calls  from portal.

    can anyone help me to find out  fn calls in xrpm portal?
    steps!

    You can use the following steps for doing it in portal
    Open two sessions of SAP EP with the same user
    Navigate to: Portfoliomanagement – Administration – Cache Administration – RFC Debugging (first session)
    Activate the Debugging
    Execute xRPM application in the second session
    Switch back to the RFC Debugging press Load
    Select the executed function
    All parameters will be displayed in the Context Input window
    if you need to do debugging in backend !
    make sure to swithch to new editor.
    regards@gopeekrishnan

  • How to find out what code called the procedure

    Hi,
    I'm doing an error logging api, that will log errors when it's called. What I wasn't to know is if there's a way to find out what procedure/function called the api?
    One way is to pass the function as a text variable but it would be cool if the api could find out who called it.
    Hope i made myself clear :-)

    I think you can use DBMS_UTILITY.FORMAT_CALL_STACK (I assume that's also what Tom K is using in his utility - with a nice wrapper around it).
    Look at this example:
    SQL>CREATE OR REPLACE procedure p as
      2  begin
      3   dbms_output.put_line(dbms_utility.format_call_stack);
      4  end;
      5  /
    Procedure created.
    SQL>CREATE OR REPLACE procedure p2 as
      2  begin
      3    p;
      4  end;
      5  /
    Procedure created.
    SQL>CREATE OR REPLACE procedure p3 as
      2  begin
      3    p2;
      4  end;
      5  /
    Procedure created.
    SQL>exec p3;
    ----- PL/SQL Call Stack -----
      object      line  object
      handle    number  name
    38aad05a8         3  procedure HRM.P
    38aaa6990         3  procedure HRM.P2
    38aa9f470         3  procedure HRM.P3
    38a6e9d88         1  anonymous block
    PL/SQL procedure successfully completed.
    SQL>

Maybe you are looking for

  • Report Performance degradation

    hi, We are using around 16 entities in crm on demand R 16which includes both default as well as custom entites. Since custom entities are not visible in the historical subject area , we decided to stick to the real time reporting. Now the issue is ,

  • How to Create authorization WAD template for BW3.5?

    Hi All How To create Authorization for a Web template in Bw 3.5 ? I have a requirement to restrict a particular Web templated in bw 3.5 So that all the end users should not be able to access that template only a particular user should be allowed to v

  • Getting error when creat sales order and Stock Posting

    Hi I have created enterprise structure, xd01, mm01, ovkk but I count't post stock. When create sales order getting error is that 1.This material is not defined for sales area 1000, 10, 00. And if i use this T.Code MB1C, 2. Parameters for plant 1000 n

  • Ajax implementation on my JSP PAGE

    Hi.. In my jsp page I am uploading *.XLS file and in the nest page I am Selecting the sheets in that .XLS file, I want to implement AJAX so that I can upload the (.XLS file) and select the sheets in the .XLS file in Single JSP file Can any one know h

  • Safari 8: Quicktime vs. DivX plugin

    Hi there, with the news Safari 8 I have a problem: the DivX plugin is become the 'standard' plugin player for .mov files It happens at the system level, it is not a user problem and it happens on several computers with OS X Yosemite upgraded from pre