To get address numbers based on building code

Hi All,
Here is my requirement.
I need to select all address numbers from ADRC table based on building code.
For instance, say I want all address numbers where building code = ABC.
I can write a simple inner join query between ADRC & ADCP.
But the problem is, the ADRC table can have multiple address numbers. Say,  for a specific Partner number & Person number, the ADRC table has following 3 entries. Lets say 3rd one is valid.
Addr 1 = XYZ'.
Addr2 = 'ABC'.
Addr3 = 'MNO'.
Now if I use that select query, it will fetch the second one, though it is the older one which is not valid anymore.
Is there any fields in ADRC with which we can decide which is the recent valid address number?
Kindly provide your valuable help for this scenario.

Is there any fields in ADRC with which we can decide which is the recent valid address number?
Would DATE_FROM and DATE_TO fields help you with validity of the address?

Similar Messages

  • FM to get open period based on company code

    Could you pls tell me the FM which can get open period based on the company code?
    right answer will be rewared for sure.
    Sujatha

    Hi,
    I m not sure. Just check this out.
    CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
        EXPORTING
          companycodeid = p_bukrs
          posting_date  = p_bedat
        IMPORTING
          fiscal_year   = gd_fiscalyr
          fiscal_period = gd_fiscalp.
    CALL FUNCTION 'DETERMINE_PERIOD'
        EXPORTING
          date                      = p_bedat
    *    PERIOD_IN                 = '000'
          version                   = gd_periv
       IMPORTING
          period                    = gd_fiscalp2
          year                      = gd_fiscalyr2
       EXCEPTIONS
          period_in_not_valid       = 1
          period_not_assigned       = 2
          version_undefined         = 3
          OTHERS                    = 4.
    check this link.
    http://www.sapdevelopment.co.uk/fmodules/fmssap.htm
    Regards
    Vadi
    Code Formatted by: Alvaro Tejada Galindo on Jan 4, 2010 5:41 PM

  • Contract numbers based on company code in FI module?

    Hi,
    I am trying to get list of all the contract numbers associated with company code.
    I am working in FI module.
    Can any one tell me what is the correct table to get the contracts with company code.
    FKKVK - Contract account header- but this one don’t have company code field
    FKKVKP- Contract account Partner-Specific-  is this master table for contracts with company code? we can use this?
    Thanks.
    Rajesh.

    Hi Sudhi,
    Thanks for the response, but
    I dont find this table in my system.. which version of SAP exists this table?
    we are using 6.2.
    Thanks.
    Rajesh

  • Get time Zone based on Country code

    Hi All,
    I am looking for getting the time and date of a particular country based on country code in XI. For ex. if IN comes in payload then get IST (Date and time). Can we do that in UDF?
    Thanks & Regards,
    Venu V

    > I am looking for getting the time and date of a particular country based on country code in XI.
    How should that work? Have you thought about Russia? USA?
    Check java class Calendar and TimeZone:
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Calendar.html
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/TimeZone.html

  • SRM 7.0 , Get company name based on company code

    Hello friends,
    Is ther any function module or table to read company name based on company code in SRM 7.0 ?
    Kindly let me know your inputs.
    Thanks.
    Preethi.

    Hi,
    To find purchase group.
    BBP_OM_FIND_PURCH_GRPS_BEI
    To fund purchase org.
    BBP_OM_FIND_PURCH_ORGS_BEI
    To find company.
    BBP_OM_FIND_COMPANIES
    Regards,
    Pedro Marques

  • To Get Clander Id based upon company codes....

    hi all,
    i need to get the calender id based upon the company code.. is there any table for that...
    Example:  1000 for US,
                  2000 for CA(canada).
    helpfull answers will be rewarded...
    Regards,
    Murali.

    Hi guys.
    Murali, I apologize for this inconvenient (Im using your post)..but I cant make any post since today (with new sdn version)  
    pd: this is a test to check if I can post in an already created thread.

  • How to get personnel numbers based on personal subarea?

    Hi Experts,
    Please give me the fuction module name to get the personnel numbers list based on personal subarea wise.
    Best regards,
    Narasimha.

    Hi experts,
    i dont want to write select queries . I am enhancing the standard . So we are looking for FM.
    'RP_CHECK_PERNR' - This function module is giving the personnel subarea  as the exporting parameter and pernr as the importing parameter. But i want personnel subarea as the importing parameter and pernr as the exporting parameter.
    please let me know how to process the same.
    Best regards,
    Narasimha.

  • To get the amount based on the code

    hi all,
    i am using db10g.
    i have a query like below
    SELECT SUM(EID_AMOUNT),EID_INCR_CODE,EIH_EFF_DATE
    FROM EMPLOYEE_INC_HEADER,EMPLOYEE_INC_DETAILS
    WHERE EIH_EMP_CODE = EID_EMP_CODE
    AND EIH_EFF_DATE = EID_EFF_DATE
    AND EIH_EMP_CODE = '0026108'
    GROUP BY EID_INCR_CODE,EIH_EFF_DATE
    ORDER BY EID_INCR_CODE,EIH_EFF_DATEcurrently i am getting result set like this
    SUM(EID_AMOUNT) EID_INCR_CODE   EIH_EFF_D
                500 BASIC           01-JAN-09
                750 BASIC           01-MAY-09
                300 HTRAN           01-JAN-09
                500 HTRAN           01-MAY-09
                200 OTHERS          01-JAN-09
                350 OTHERS          01-MAY-09but i want to get the out put like
    SUM(EID_AMOUNT) EID_INCR_CODE   EIH_EFF_D
               1250 BASIC           01-JAN-09
                800 HTRAN           01-JAN-09
                550 OTHERS          01-JAN-09in otherwords i want get sum of amount for that incr_code and effective date will be the minimum date amoung which the data is fetched(in the example out of six resulted record '01-jan-09' is the least data).
    is there is any way where i can acheive the above?
    Please help..
    Thanks..

    Maybe
    select the_sum,
           EID_INCR_CODE,
           EIH_EFF_DATE
      from (SELECT SUM(EID_AMOUNT) over (partition by EID_INCR_CODE order by EIH_EFF_DATE) the_sum,
                   EID_INCR_CODE,
                   EIH_EFF_DATE,
                   row_number() over (partition by EID_INCR_CODE order by EIH_EFF_DATE) rn
              FROM EMPLOYEE_INC_HEADER,
                   EMPLOYEE_INC_DETAILS
             WHERE EIH_EMP_CODE = EID_EMP_CODE
               AND EIH_EFF_DATE = EID_EFF_DATE
               AND EIH_EMP_CODE = '0026108'
    where rn = 1
    ORDER BY EID_INCR_CODE,EIH_EFF_DATEor
    SELECT SUM(EID_AMOUNT) KEEP (DENSE_RANK FIRST ORDER BY EIH_EFF_DATE) the_sum,
           EID_INCR_CODE,
           EIH_EFF_DATE
      FROM EMPLOYEE_INC_HEADER,
           EMPLOYEE_INC_DETAILS
    WHERE EIH_EMP_CODE = EID_EMP_CODE
       AND EIH_EFF_DATE = EID_EFF_DATE
       AND EIH_EMP_CODE = '0026108'
    GROUP BY EID_INCR_CODE,EIH_EFF_DATE
    ORDER BY EID_INCR_CODE,EIH_EFF_DATERegards
    Etbin
    Edited by: Etbin on 13.11.2011 13:41
    aggregate solution added

  • Shopping cart default delivery address based on company code

    Hi All,
    As a standard behaviour of SRM, currently delivery address in shopping cart is defaulted from attribute (ADDR_SHIPT). But in our case we use cross company purchasing where requisitioners buy for different company codes.
    Some times, they forgot to change the default dlivery address and shopping carts are getting created with wrong delivery address.
    Is there any way, the we can default the delivery address based on company code selected by the user instead of defaulting from user attribute?
    Suggestions would be greatly appreciated.
    Regards,
    Krish

    Hi Krish,
    Am looking for a same solution but instead of delivery address, we are looking for change in invoice recipient address
    ADDR_BILLT. For this i have identifed a FM: BBP_GET_BILL_TO_PARTY from which system pulls the defaulted attribute of user profile. Now we are in a change of pulling the attribute defaulted to the company code entered in SC rather than the user's defaulted ADDR_BILLT.
    Similarly i guess for your issue you can use the FM: BBP_GET_ORG_SHIPTO_ADDR implementing a enhancement in DOC CHANGE BADI
    Regards,
    Nihar

  • Getting building code for teh storage location in the output

    HI !
    In one of my program I ahve to bring in several plant details as well external bill of lading deatils as well as the building code . I have been able to get the other details except for the building code which needs to come from teh adrc table I suppose. Actually not able to connect the detaisl to grab in the building code. Would anyone be able to help me out in getting the building code for the storage location in my program if possible .
    Help would be greatly appreciated.
    Thanks

    I wrote down a code for that and this
    is what its doing as of now.
    When I do the selection of a single plant and for a particluar date
    it does give me the correct storage location building
    code , bust as soon as I put a range of plant say 120 to 300
    it copies the the storage location building code
    of the previous plant itself which si contradictory.
    I would like to get the correct building code
    even when I do the range of selection like when I do
    a single selection of plant.
    For example when I select the range between 0135 and 0351
    this is the output I get.
    50002438 80002249 0135 ABWP0000659 100051 < correct
    50002439 80002250 0135 ABWP0000659 100005 < correct
    50002447 80002257 0135 ABWP0000659 100005 < correct
    50002459 80002258 0135 ABWP0000659 100005 < correct
    50002460 80002259 0135 ABWP0000659 100005 < correct
    50002461 80002260 0135 ABWP0000659 100005 < correct
    50002424 80002235 0351 ABCT0000426 100101 < copied teh B.code from Strg loc "CT" of plant 135
    50002429 80002237 0351 ABTM0082315 100101 < copied teh B.code from Strg loc "TM" of plant 135
    50002430 80002244 0351 ABWP0000659 100101 < copied teh B.code from Strg loc "WP" of plant 135
    The code I used :-
      loop at gt_adrc assigning <fs_adrc> .   <  this is where I am trying to get the building code from S.Loc address into lgobe
            loop at gt_twlad assigning <fs_twlad>.
              if <fs_twlad>-adrnr = <fs_adrc>-addrnumber  and
                 <fs_twlad>-lgort = <lfs_lips>-lgort_i.
                gt_deliveries-lgobe = <fs_adrc>-building.
              endif.
            endloop.
          endloop.
    ********and then .......
    * Selecting Address Number from TWLAD
      select werks lgort adrnr
        from twlad
        into corresponding fields of table gt_twlad
        where werks in s_werks and lgort in s_lgort  .
    * Selecting Facility code
      if not gt_twlad[] is initial.
        select addrnumber name2 street roomnumber building
          from adrc
          into corresponding fields of table gt_adrc
          for all entries in gt_twlad
          where addrnumber = gt_twlad-adrnr.
      endif.
      if not gt_adrc[] is initial.
    * Get the provinces
        select * from t005u
          into table gt_t005u
          for all entries in gt_adrc
          where spras = sy-langu and bland = gt_adrc-region.
      endif.
      loop at gt_twlad assigning <fs_twlad>.
        clear gt_lgort.

  • Can I get multiple sums in a single column based on a "code" I place.

    After importing a file of check/debit card activity from my bank, can I 'code' the line items based on tax categories ie Utilities, Medical expenses, Auto expenses, etc. and then get sums for each based on that code I placed in a single column? That would mean multiple sums in a single column based on the code used for each tax related expense. For instance, I would put UT in the column for utilities expenses and MED in the same column if it were a medical expense. I would then want the sum for all items in that column for each item code. Is this possible or do I need to use a different approach to get this information.

    My guess is that the SUMIF function may be your friend.
    It's well described in the *iWork Formulas and Functions User Guid*e which every user may download from the Help menu.
    Yvan KOENIG (VALLAURIS, France) samedi 2 janvier 2010 21:56:39

  • Get pernr based on company code in logical databse

    Hi,
        When using the get pernr event, all the pernrs that I get are in the ascending order  I want them first grouped based on the company code and then on pernr.
    Any suggestions would be appreciated abd suitably rewarded.
    for ex: get pernr.
               write:/ pernr, bukrs.
             end-of-selection.
    result:   00000099 1001
              00000002 1003
    Regards
    Vick
    Message was edited by:
            vick vennav

    for ex: get pernr.
    write:/ pernr, bukrs.
    end-of-selection.
    result: 00000099 1001
    00000002 1003
    We are sending the payroll information to the 3rd party for pay check purposes, at my client side they have inserted a custom include in the standard program and populating the information in a flat file which needs to be sorted first based on company code and then on pernr. If I try to do it later,the code is becoming a mess, so I want to know is there a way to get pernr using logical database whose order is based on company code.
    Regards

  • Building code field in Ship to address

    HI all,
    Please tell me FM to fetch Ship to address  info actually i want Building  code field ?? which is stored in structure.
    Any suggestions welcome,
    Regards,

    Dear Navdeep,
    Customer address is stored in different table.
    From KNA1 you take the address feild (feild name - ADRNR)   You will find address number here.
    Then from ADRC table serch for the Address number taken from KNA table. In ADRC table the address number is stored in ADDRNUMBER field.
    Here you will find the complete address.
    Hope this helps...
    Give points if useful...
    Thanks,
    Jignesh Mehta
    98700 10230

  • Getting the Address Information based on the Partner Number & Partner Role

    Hello,
             I have a requirement where in I am populating the Address into a Custom Segment Z1E1ADRM1 where I am reading the Partner Data from E1ADRM1 Segment. It has the PARTNER_Q which contains the Partner Role (WE,AG,RE,RG etc...) and PARTNER_ID which contains the Partner Number. Now, using VBPA Table, I am populating the STREET4 and STREET5 manually by passing the Address Number got from VBPA Read.
            Instead, is there any Function Module / BAPI which can be used to get the Address Number / Address Information based on the Partner Role and Partner Number as Input Parameters? Please Let me know.
    Thanks and Regards,
    Venkat Phani Prasad Konduri

    Try
    /SPE/BUPA                      SPE Business Partners             
    /SPE/BP_STORE_ADDRESSES        Business partners store addresses 
    BPAR_P_PARTNERS_WITH_ADDRESS                                     
    SD_ADDRESS_KEY_GET_FROM_VBPA                                               
    SD_ADDRESS_TYPE_GET                                                        
    SD_PARTNER_ADDR_DIALOG_INTERN                                              
    VELO01_GET_PART_ADDR_FOR_VBELN   get the partners and their address details
    WS_LM_ADDRESS_READ                                                         
    WS_LM_CONTACT_ADDRESS_DISPLAY                                                                               
    ^Saquib

  • [svn] 688: asc: adding a barebones build. properties so we get line numbers on stack traces

    Revision: 688
    Author: [email protected]
    Date: 2008-02-28 14:17:43 -0800 (Thu, 28 Feb 2008)
    Log Message:
    asc: adding a barebones build.properties so we get line numbers on stack traces
    Added Paths:
    flex/sdk/trunk/modules/asc/build/java/build.properties

    Revision: 688
    Author: [email protected]
    Date: 2008-02-28 14:17:43 -0800 (Thu, 28 Feb 2008)
    Log Message:
    asc: adding a barebones build.properties so we get line numbers on stack traces
    Added Paths:
    flex/sdk/trunk/modules/asc/build/java/build.properties

Maybe you are looking for