Query to find match on two fields where third does not..

Struggling with this one..
Stripped down example data
SECTION     GROUPID     SUBGROUPID     COMPONENT     PNUM     USERNAME
HVAC     AC     MOTOR          HOSE          111.1     BOB
HVAC     AC     MOTOR          HOSE          111.2     BOB
HVAC     AC     MOTOR          HOSE          111.3     JIM
HVAC     AC     MOTOR          BOLT          411     BOB
HVAC     AC     MOTOR          BOLT          411     BOB
HVAC     AC     MOTOR          BOLT          411     BOB
HVAC     AC     MOTOR          BOLT          (null)     (null)
HVAC     AC     MOTOR          CLAMP          211.1     BOB
HVAC     AC     MOTOR          CLAMP          211.2     JIM
HVAC     AC     MOTOR          CLAMP          211.3     BOB
HVAC     AC     MOTOR          STRAP          611.1     JIM
HVAC     AC     MOTOR          BELT          811.3     BOB
HVAC     AC     MOTOR          BELT          (null)     (null)
HVAC     AC     MOTOR          DISC          (null)     (null)
HVAC     AC     MOTOR          DISC          (null)     (null)
HVAC     AC     MOTOR          DISC          (null)     (null)
     What I need to get, is a list of records where the GroupID and Component Matched, and where they had a PNUM that were not all the same
So in this case I would only want these returned, Section/SubgroupID/Username are not needed to match on anything, but here to visualize the
extra data that can be there. Items that have PNUM that IS NULL need to be ignored? Example would be the intance where above the PNUM
for one record was 811.3 while the one below it was null, that should not return back. Its considered "ok" and does not need to be reported.
SECTION     GROUPID     SUBGROUPID     COMPONENT     PNUM     USERNAME
HVAC     AC     MOTOR          HOSE          111.1     BOB
HVAC     AC     MOTOR          HOSE          111.2     BOB
HVAC     AC     MOTOR          HOSE          111.3     JIM
HVAC     AC     MOTOR          CLAMP          211.1     BOB
HVAC     AC     MOTOR          CLAMP          211.2     JIM
HVAC     AC     MOTOR          CLAMP          211.3     BOB

maybe this.
SQL> select section, groupid, subgroupid, component, pnum, username
  2    from (select section, groupid, subgroupid, component, pnum, username,
  3                 count(pnum) over (partition by groupid, component, pnum order by groupid, component, pnum) cnt1,
  4                 count(pnum) over (partition by groupid, component order by groupid, component) cnt2
  5            from (select 'HVAC' section, 'AC' groupid, 'MOTOR' subgroupid, 'HOSE'  component, 111.1  pnum, 'BOB'  username from dual union all
  6                  select 'HVAC' section, 'AC' groupid, 'MOTOR' subgroupid, 'HOSE'  component, 111.2  pnum, 'BOB'  username from dual union all
  7                  select 'HVAC' section, 'AC' groupid, 'MOTOR' subgroupid, 'HOSE'  component, 111.3  pnum, 'JIM'  username from dual union all
  8                  select 'HVAC' section, 'AC' groupid, 'MOTOR' subgroupid, 'BOLT'  component, 411    pnum, 'BOB'  username from dual union all
  9                  select 'HVAC' section, 'AC' groupid, 'MOTOR' subgroupid, 'BOLT'  component, 411       pnum, 'BOB'  username from dual union all
10                  select 'HVAC' section, 'AC' groupid, 'MOTOR' subgroupid, 'BOLT'  component, 411       pnum, 'BOB'  username from dual union all
11                  select 'HVAC' section, 'AC' groupid, 'MOTOR' subgroupid, 'BOLT'  component, (null) pnum, (null) username from dual union all
12                  select 'HVAC' section, 'AC' groupid, 'MOTOR' subgroupid, 'CLAMP' component, 211.1  pnum, 'BOB'  username from dual union all
13                  select 'HVAC' section, 'AC' groupid, 'MOTOR' subgroupid, 'CLAMP' component, 211.2  pnum, 'JIM'  username from dual union all
14                  select 'HVAC' section, 'AC' groupid, 'MOTOR' subgroupid, 'CLAMP' component, 211.3  pnum, 'BOB'  username from dual union all
15                  select 'HVAC' section, 'AC' groupid, 'MOTOR' subgroupid, 'STRAP' component, 611.1  pnum, 'JIM'  username from dual union all
16                  select 'HVAC' section, 'AC' groupid, 'MOTOR' subgroupid, 'BELT'  component, 811.3  pnum, 'BOB'  username from dual union all
17                  select 'HVAC' section, 'AC' groupid, 'MOTOR' subgroupid, 'BELT'  component, (null) pnum, (null) username from dual union all
18                  select 'HVAC' section, 'AC' groupid, 'MOTOR' subgroupid, 'DISC'  component, (null) pnum, (null) username from dual union all
19                  select 'HVAC' section, 'AC' groupid, 'MOTOR' subgroupid, 'DISC'  component, (null) pnum, (null) username from dual union all
20                  select 'HVAC' section, 'AC' groupid, 'MOTOR' subgroupid, 'DISC'  component, (null) pnum, (null) username from dual)) vt
21  where vt.cnt1 = 1
22    and vt.cnt2 > 1
23  order by vt.pnum;
SECTION GROUPID SUBGROUPID COMPONENT       PNUM USERNAME
HVAC    AC      MOTOR      HOSE           111.1 BOB
HVAC    AC      MOTOR      HOSE           111.2 BOB
HVAC    AC      MOTOR      HOSE           111.3 JIM
HVAC    AC      MOTOR      CLAMP          211.1 BOB
HVAC    AC      MOTOR      CLAMP          211.2 JIM
HVAC    AC      MOTOR      CLAMP          211.3 BOB
6 rows selected
SQL>

Similar Messages

  • Please help me to find the table for fields where the descriptions are give

    please help me to find the table for fields where the descriptions are given below
    Customer Support Administrator
    first line Support indicator

    You could also try table DD01T. In se 16,put in the description thats needed,you will get to know the respective data elements.
    Then you can use DD03L to find the respective table. This would work if the data element is not generic.
    Regards,
    Anubhav.

  • Is there an issue with Safari in Iphones and Ipads where it does not recognize option disabled="disabled" tag properly?

    Greetings everybody,
    I have run into a peculiar problem with the Safari browser on mobile platforms (IPad, IPod, IPhone) which I hope I can find a solution for in this community.
    I just launched a new website where I sell products with certain variations, for example please view this link: http://www.finerribbon.com/aegean-single-face-satin-ribbon.html
    On this particular product, the product variants are supposed to work in such a way where:
    If you select the value "1/8" from the "Choose Ribbon Width" field
    THEN
    The only options active and available to choose from in the "Choose Roll Size" field should be: 500 Yds, 20 Yds & Sample Swatch
    Now, if we browse to the above link in Safari using a desktop or a laptop, there are no problems at all, but if we browse to the above link using an IPhone or an Ipad, then we have a problem where all the options are available regardless of the values chosen, basically the above functonality does not work.
    I was told that there an issue with Safari in Iphones and Ipads where it does not recognize option disabled="disabled" tag properly, is this true? Can anyone advise me if there is a solution to this problem? I would sincerely apperciate it.
    Thank you very much for your time and help!

    Hi...
    I have run into a peculiar problem with the Safari browser on mobile platforms (IPad, IPod, IPhone) which I hope I can find a solution for in this community.
    Now, if we browse to the above link in Safari using a desktop or a laptop, there are no problems at all, but if we browse to the above link using an IPhone or an Ipad, then we have a problem
    At the top of this window you'll see the following:
    Apple Support Communities > Mac OS & System Software > Safari > Discussions
    This the Safari forum for the Mac OS X.
    Better that you post your topic here  > Developer Forums: Apple Support Communities
    I do see on my iPad what you are rreferring to. But you shoudl get the feedback you need in the developer forum.

  • Field KONP-KONWA. does not exist in the screen SAPMV13A 0201

    Hi,
    We have one BDC program to change Material Inforecord through transaction ME12. We have executed the BDC and Batch input session got created. When i execute the session, it is giving error "Field KONP-KONWA. does not exist in the screen SAPMV13A 0201 "
    But when i checked in SE51 for Program SAPMV13A and screen 0201, field KONWA exist.  I have checked in Transaction ME12, this field exist in the same screen. But still this error message is appearing.
    Is there any something wrong in BDC program.

    How are you handling the subscripts (row numbers)?  Did you actually record this BDC in SHDB, or just try to write it?  If not recorded, do yourself a favor and ALWAYS record your BDC sessions, then write to match that recording....
    chances are you need to refer to KONP-KONWA(nn) where nn is the row number in the table control....

  • The contained field name "ADTAGR" does not exist in any of the database tab

    hı all
    how can l  solved thıs problem
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SEMANTICS', was
    not caught in
    procedure "PUT_QMFECAT" "(FORM)", nor was it propagated by a RAISING clause.
    Since the caller of the procedure could not have anticipated that the
    exception would occur, the current program is terminated.
    The reason for the exception is:
    An Open SQL clause was specified dynamically. The contained field name
    "ADTAGR" does not exist in any of the database tables from the FROM clause.
    Information on where terminated
        Termination occurred in the ABAP program "SAPDBZQNQ" - in "PUT_QMFECAT".
        The main program was "ZQMR_BILDIRIM ".
        In the source code you have the termination point in line 732
        of the (Include) program "SAPDBZQNQ".
    Error occurred during batch input processing
        The termination is caused because exception "CX_SY_DYNAMIC_OSQL_SEMANTICS"
         occurred in
        procedure "PUT_QMFECAT" "(FORM)", but it was neither handled locally nor
         declared
        in the RAISING clause of its signature.
        The procedure is in program "SAPDBZQNQ "; its source code begins in line
        715 of the (Include program "SAPDBZQNQ ".
    FORM put_qmfecat.
      DATA: l_tab_fields  TYPE  rsfs_tab_fields.
      DATA: l_ds_clauses  TYPE  rsds_where.
    Dynamische Feldselektion
      MOVE 'QMFECAT_C' TO l_tab_fields-tablename.
      READ TABLE select_fields WITH KEY l_tab_fields-tablename
                                    INTO l_tab_fields.
      IF sy-subrc <> c_rc00.
        CLEAR l_tab_fields.
      ENDIF.
    Dynamische Selektionskriterien
      MOVE 'QMFECAT' TO l_ds_clauses-tablename.
      READ TABLE dyn_sel-clauses WITH KEY l_ds_clauses-tablename
                                 INTO l_ds_clauses.
    DB-Zugriff
      >>>>> SELECT (l_tab_fields-fields) FROM qmfe
      INTO CORRESPONDING FIELDS OF TABLE qmfecat_tab
       WHERE qmnum  =  rqmqmel-qmnum
       AND kzloesch =  space
       AND (l_ds_clauses-where_tab)
       ORDER BY PRIMARY KEY.
    regard sinan
    Edited by: eyup_sinan on Jan 6, 2012 3:21 PM
    Edited by: eyup_sinan on Jan 6, 2012 3:30 PM

    You seem to have made a copy of the standard program. You'll have to make sure that you are handling this field correctly in your code.
    Rob

  • BDCDATA error-Field INVFO-ZUONR does not exist in the screen SAPLMR1M 6000

    Hi
    I am trying to call transaction MIR7 from ABAP code and passing values to the same.
    I am able to pass data to first tab using code (as recorded in SHDB) :
        DATA BEGIN OF BDCDATA OCCURS 1.
        INCLUDE STRUCTURE BDCDATA.
        DATA END OF BDCDATA.
        CLEAR BDCDATA.
        BDCDATA-PROGRAM  = 'SAPLACHD'.
        BDCDATA-DYNPRO   = '1000'.
        BDCDATA-DYNBEGIN = 'X'.
        APPEND BDCDATA.
        CLEAR BDCDATA.
        BDCDATA-FNAM     = 'BKPF-BUKRS'.
        BDCDATA-FVAL     = CompCode.
        APPEND BDCDATA.
        CLEAR BDCDATA.
        BDCDATA-PROGRAM  = 'SAPLMR1M'.
        BDCDATA-DYNPRO   = '6000'.
        BDCDATA-DYNBEGIN = 'X'.
        APPEND BDCDATA.
        CLEAR BDCDATA.
        BDCDATA-FNAM     = 'INVFO-BLDAT'.
        BDCDATA-FVAL     = InvoiceDate.
        APPEND BDCDATA.
        CLEAR BDCDATA.
        BDCDATA-FNAM     = 'INVFO-WRBTR'.
        BDCDATA-FVAL     = InvoiceAmount.
        APPEND BDCDATA.
        Call Transaction 'MIR7' USING BDCDATA MODE 'A'.
    But when I add fields
        CLEAR BDCDATA.
        BDCDATA-FNAM     = 'INVFO-ZUONR'.
        BDCDATA-FVAL     = 'HELLO !!!!!'.
        APPEND BDCDATA.
        CLEAR BDCDATA.
        BDCDATA-FNAM     = 'INVFO-BKTXT'.
        BDCDATA-FVAL     = 'MY DATA .........'.
        APPEND BDCDATA.
    I get an error message :
    Field INVFO-ZUONR does not exist in the screen SAPLMR1M 6000
    But when I add
        CLEAR BDCDATA.
        BDCDATA-PROGRAM  = 'SAPLFDCB'.
        BDCDATA-DYNPRO   = '0150'.
        BDCDATA-DYNBEGIN = 'X'.
        APPEND BDCDATA.
    before setting INVFO-ZUONR, the error disappears, still I don't get values in HeaderText and Assignment fields on GUI
    Can anybody help.
    Thanks a lot
    Ruhi Hira

    I had used the exact recording as in SHDB but no success.
    Is it OK to create a parameter map this screen field to the parameter.
    Where I can set the parameter outside the screen..
    Ruhi Hira

  • Workflow error - Screen Field BSEG - BWKEY does not exist

    Hi Experts,
    Could you please help me, when I am parking a FI reversal document through FBR2 a workflow gets generated, but when the approver is trying to approve the document, we get an error saying
    "S Field BSEG-BWKEY. does not exist in the screen SAP 349 BSEG-BWKEY".
    This Error occurs occassionly.
    Regards,
    Sathya
    Edited by: Sathyanarayana Raghavendra on Nov 14, 2008 5:43 AM

    Hi Sathya,
    you said its happening only some times...
    Is it happening only for some specific company codes ??\
    If so, open the FI document which is not having any problem and the document which is going to error and compare what are the fields which got extra populated ... 
    The issue i faced was for a specific company code where the MRA and responsibility area in the items was getting populated with the company code which was not happening to other company codes.
    once the fields are made blank, then we used to restart the workflow and it used to get approved without the wf going into error.
    Regards,
    PR.

  • Field KNVV-CHSPL does not exist in field status tables (TMOD*)

    Hi Gurus,
    Wile creating Customer master record at Tc= XD01 the following error coming as
    "Field KNVV-CHSPL does not exist in field status tables (TMOD*)"
    Plz help me its  urgent.
    Vinay

    Hi
    KNVV is the customer sales data table and CHSPL is the field name called Batch Split Allowed
    My advice is to deselect the field name from the table and test it by creating it once again ...
    Bobbili

  • Field BSEG-SKFBT does not exist in the screen SAPMF05A 0302

    Hi
    while posting parked documents using  FBV0 i am getting following error.
    Field BSEG-SKFBT does not exist in the screen SAPMF05A 0302
    What can be the solution to above error.
    regards
    Rajesh

    To eliminate this problem please use transactions OB14, OB41 and set for posting key and G/L account
    field status for field  BSEG-SKFBT 'Optional entry':
    transaction OB14 AND OB41 -> Select group 'Payment transactions' -> 'Payment terms' -> set 'Optional'.
    I think the SAP note 1073234 could correct this issue.
    Thanks,
    Daniel

  • Field BSEG-HKTID does not exist in the additional data Screen

    Hi
    We are facing a problem while posting the parked document. Field BSEG-HKTID does not exist in the screen SAPLF040 0331.
    As we want to avoid entering the field-data at the time of payment proposal run using T.code F110, we prefer to enter at the time of posting a parked document or at the time of parking.
    We had checked the field status (of Posting key and GL) and its not available.
    We refered note 953374 House bank details: Account ID in the document. It asks to activate the RE-FX component. However, we are not in the real estate business hence not logical to do so. How do we need to proceed?
    PP

    To do the same change with the transaccion FB02 y FB03, create an enhancemente point in the program: SAPMF05L dynpro: 1301, module: DYNPRO_MODIFIKATION, at the of perform open_fi_dynpro_mod and write:
    LOOP AT SCREEN.
      IF sy-tcode = 'FB02'.
        IF screen-name = 'BSEG-HKTID'.
          screen-input = 1.
          screen-invisible = 0.
          screen-active = 1.
          screen-output = 1.
          screen-group4 = ' '.
          MODIFY SCREEN.
          EXIT.
        ENDIF.
      elseif sy-tcode = 'FB03'.
          IF screen-name = 'BSEG-HKTID'.
          screen-input = 0.
          screen-invisible = 0.
          screen-active = 1.
          screen-output = 1.
          screen-group4 = ' '.
          MODIFY SCREEN.
          EXIT.
        ENDIF.
      endif.
      ENDLOOP.
    and, all ready.

  • Im trying to find my iPhone via iCloud but i does not show a map with its last know location. It only shows the menu options. My iPad and Mac show up but the map of my iPhone does not.

    Im trying to find my iPhone via iCloud but i does not show a map with its last know location. It only shows the menu options. My iPad and Mac show up but the map of my iPhone does not. Can anyone help?

    If your phone is turned off or not connected to the Internet, you will be unable to locate it. Last known location is only stored for 24 hours.

  • Field RF05A-NEWBK. does not exist in the screen SAPMF05A 0100

    Hi,
    We are doing the intercompany account payable postings through SAP EDI.  The process following as below -
    Delivery -> Intercompany Billing -> Account Receivable
                                                  --> IDOC -> Account Payable
    While doing the EDI posting for AP, system giving the following message -
    Field RF05A-NEWBK. does not exist in the screen SAPMF05A 0100
    Best Regards
    Goutham

    Hello,
    I am facing the Same issue for Inbound Idoc for Invoice.
    I checked in debug mode as well and in BDC call we get a sucess message as
    Field RF05A-NEWBK. does not exist in the screen SAPMF05A 0100
    which beocme as error for Inbound IDOC.
    Coundt get the field newbk on the screen for Invcoice . in which segment do we pass the value for this.
    Can anyone please give more inputs on this.
    Thanks
    Ritesh Solanki

  • Field BSEG-HKTID. does not exist in the screen SAPMF05A 0332

    Dear ALL,
    Our client is ECC 6.0
    we are facing a problem while posting the park document
    Field BSEG-HKTID. does not exist in the screen SAPMF05A 0332
       Message no. 00349
    Diagnosis
       The specified field does not exist on the screen.
    Procedure
       Check your batch input data.
    The above problem occurs only after the Patch level upgradation only.
    SAP suggest refer your sap note 953374 House bank details : account id in the document.
    It says activate the RE-FX component.
    Any how we are not in the real estate business.
    Please provide me your suggestion to resolve the problem.
    Thanks for your cooperation
    Regards,
    laxminarayan

    To do the same change with the transaccion FB02 y FB03, create an enhancemente point in the program: SAPMF05L dynpro: 1301, module: DYNPRO_MODIFIKATION, at the of perform open_fi_dynpro_mod and write:
    LOOP AT SCREEN.
      IF sy-tcode = 'FB02'.
        IF screen-name = 'BSEG-HKTID'.
          screen-input = 1.
          screen-invisible = 0.
          screen-active = 1.
          screen-output = 1.
          screen-group4 = ' '.
          MODIFY SCREEN.
          EXIT.
        ENDIF.
      elseif sy-tcode = 'FB03'.
          IF screen-name = 'BSEG-HKTID'.
          screen-input = 0.
          screen-invisible = 0.
          screen-active = 1.
          screen-output = 1.
          screen-group4 = ' '.
          MODIFY SCREEN.
          EXIT.
        ENDIF.
      endif.
      ENDLOOP.
    and, all ready.

  • Field BSEG-DMBTR. does not exist in the screen SAPMF05A 0302

    Hi Gurus,
    I am facing an error when uploading document in background through SM35(batch session)
    1. 1. If i try to post the document in the forground system gives same message but on pressing enter it goes to next line item and ultimately posts the document. But if i try to post (SM35 session) in the back ground i am facing the issue"Field BSEG-DMBTR. does not exist in the screen SAPMF05A 0302"  Message no. 00349
    2. The system is ECC 6.0 recently upgraded from 4.7
    It would be great if any expert can help to resolve this issue.
    Thanks
    Anand

    Seems that your screen flow does not factor in the transaction currency. BSEG-DMBTR is only available for input when the transaction currency is different from the company code currency.
    Your program creating the BDC session needs rework, or better use SAP standard tools for document posting (e.g. RFBIBL00 or one of the BAPIs available )
    Thomas

  • Field BSEG-MEINS. does not exist in the screen SAPMF05A 0300

    Dear Expert,
    in cross-company sales process, issuing an IDoc to create a FI AP document, the IDoc was created and issued successfully by inter-compnay invoice, but in processing the IDoc to creat a FI AP document, there is a error message and that is "Field BSEG-MEINS. does not exist in the screen SAPMF05A 0300". i used the Units of Measurement"EA", and in the setting of Units of Measurement"EA" i already flagged the Units of Measurement"EA" as Primay code, but the error still appear again, please give me some useful advice!

    Hi
    Concerning message of "Fields BSEG-MEINS and MENGE are hidden in
    SAPMF05A 0300", it was recommended to check which G/L accounts were
    involved and to verify that fields BSEG-MEINS and MENGE were set to
    'optional' .Please check the field statuses in OB41/OB14 for the
    affected G/L accounts, whether the field as optional is set.
    regards,
    Ramana

Maybe you are looking for

  • Can't get Bose computer speakers to work with my Mac pro lion

    I have just bought the Bose Companion 11 computer speakers for my Mac Book Pro. They are set up correctly (in the headphone jack) and they play my itunes music beautifully. However, when they are plugged in I get no sound from internet videos, etc. I

  • What is the easy way to create a crossword with InDesign CS5 for a interactive pdf?

    I mean I want to create a pdf magazine and i like to include a crossword. I read somewhere that one way is create a crossword with an external software and include it in the ID project but I don't know any crossword software and if I add in my ID pro

  • My ipod Wont Switch on Or Charge

    i bought an i pod just in november last year and its been fine using it and everything just now it was working i unplug it from its chager take it to my room then i wont work or switch on i put it back on charge and nothing comes up its just blank no

  • SUMProduct

    Hello, Why doesn't the sumproduct work with CX? for example this formula would not work =SUMPRODUCT((Range1=Criteria1),(Range2=Criteria2),--(Range3=Criteria3),Range2Sum) Any Ideas?????

  • Adding CheckBox and Text as child of a tree

    I want to have the following as the child of a tree : **CheckBox[reference of CheckBox]+some text example: checkbox text1 checkbox text2 checkbox text3 I am unable to add both check box and text as the child of the tree. My nodes are generated at run