Is query is correct for customer

Hii
I have written query for fetting customer_name but i am getting wrong customer name .
plz reply me asap
This Query is for particular Org_id.
SELECT distinct HP.PARTY_NAME CUSTOMER_NAME
FROM HZ_PARTIES HP
,HZ_PARTY_SITES HPS
,HZ_CUST_SITE_USES_ALL HCS
,ORG_ORGANIZATION_DEFINITIONS OOD
WHERE HP.PARTY_ID=HPS.PARTY_ID
AND HPS.PARTY_SITE_ID=HCS.SITE_USE_ID
AND OOD.OPERATING_UNIT=HCS.ORG_ID
AND HCS.ORG_ID IN (87,88,89,90,91,92,93,94)

Basics of debugging.
Try to simplify the code and then add one variable at a time.
First select only from hz_parties.
Then add part_sites, then ood, then site_uses.
If you do that, you will find that you are joining hps.party_site_id with hsc.site_use_id.
Instead you need to join hps.party_site_id =hcs.cust_acct_site_id
You will also find that org_organization_definitions is making you use distinct. Anytime you have to use distinct to get rid of multiple rows when you were expecting one row, you can be sure that something is wrong in your query. The distinct is simply masking a problem.
Instead of ood, you need to use hr_operting_units.
The query becomes
select hp.party_name From hz_parties hp
,HZ_PARTY_SITES HPS
,HZ_CUST_SITE_USES_ALL HCS
,hr_operating_units hou
where hp.party_type='ORGANIZATION'
and HP.PARTY_ID=HPS.PARTY_ID
AND HPS.PARTY_SITE_ID=HCS.cust_acct_Site_id
AND HCS.ORG_ID IN (87,88,89,90,91,92,93,94)
AND hou.organization_id=HCS.ORG_ID
Hope this answers your question,
Sandeep Gandhi

Similar Messages

  • Change layout of Adhoc query output list for Custom infotype

    Hi All,
    The fields in the Infoset query output on a custom infotype are aligned with the fields u2018payment typeu2019 and u2018amountu2019 appearing repeatedly(in columns) as declared in the Infotype and the output will be a long horizontal list.
    Instead, the requirement is that the output list should show vertically so that If I choose u2018Payment Typeu2019 and u2018Amountu2019 as output fields, it will show a long vertical list as in the case of a standard infotype (IT0008).
    Also, this way enables user to use Payment Type as a selection criteria so as to just pulling the needed payment type. When we use IT0008 in the infoset it works fine but in custom IT it does not work.
    Any pointers/suggestions on how we can achieve this would be helpful.

    Hi yu liang,
                     You can find vendor list having Vendor No. & without showing total liability for every vendor.
    after executing the report,
    1.You need to select "change layout (ctrl+F8)",
    a small window comes, it has two part -> column content & hidden fields.
    then u select "Vendor" from hidden field & move it to column content.
    2. at column content there is a column named "Total". u need to remove check for your column name "amount".
    now select "copy" button or enter. u will find the req. report.
    u can save it also by ur name.
    hope its helpful to u.......
    plz, reward points as a way of thanks if helpful...

  • Content Search Query Builder - filtering for custom column value

    I want to use a CSWP to display certain pages in a slideshow format on a site.  However, to filter them in a preferred manner, the pages library has a custom column "Spotlight" which is a Boolean type (e.g. yes/no).
    In my "Build Your Query" configuration page, I have added a keyword filter "SpotlightOWSBOOL=Yes" as the criteria to display my results.  This is not working, despite the fact that I currently have pages flagged as "Spotlight"
    in this library. 
    My question is - how can I achieve this result of displaying only pages with a custom column value "Spotlight" as "Yes"?

    Hi Owen,
    Could you capture a screenshot about your Crawled Property for your list column "Spotlight"?  Is it name "SpotlightOWSBOOL"?
    If your library column name is "Spotlight", you can create a custom
    Manged Property (e.g. create name as SpotlightMangedProperty)to map the
    Crawled Propery (e.g. may ows_spotlight, or ows_SpotlightOWSBOOL?) genegrated by list column "Spotlight", then start a full crawl.
    Then you can add the keyword filter like below in "Build Your Query" dialog of CSWP web part, then check if the correct items are filtered.
    SpotlightMangedProperty:"yes"
    If the above value "yes" doesn't work, please also try
    SpotlightMangedProperty:"True", or try SpotlightMangedProperty:1
    More information about this topic you can read is below.
    https://technet.microsoft.com/en-us/library/jj219667.aspx#proc2
    https://msdn.microsoft.com/en-us/library/office/ee558911.aspx#kql_property_restriction_queries
    Thanks
    Daniel Yang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Query SQ01: Table for customer revenue

    Hi,
    I have created a query using amongst other table KNKK. The requirement his now to get for a customer (in all sales-areas and company code) the total revenue for a give year. What is the best way to acheive this? Is there a table i could use which stores this kind of information?
    Kind regards

    Table VBREVE-RVAMT is the revenue amount
    I think you must get the G/L Account Number for the customer and pass it here.
    table CO01 gives the GL account based on customer account group,
    Or you can get the Sales Document of the customer and pass it to table VBREVE.
    or just try passing the customer to field VBREVE-KUNAG and check.
    Just give a try
    Problem is that only some of our customer invoices are updated in VBREVE, that is we are only doing revenue recognition for some invoice types.

  • Modbus Ethernet Slave seems to fail when the Master query information simultaneously for more than 16 Coils or Discrete Inputs.

    I'm developing an control application by using the Modbus TCP/IP for communicating with the host computer.
    I'm using the Modbus Library for LabVIEW
     (http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=F1582737BACF5CA8E0340003BA7CCD71&p_node=DZ52363&p_source=External).
    The LabVIEW MB Ethernet Slave seems to fail when the MB Ethernet Master
    query information simultaneously for more than 16 Coils or Discrete
    Inputs.
    The Modbus Application Protocol Specification (http://www.Modbus-IDA.org) state that:
    1- The function code 0x01 'Read Coilsis' is designed to read from 1 to 2000 contiguous status of coils in a remote device.
    2- The function code 0x02 'Read Discrete Inputs' is designed to read
    from 1 to 2000 contiguous status of discrete inputs in a remote device.
    To test the behaviour of the LabVIEW MB Ethernet Slave I have modified
    the 'MB Ethernet Example Slave.vi' by adding more Coils and Discrete
    Inputs. I have added up ONLY to 20 Coils and 20 Discrete Inputs.
    By using the 'MB Ethernet Example Master.vi' the answer to the MB query
    is correct for the first 16 Coils or Discrete Inputs. Starting from the
    17th Coil or Discrete Input the MB Ethernet Slave doesn't give any
    answer.
    By shifting the start point address the answer remain correct for the first 16 Coils or Discrete Inputs.
    I have tested the slave by using also a third part MB Ethernet Master and the behaviour is the same.
    1) There is a reason for this behaviour?
    2) There is a Modbus Library for LabVIEW that satisfy the  'Modbus
    Application Protocol Specification' managing from 1 to 2000 contiguous
    status of Coils or Discrete Inputs?
    Thanks,
    Asper

    I have the same problem with the MB Ethernet.
    I need 40 Outputs.
    The first 16 work perfectly. The next 8 coils do not work, The next 8 work, The next 16 do not work,The next 8 work,The next 24 do not work And work for the last 8. Conclusion, to activate the 40 outputs, I needed 88 coils.
     Because 48 coil, do nothing Can someone help me and i cant implemet the jim solution

  • How to query opening balance for all customer or Vendor for an speci. date

    Hi,
    How to query opening balance for all customer or Vendor for an specific date?
    Example:
    put any date and query will show all customer/ Vendor  that date opening/current balance.
    Regards,
    Mizan

    Hi mizan700 ,
    Try this
    SELECT T0.[DocNum] As 'Doc No.', T0.[CardCode] As 'Customer Code',
    T0.[CardName] As 'Customer Name',(T0.[DocTotal]-T0.[PaidSys]) As 'O/S Balance'
    FROM OINV T0 INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
    INNER JOIN OCRG T2 on T1.GroupCode = T2.GroupCode
    INNER JOIN INV1 T3 ON T0.DocEntry = T3.DocEntry
    WHERE T0.[DocStatus] ='O'
    AND
    (T0.[DocDate] >='[%0]' AND T0.[DocDate] <='[%1]')
    Regards:
    Balaji.S

  • Can we implement the custom sql query in CR for joining the two tables

    Hi All,
    Is there anyway to implement the custom sql query in CR for joining the two tables?
    My requirement here is I need to write sql logics for joining the two tables...
    Thanks,
    Gana

    In the Database Expert, expand the Create New Connection folder and browse the subfolders to locate your data source.
    Log on to your data source if necessary.
    Under your data source, double-click the Add Command node.
    In the Add Command to Report dialog box, enter an appropriate query/command for the data source you have opened.
    For example:
    SELECT
        Customer.`Customer ID`,
        Customer.`Customer Name`,
        Customer.`Last Year's Sales`,
        Customer.`Region`,
        Customer.`Country`,
        Orders.`Order Amount`,
        Orders.`Customer ID`,
        Orders.`Order Date`
    FROM
        Customer Customer INNER JOIN Orders Orders ON
            Customer.`Customer ID` = Orders.`Customer ID`
    WHERE
        (Customer.`Country` = 'USA' OR
        Customer.`Country` = 'Canada') AND
        Customer.`Last Year's Sales` < 10000.
    ORDER BY
        Customer.`Country` ASC,
        Customer.`Region` ASC
    Note: The use of double or single quotes (and other SQL syntax) is determined by the database driver used by your report. You must, however, manually add the quotes and other elements of the syntax as you create the command.
    Optionally, you can create a parameter for your command by clicking Create and entering information in the Command Parameter dialog box.
    For more information about creating parameters, see To create a parameter for a command object.
    Click OK.
    You are returned to the Report Designer. In the Field Explorer, under Database Fields, a Command table appears listing the database fields you specified.
    Note:
    To construct the virtual table from your Command, the command must be executed once. If the command has parameters, you will be prompted to enter values for each one.
    By default, your command is called Command. You can change its alias by selecting it and pressing F2.

  • Infoset Query probelm for Custom Subtypes

    Hi Experts.....
             I am new to Infoset Queries...
      The problem is an Infoset query is generated for PA infotypes. It is generating output for all the infotypes except for Communication infotype which contains custom Subtypes. Could you plz help me how to get the data from these custom subtypes.(For these subtypes a select query is written).
      Thanking you in advance.
    Regards,
    Sree

    hi
            Thanks for the reply.......
       We had already created custom fields in the query..... The problem is for some fields it is getting the data. but the select query for all the fields is same(i.e., the where condition is based on pernr & usrty fileds in IT 0105).
       I can't understand why it is taking for some fields & why not for some....
      Could you plz help me.
    Regards,
    Sree.

  • Query - Replacement Path for a Customer Exit Variable

    Hi
    New to the field and the board.  Any and All help is greatly appreciated.
    I have created a query which runs based on a date selection. The query have few customer exit variables whose values are set in ABAP. All Key Figures in the query are brought depending on the date ranges that each of the CE returns. Ex - one column is sales for first 10 days, 2nd for second 10 days, 3rd for first quarter, 4th for 2nd quarter and such.  There are about 20 - 25 columns with KF in the query and all are Customer Exit date driven.
    The challenge:- Each column heading should have the name of the month. I tried using Replacement Path. But it works when the selection is based on a constant value but not on value based on variable which is a customer exit. Ex - If I say restrict Cal/Month for July 2013, the replacement path for the Col Heading works fine. But if I say restrict Cal/Month for "ZVAR_SecondQtr_First_Month" the replacement path doesn't work.
    Help Please
    Thanks
    Vidya

    In the text variable that you are using , i guess you have a replacement path. In this instead of using your characteristic for specifying how the value has to replace, use the variable option and give the variable name there
    http://help.sap.com/saphelp_nw70/helpdata/EN/43/565cd22fc95f6ce10000000a1553f6/content.htm
    Hope it helps
    Regards,
    Rathy

  • Querying for custom picklist values

    Hello all,
    I have created a new field on my opportunity type called "Industry" and gave it picklist values. However, the system is not allowing me to query for the values using the Picklist web service. Am I missing a step here, or does the system not allow querying for custom picklist field values? I can get to certain lists of picklist values for Opportunity (Type, Probability, some others) but not the picklist I created. Am I doing something wrong?
    Thanks!
    -Kevin Green

    Hi,
    Find integration tag for custom field in Field Setup. When you call getPicklist method, pass three values like Object type(ex: Lead), integratin tag for the custom field, "" ( this is language, this field is no need for English languague)
    Hope this willl work
    Raja Kumar Malla
    [email protected]

  • QLD -query based customised report for customer aging

    Hello Expert,
    I want to write a query for the QLD  and this report is a customised report for customer statement-aging
    Requirements
    1. The QLD report  query should have selection criteria Posting date range[user must input]
    2. The QLD report  query should have also another selection critreria Customer code[If user input it then report must display details for only that particular customer, if it is blank i mean not inputed by user then this report should display details of all customers with page break., I mean start with first customer.. show details and page break  start second customer show all details  and so on
    Let us sec the QLD details                                                                               
    at the header Level customer detals name/address/balances(3429.4) etc
    Code|| Name||Doc Type || Doc number||Posting date||Debt Amount||Credit Amount||
    C00001  || ABC LtdII AR Inv     || 12/01/2011||12000|| 0
    C00001  || ABC Ltd|| AR Memo|| 12/15/2011||0        || 5600
    C00001  || ABC Ltd|| Incoming || 12/15/2011||0        || 4000
    C00001  || ABC Ltd|| OTHER   || 12/20/2011||1000  || 0
    Summary
    Balance||        0-30         ||  31-60         || 61-90||          91-120          || 121+
    3429.4     3400     200     300     -300     -170.6
    100%     99.14%     5.88%     8.75%     -8.75%     -5%
    Page Break
    at the header Level customer detals name/address/balances(969.4) etc
    Code|| Name||Doc Type || Doc number||Posting date||Debt Amount||Credit Amount||
    C00002  || ABC LtdII AR Inv     || 12/01/2011||15000|| 0
    C00002  || ABC Ltd|| AR Memo|| 12/15/2011||0        || 3600
    C00002  || ABC Ltd|| Incoming || 12/15/2011||0        || 3000
    C00002  || ABC Ltd|| OTHER   || 12/20/2011||5000  || 0
    Summary
    Balance||        0-30         ||  31-60         || 61-90||          91-120          || 121+
    969.4     1440     500     -500     -300     -170.6
    100%     148.55%     51.58%     -51.58%     -30.95%     17.6%
    and so on
    Note #1 If the balances for a customer is zero then I should not be the part of the report
    Note #2 In the existing report system is showing summary  details only for the date range , but here I am looking for all dates
    Thanks
    Arun K Singh

    Hi Arun,
    Try this...
    SELECT T1.CardCode, T1.CardName, T1.CreditLine, T0.RefDate, T0.Ref1 'Document Number',
         CASE  WHEN T0.TransType=13 THEN 'Invoice'
              WHEN T0.TransType=14 THEN 'Credit Note'
              WHEN T0.TransType=30 THEN 'Journal'
              WHEN T0.TransType=24 THEN 'Receipt'
              END AS 'Document Type',
         T0.DueDate, (T0.Debit- T0.Credit) 'Balance'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')<=-1),0) 'Future'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>=0 and DateDiff(day, T0.DueDate,'[%1]')<=30),0) 'Current'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>30 and DateDiff(day, T0.DueDate,'[%1]')<=60),0) '31-60 Days'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>60 and DateDiff(day, T0.DueDate,'[%1]')<=90),0) '61-90 Days'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>90 and DateDiff(day, T0.DueDate,'[%1]')<=120),0) '91-120 Days'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>=121),0) '121+ Days'
    FROM JDT1 T0 INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode
    WHERE (t0.BalDueCred !=0 or T0.BalDueDeb != 0) AND T0.RefDate <= [%1] AND T1.CardType = 'C' and T0.TransType in ('13','14','30','24')
    ORDER BY T1.CardCode, T0.DueDate, T0.Ref1
    Thanks,
    Srujal Patel

  • Query for Customer Shipping instructions:

    Hi
    i want a query for Customer Shipping instructions. i am working on depot repair module
    what about Customer data conversion template? can anyone help me in the query

    Hi Team,
    This is a shipping report in header level we have the customer information with site address. The requirement is along with site address we need to show the phone number and Fax number .For this we need to write the formula column.Thes are the comes through HZ parties only. I have no idea how to achieve this.
    Best Regards
    NRC

  • Query for Customer site Phone number and Fax number  in Oracle Apps

    Dear All,
    Can anyone guide me how to write qurey for Customer site phone number and Fax number for Acive customers.
    Thanks in advance.
    Best Regards
    NRC

    Hi Team,
    This is a shipping report in header level we have the customer information with site address. The requirement is along with site address we need to show the phone number and Fax number .For this we need to write the formula column.Thes are the comes through HZ parties only. I have no idea how to achieve this.
    Best Regards
    NRC

  • "Partner Determination Steps  for Customer Master" clarification

    Hi,
    Let me clear myself at the outset itself, that I searched SDN for my below mentioned query, however I could not find any answer to my satisfaction....here I am posting again
    In "Partner Determination for Customer Master", the following steps are undertaken -
    Step 1:
    1.a.) Create New Partner Determination Procedure 
    1.b.) For each Partner Determination Procedure, different Partner Functions, which are applicable for that specific determination procedure, are assigned. (along with other properties like if the PF is mandatory, not modifiable )
    Step2:
    "Partner Determination Procedure Assignment", here we assign different Partner Determination Procedure to different Account Groups. In other words, indirectly, we assign the partner functions to account groups. Right? (Please correct me if I am wrong)
    Step3:
    "Partner Function". Here we define new partner functions, (which are used in Step 1...)
    Step4:
    "Account Group- Function Assignment" - Here we assign the Partner Functions to Account Groups
    Now My Question
    (A) Since the Partner Functions are assigned (via partner determination procedure) to account groups in Step 1, then why Partner Functions are assigned AGAIN to account groups in Step 4. What is the significance of this assignment in Step 4.
    (B) Is there is particular sequence of Steps (1 to 5), one should follow when somebody has to create new customer account group and/or new partner function.
    Thanking you all in advance.

    Dear SR
    Leave SAP Partner Determination screen for 2 minutes and first understand the logic
    1. Create the new partner functions
    2. Create the new determination procedure
    3. Link the new  partner functions to the  new determination procedure and add mandatory, non modifiable ,optional creteria
    4. Assign the new  determination procedure to the document type or account group at appropriate level
    This is essence and this is for all  8 levels like CMR,sales doc header,item etc
    Now coming to your qn
    When you define a new account group ( you might be aware account group controls partner functions of CMR) you will say that your  new account group  will carry out patner functions like SP,SH,BP,PY
    That is ACCOUNT GROUPS  function assignment
    Whenever you create a new account group  you will do field selection in OBD2 like suppress optional.reqd etc,create no ranges and assign no ranges and also mainly this activity partner determination
    These are must settings for a new account group
    AG is the german key for sold to party Partner determination procedure
    This is step 1
    Then in next step you will tell AG will carry out such and such partner functions Step 2 like mandatory not modifiable etc
    Step 3 is link the AG to your account group
    Step 4 is partner functions say if you want to create a new partner function say SB special stock partner
    (in concept this is the firststep)
    Step 5 is once again partner function account group  assignment
    So when you create a new partner function you will do step 4 first and step 5 and then 1 and 2 and 3 
    when you create a new account group you will do step 5 and then 1 and 2 and 3
    Hope you understand now
    Partner functions are relatives in your family
    Say in a family we have Father ,mother sister, brother (these 4 partner functions)
    This is called as Happy Family  and this Happy Family  is the Partner determination procedure in SAP
    This Happy Family  is linked to the account group
    So Happy family means there are 4 partner functions
    So whenever you create a CMR in the account group this father.mother,brother,sister will come as default
    Suppose you add another partner function say Uncle
    First you have to create uncle
    Then you have to tell this account group will accept uncle
    Then link the uncle in the happy family that is determination procedure of SAP along with the 4
    Then assign  happy family  to the account group
    Now when you create a CMR along with father.mother,brother,sister  along with that uncle will also come
    Regards
    Raja

  • Tip: adding metadata for customized reporting

    Users sometimes build their own custom reports around dimensions specific to their company. For example, a bank may want to know about financial data elements that are high priority, but violate completeness rules. You can do this with Data Insight 11.5.1.1.
    Simply have your Data Insight administrator choose weights, dimensions, priorities, and so on in their Data Insight UI. All of the users can choose Rule Classifications when they edit/create a rule and specify the appropriate items. This metadata is stored in the repository, which you can easily query for custom reports.
    For more details, check the Data Insight User's Guide. Enjoy!

    Hi,
    I hope you wont mind me asking for the steps on how to do this.
    The customized data source which i had obtained from the ecc6 is zskat. And the local language which are actually being maintained in the R/3 FI-GL. The following fields in zskat datasource are:
    KTOPL     Chart of Accounts
    MCOD1     Search Term for Matchcode Search
    SAKNR     G/L Account Number
    SPRAS     Language Key
    TXT20       G/L account short text
    TXT50       G/L Account Long Text
    If i am not wrong, SPRAS would be the key to the language right? I found that it is in the table T002, but again, how would i know which one would be the correct text?
    Since the language translation had been maintained in the source system, i guess i wont need to use the flat file option do i?
    Should I find the text data from the source system and load as you had advised? Should I do it through DTP and so on?
    Could you show me some steps by steps if possible? Simple one if possible.
    Cheers
    Tommy
    Edited by: Yu Tommy on Jul 23, 2008 12:14 PM
    Edited by: Yu Tommy on Jul 23, 2008 12:16 PM
    Edited by: Yu Tommy on Jul 23, 2008 12:27 PM

Maybe you are looking for

  • How to use old 2005 cinema display (20'') with MacBook Air (mid-2009)

    My old 20'' cinema display (2005) has three ports coming out of its power box (single-port dvi, usb, firewire).  Is it possible to use this display with my newer MacBook Air (mid-2009) ? If so, what kind of connector do I need?  Thank you very much f

  • Passing table data to pl sql procedure oaf

    Hi All, I have a requirement where i have to pass table data to plsql procedure. In the first page i select the REQUISITION and click on RETURN button and it will take me to the next page. and in the Next page i will click on APPLY button. When i cli

  • XRPM: replace 'item dashboard' by customer webdynpro for abap application

    Hi guys, I want to replace my item dashboard application to be replaced by a customer WD4A. Within this application I will select from a tree structure a project. Now the questions: How to controll the standard context menu in the portal during this

  • App is not visible in Software Center. Won't deploy.

    Hello I have recently deployed an app that will not display in Software Center and does not install.  It is a MSI installation that supersedes another. This is what AppDiscovery.log says: Performing detection of app deployment type myapp - Windows In

  • Bash script to change a string in /etc folder?

    I am wanting to create a script to change one of the values for the authorization file.   (See Article TS3287 in the KB) I assumed that I could use the sed command to do this, but I am getting an error when attempting to run.  Any ideas? Below is the