How to find invoices having a particular string in item description

SELECT T0.[DocDate], T0.DocNum,T0.[CardCode], T0.[CardName], T7.[descript] [Territory],
  T5.[SlpName], T1.[ItemCode],
T1.[Dscription], T1.[Quantity], T1.[LineTotal], T1.[TotalFrgn],
T1.[Rate],T2.[U_SheetTab], T2.[U_SubCategory], T2.U_SPCatgry, T6.U_CatName, T3.[QryGroup22] Exports  
FROM OINV T0 
   RIGHT JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
   INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
   INNER JOIN OCRD T3 ON T0.CardCode = T3.CardCode
   INNER JOIN CRD1 T4 ON T3.CardCode = T4.CardCode
   INNER JOIN OSLP T5 ON T0.SlpCode = T5.SlpCode
   INNER JOIN [@NCM_PRODCATGRY] T6 ON T2.U_SPCatgry = T6.U_CatCode
   INNER JOIN [OTER]  T7  ON T3.Territory = T7.territryID
WHERE T0.DocType ='I'
and T1.[ItemCode] = T2.[ItemCode]
AND T4.ADRESTYPE='S'
and (T2.U_SPCatgry = '079' or T2.U_SPCatgry = '168' or T2.U_SPCatgry = '169')
--and T3.[QryGroup22]= 'Y'
and  T0.[DocDate] between '[%0]' and '[%1]'
Union All
SELECT T0.[DocDate], T0.DocNum, T0.[CardCode], T0.[CardName],T7.[descript] [Territory],
  T5.[SlpName],  T1.[ItemCode], T1.[Dscription],
  (T1.[Quantity] * -1 )Quantity, (T1.[LineTotal] * -1 )LineTotal, (T1.[TotalFrgn] * -1) TotalFrgn,
T1.[Rate],T2.[U_SheetTab], T2.[U_SubCategory], T2.U_SPCatgry, T6.U_CatName , T3.[QryGroup22] Exports    
FROM ORIN T0 
    RIGHT JOIN RIN1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
    INNER JOIN OCRD T3 ON T0.CardCode = T3.CardCode
    INNER JOIN CRD1 T4 ON T3.CardCode = T4.CardCode
    INNER JOIN OSLP T5 ON T0.SlpCode = T5.SlpCode
    INNER JOIN [@NCM_PRODCATGRY] T6 ON T2.U_SPCatgry = T6.U_CatCode
     INNER JOIN [OTER]  T7  ON T3.Territory = T7.territryID
WHERE T1.[ItemCode] = T2.[ItemCode]
and T0.DocType ='I' 
AND T4.ADRESTYPE='S'
and (T2.U_SPCatgry = '079' or T2.U_SPCatgry = '168' or T2.U_SPCatgry = '169')
--and T3.[QryGroup22]= 'Y'
and  T0.[DocDate] between '[%0]' and '[%1]'
--However in this query even if the invoice has many items, only items belonging to U_SPCatgry 079 or 168 or 169 are displayed. This can be a problem since the commission payable has to be calculated on all the other items that may also belong to some other U_SPCatgry

Hi,
Try this:
SELECT T0.[DocDate], T0.DocNum,T0.[CardCode], T0.[CardName], T7.[descript] [Territory],
  T5.[SlpName], T1.[ItemCode],
T1.[Dscription], T1.[Quantity], T1.[LineTotal], T1.[TotalFrgn],
T1.[Rate],T2.[U_SheetTab], T2.[U_SubCategory], T2.U_SPCatgry, T6.U_CatName, T3.[QryGroup22] Exports 
FROM OINV T0
   RIGHT JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
   INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
   INNER JOIN OCRD T3 ON T0.CardCode = T3.CardCode
   INNER JOIN CRD1 T4 ON T3.CardCode = T4.CardCode
   INNER JOIN OSLP T5 ON T0.SlpCode = T5.SlpCode
   INNER JOIN [@NCM_PRODCATGRY] T6 ON T2.U_SPCatgry = T6.U_CatCode
   INNER JOIN [OTER]  T7  ON T3.Territory = T7.territryID
WHERE T0.DocType ='I'
and T1.[ItemCode] = T2.[ItemCode]
AND T4.ADRESTYPE='S'
and T2.U_SPCatgry IN ('079','168','169','XXX','YYYY')
--and T3.[QryGroup22]= 'Y'
and  T0.[DocDate] between '[%0]' and '[%1]'
Union All
SELECT T0.[DocDate], T0.DocNum, T0.[CardCode], T0.[CardName],T7.[descript] [Territory],
  T5.[SlpName],  T1.[ItemCode], T1.[Dscription],
  (T1.[Quantity] * -1 )Quantity, (T1.[LineTotal] * -1 )LineTotal, (T1.[TotalFrgn] * -1) TotalFrgn,
T1.[Rate],T2.[U_SheetTab], T2.[U_SubCategory], T2.U_SPCatgry, T6.U_CatName , T3.[QryGroup22] Exports   
FROM ORIN T0
    RIGHT JOIN RIN1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
    INNER JOIN OCRD T3 ON T0.CardCode = T3.CardCode
    INNER JOIN CRD1 T4 ON T3.CardCode = T4.CardCode
    INNER JOIN OSLP T5 ON T0.SlpCode = T5.SlpCode
    INNER JOIN [@NCM_PRODCATGRY] T6 ON T2.U_SPCatgry = T6.U_CatCode
     INNER JOIN [OTER]  T7  ON T3.Territory = T7.territryID
WHERE T1.[ItemCode] = T2.[ItemCode]
and T0.DocType ='I'
AND T4.ADRESTYPE='S'
and T2.U_SPCatgry IN ('079','168','169','XXX','YYYY')
--and T3.[QryGroup22]= 'Y'
and  T0.[DocDate] between '[%0]' and '[%1]'
Replace XXX and YYYY with your category value to all other category value.
Thanks & Regards,
Nagarajan

Similar Messages

  • How to find out whether a particular changed by some user

    Hi gurus,
                I am just trying to figure it out how to find out whether a particular user has changed a particular table or not. In other words table changes history. If any of you know about it please let me know.
    Thankyou
    Jason

    Jason,
      Ajay mentioned changes to Table not for Data. If you are looking for Changes to Table Data... you need to check System Log SM21. check for that perticular period.
    Nagesh Ganisetti.
    Assign points if it helps.

  • How to find Info objects for particular filed??

    Hi
    I hav doubt Can anyone tel me???
    My Query s <b>How to find Info objects for particular filed??</b>
    For example i hav some table fileds, how to find Info objects for that fields??
    Pls explain me detaily
    Points wil be given for all answers.
    Thanks
    Senthil

    Hi Senthil ,
    You have your field description along with your Field right.
    For example:MATNR - Material Number
    Now take this description and go to your BW side Tcode:RSA1
    1)Search in Modelling >> Infoobjects >> Material Number
    Then you get few hits (matches)  which have description matched.
    For Example: 0material  - Material Number
    Check for the Length and type match.
    You will understand once you get those hits as to which is related to yours.
    2)Go to BI content and search in the infoobjects this has all active and inactive objects but this takes a little time (not much  though).
    3) You have meta data search / simple search also where you can search for the objects with field description as matching criteria.
    Hope your doubt is cleared atleast to some extent.
    Assign Points if helpful.
    Thanks,
    Priyanka

  • How to find invoice open item

    how to find invoice open item.

    Hi,
    You can get the open items from BSIS.
    To get the details of open items you need to do as below :
    1. Get all the document numbers from BSIS table based on year(GJAHR) and period (MONAT).
    2. Once you get all the open items from BSIS, go to BSAS with the document number retreived from BSIS.
    Now you will have two internal tables, one with open items and one with closed items. Now you need to segregate the open items and closed items from BSIS.
    loop at it_bsis.
    read table it_bsas with key bukrs = it_bsis-bukrs
                                            hkont = it_bsis-hkont
                                            gjhar = it_bsis-gjahr
                                            monat = it_bsis-monat.
    if sy-subrc eq 0.
        delete it_bsis.
        clear it_bsis.
    endif.
    endloop.
    Now you are left with only open item only.
    Thanks,
    Sriram Ponna.

  • Tcode FV50: How to find long text in FI Document line item Before Saving.

    Hi,
    How to find long text in FI Document line item.
    During Parking of the FI document through Tcode FV50 i m giving the some text in the long text not in the text field.
    I would like to validate the Long Text Before Saving in user exit "U300" under  the  "Sunstitution" .
    Please anybody can be help me out where exactly this long text is going to be stored or in which internal table or memory id.
    Please give me the answer as soon as possible .
    Note:- Read_Text function module is not useful. Because Read_text useful after saving document.

    Hi Amit,
    In application area FINANCIAL ACCOUNTING , go for node LINE ITEM. Here create a step & maintain the prerequisite as per your requirement & in the check you can mention the code or you can direct it to a custom program like ZFI_RGGBR000.
    Here while maintaining the check you will get structures BKPF & BSEG in which you will get the desired field you are looking for.
    Just try to explore in your system how the other validations are maintained.
    After you are done with all your code, you have to run the regeneration program RGUGBR00.
    Here utmost care should be taken while running regeneration program, you should select all the checkboxes in the selection screen except  GENERATE SETS, GEN SUBSTN ROUTNS IN ALL CLNTS  & TRACE PROG. GENERATE CALLS .
    Hope this make your doubt clear.
    Regards
    Abhii

  • How to find out if a long String has a "subString" twice or more.

    I need to find out if a long String has the same number twice or more.
    I need to look matches for numbers running from 000, 001....999 and if a number is found twice or more, return that number and lines there were found.
    example String:
    -;000 ; 1 ; 2006-12-11 ; -; job;
    x;001 ; 2 ; 2006-12-11 ; 2006-12-12; do this
    -;002 ; 3 ; 2006-12-11 ; -; work
    -;003 ; 0 ; 2006-12-11 ; -; some
    -;004 ; 2 ; 2006-12-11 ; -; thing
    x;005 ; 1 ; 2006-12-11 ; 2006-12-11; reads
    -;003 ; 0 ; 2006-12-11 ; -; here
    Should return from example String:
    003 at lines 4 and 7
    Any ideas?

    So there are newlines in the String?
    You could use a StringTokenizer to break the String into lines, then searching on each line if it contains any of the search strings. (You need to clarify if a line can contain more than one search string).
    Probably you should use a Map<String, Integer> to record the searchcounts.
    Or an int[] Array if you are really sure that the Strings you search for really are numbers.
    Another option is to use:
    LineNumberReader lnr = new LineNumberReader(new StringReader(searchString));This will save you from explicitly having to take care for the line number.
    In any case your example looks like the individual lines are semicolon separated fields and the numbers you search for always are in column two.
    So after breaking up the original String in lines, you could use another StringTokenizer to break up the line in fields.

  • How to display invoices of a particular customer in AR?

    Hi All,
    I have a requirement to develop a report that identifies invoices of a particular customer parts that could have used incorrect pricing.
    Report will run 10th and 25th of each month. Report should identify the invoice line items since the prior report that meet the criteria that Invoice amt for one a part exceeds $5000
    Columns in report will be
    Oracle Part Number
    Customer Part Number
    Part description
    Invoice Num
    Customer Code
    Customer Name
    Invoice Date
    PO num
    Quantity
    Unit Price
    Price history for last 60 days
    Min and Max prices,
    Price Variance %
    Could you please let me know how I should get the above columns from a price list and customer tables
    Thanks in advance,
    Prathima

    Hi,
    If you just want to display two columns of a list, Content Query Web Part will be more appropriate:
    http://community.bamboosolutions.com/blogs/sharepoint-2013/archive/2013/05/10/how-to-use-the-content-query-web-part-to-rollup-data-in-sharepoint-2013.aspx
    To display multiple columns, here is a similar thread for your reference:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/1484df2b-0fb9-4b58-b833-a75019db88c7/content-query-display-multiple-columns
    Best regards
    Patrick Liang
    TechNet Community Support

  • How to find Invoices approved by me and sort them after supplier?

    Hi,
    Please help ?
    How to find the invoices which I have approved in SAP ?
    how to find the invoices which I have approved in SAP and sort after supplier ?
    Can these searches be combined ?
    I appreciate your immediate reply
    Regards,
    Sairam.

    What do you mean by approving invoice?

  • How to tail log files from particular string

    Hello,
    We would like to tail several log files "live" in powershell for particular string. We have tried to use "get-content" command but without luck because everytime as a result we received only results from one file. I assume that it was
    caused by "-wait" parameter. If there is any other way to tail multiple files ?
    Our sample script below
    dir d:\test\*.txt -include *.txt | Get-Content -Wait | select-string "windows" |ForEach-Object {Write-EventLog -LogName Application -Source "Application error" -EntryType information -EventId 999 -Message $_}
    Any help will be appreciated.
    Mac

    Because we want to capture particular string from that files. Application writes some string time to time and when the string appears we want to catch it and send an eventy to application log, after it our Nagios system will raise alarm.
    Mac
    Alright, this is my answer, but I think you won't like it.
    Run this PowerShell code in PowerShell ISE:
    $file1='C:\Temp\TFile1.txt'
    '' > $file1
    $file2='C:\Temp\TFile2.txt'
    '' > $file2
    $special='windowswodniw'
    $exit='exit'
    $sb1={
    gc $using:file1 -Wait | %{
    if($_-eq$using:exit){
    exit
    }else{
    sls $using:special -InputObject $_ -SimpleMatch
    } | %{
    Write-Host '(1) found special string: ' $_
    $sb2={
    gc $using:file2 -Wait | %{
    if($_-eq$using:exit){
    exit
    }else{
    sls $using:special -InputObject $_ -SimpleMatch
    } | %{
    Write-Host '(2) found special string: ' $_
    sajb $sb1
    sajb $sb2
    In this code, $file1 and 2 are the files being waited for.
    As I understood you, you care only for the special string, which is in the variable $special.
    All other variables, will be discarded.
    Also, whenever a string equals to $exit is written to the file, the start job corresponding to that file will be terminated, automatically! (simple, right?)
    In the example above, I use only 2 files (being watched) but you can extend it, easily, to any number (as long as you understand the code).
    If you are following my instructions, at this point you have PowerShell ISE  running, with 2 background jobs,
    waiting for data being inputed to $file1 and 2.
    Now, it's time to send data to $file1 and 2.
    Start PowerShell Console to send data to those files.
    From its command line, execute these commands:
    $file1 = 'C:\Temp\TFile1.txt'
    $file2='C:\Temp\TFile2.txt'
    $exit='exit'
    Notice that $file1 and 2 are exactly the same as those defined in P
    OWERSHELL ISE, and that I've defined the string that will terminate the background jobs.
    Command these commands in PowerShell Console:
    'more' >> $file1
    'less' >> $file1
    'more' >> $file2
    'less' >> $file2
    These commands will provoke no consequences, because these strings will be discarded (they do not contain the special string).
    Now, command these commands in PowerShell Console:
    'windowswodniw' >> $file1
    '1 windowswodniw 2' >> $file1
    'more windowswodniw less' >> $file1
    'windowswodniw' >> $file2
    '1 windowswodniw 2' >> $file2
    'more windowswodniw less' >> $file2
    All these will be caugth by the (my) code, because they contain the special
    string.
    Now, let's finish the background jobs with these commands:
    $exit >> $file1
    $exit >> $file2
    The test I'm explaining, now is DONE, TERMINATED, FINISHED, COMPLETED, ...
    Time to get back to PowerShell ISE.
    You'll notice that it printed out this (right at the beginning):
    Id Name PSJobTypeName State HasMoreData Location Command
    1 Job1 BackgroundJob Running True localhost ...
    2 Job2 BackgroundJob Running True localhost ...
    At PowerShell ISE's console, type this:
              gjb
    And you'll see the ouput like:
    Id Name PSJobTypeName State HasMoreData Location Command
    1 Job1 BackgroundJob Completed True localhost ...
    2 Job2 BackgroundJob Completed True localhost ...
              (  They are completed!  )
    Which means the background jobs are completed.
    See the background jobs' outputs, commanding this:
              gjb | rcjb
    The output, will be something like this:
    (1) found special string: windowswodniw
    (1) found special string: 1 windowswodniw 2
    (1) found special string: more windowswodniw less
    (2) found special string: windowswodniw
    (2) found special string: 1 windowswodniw 2
    (2) found special string: more windowswodniw less
    I hope you are able to understand all this (the rubbishell coders, surely, are not).
    In my examples, the strings caught are written to host's console, but you can change it to do anything you want.
    P.S.: I'm using PowerShell, but I'm pretty sure you can use older PowerShell ( version 3 ). Anything less, is not PowerShell anymore. We can call it RubbiShell.

  • How to find which infoobject uses particular attribute

    HI,
    I want to know which infooject have the attribute :0prod_descr. How to find it? Please let me know.
    Regards,
    siddhu

    Hi,
    Select where -Used list option for your object 0prod_descr  and find the objects.
    Regards,
    Krishna Reddy

  • How to stop  Invoice Split For particular  Sold to Party

    Dear All
    Whenever we create a billing document for a particular customer, based on the No. Of Line Item, it is getting splitted. My client is using SAP 4.7. Please let me know what could be the problem
    Regards
    Paulraj
    Edited by: paulraj S on Feb 25, 2009 1:06 PM
    Edited by: paulraj S on Feb 25, 2009 1:56 PM

    Whenever we create a billing document for a particular
      customer, based on the No. Of Line Item, it is getting splitted
    Do you mean to say that for other customers, invoice is not splitting based on line items ??  If so, you need to provide more details on
    -  whether order type is different
    -  whether item category is different
    Unless some setting is maintained differently or in sale order for that customer, if any data is different at line item level, then you will get invoice split.  Check all the item level datas
    thanks
    G. Lakshmipathi

  • How to find classes in a particular package?

    Does anyone know how in Java to find out what classes belong to a particular package? Or to find out what classes inherit from a particular class?
    The reason why I'm asking this is that I want to create a BeanInfo property editor for a widget that will give me a list of any classes in a particular package. I know what that package can be and I know what the main class is that everyone should inherit from. I can easily create a beaninfo property editor with a string array of the classes, but I don't want to have to go back and maintain this code everytime I add another class to that package. I would love to use introspection but I haven't found the right commands to use yet.
    Anyone have any ideas?
    Thanks!

    Not too difficult, the following snippet is used to gather information about a class. beanClass can be parsed to extract package name. and you ask the class directly about its superClasses and implemented Interfaces.
        private Class beanClass = null;
        private Class beanSuperClass = null;
        private Constructor[] constructors = null;
        private Field[] fields = null;
        private Method[] methods = null;
        private Object beanInstance = null;
        public setBeanDetail(Object o) {
            beanInstance = o;
            beanClass = o.getClass();
            beanSuperClass = beanClass.getSuperclass();
            constructors = beanClass.getConstructors();
            fields = beanClass.getDeclaredFields();
            methods = beanClass.getMethods();
        }have loads of fun with it.
    tj...

  • How to find Invoice number linked to FI accounting document number ??

    Hello All,
    I have been looking around for all possible combinations to find the link between FI accounting document number (BSEG-BELNR) and Intercompany Invoice number (for which billing corr. to STOs' or POs' is done).
    The requirement is that during ERS posting, we have accounting document numbers (BSEG-BELNR) and associated STOs' for this (BSEG-EBELN), but we are unable to map the Intercompany Billing Invoice number(s) (where the billing corr. to STOs' obtained from BSEG-EBELN) to this accounting document number (BSEG-BELNR).
    Any pointers or detailed view solution would be of great help.
    Thanks,
    Ansh

    Hello DPM,
    Thank you for the descriptive help. But my requirement is to look for Intercomapny Billing number (VBRK-VBELN) linked to an accounting document number (BSEG-BELNR) and not Invoice Receipt Number.
    The steps that I am following are:
    From BSEG, found EBELN (Stock Transfer Order) and XREF3 (Reference Key, combination of fiscal yr., some ref. number, maybe GR no. and ref item no.), based on BELNR (Accounting document number).
    From EKBE, found XBLNR (Reference Delivery Number or Direct Intercompany Billing Number on which GR is done) based on
    EKBE - EBELN = BSEG - EBELN
    EKBE - BELNR = BSEG - XREF3 (only ref and item no., considering it to be a GR no.)
    EKBE - VGABE = '1' and EKBE - BEWTP = 'E'.
    From VBRP, found VBELN (Intercompany Billing No., which is a desired number) based on
    VBRP - AUBEL = EKBE -EBELN (Stock Transfer Order)
    VBRP - VGBEL = EKBE - XBLNR (Delivery number)
    Here, I am not sure about 2 things:
    Whether the reference no in BSEG-XREF3 will always be Goods Receipt number for Stock Transfer Order or not. If not, then what it can be and how I will have to proceed further then.
    Secondly, If in case for an accounting document number, I have 2 Stock Transfer orders (BSEG - EBELN) and same reference number (BSEG-XREF3), then from History table (EKBE) I get only single delivery based on which GR was doen for both STOs', then I shall be getting single Intercompany Billing Invoice from VBRP or different ?
    Kindly provide your inputs.
    Thanks,
    Ansh

  • How to find permissions of a particular user on a table

    Hi
    every body i have requirement to check the permissions of a particular user on a table ,
    requirement is i am building a query builder ,wherein i have to load all the tables from database ,before loading the tables i need to check whether the user looged in as select permissions on that table ,
    how can this be achieved

    Here is an article with a list of privilege related dictionary views
    How do I find out which users have the rights, or privileges, to access a given object ? http://www.jlcomp.demon.co.uk/faq/privileges.html
    HTH -- Mark D Powell --

  • How to find business object for particular tcode at particular event

    Hi,
    I want to know how i can find particular business object for particular tcode for certain event?
    For example suppose for tcode PA40, if i create infotype for employee and when i save it after creating it then it must be stored in certain object. How i can find business object where all data realted to emp. get saved?
    Thanks & Regards,
    Parag

    Hi Parag,
    To get the business object for given transaction,
    1) Go to transaction SWELS
    2) Switch on the event trace.
    3) Go to the given transaction (For which you want to know the business object)
    4) Execute the transaction
    5) Go back to SWELS and Switch off the event trace
    6) Go to transaction SWEL.. Here you will get the Business Object name (one which starts with BUS)
    Hope this will help you.
    Best Regards,
    Deepa Kulkarni

Maybe you are looking for

  • Time Machine Keeps Thinking That it's a New Backup

    We're running Snow Leopard Server on a Mac Mini, and are using an external FW drive for Time Machine backups of the server and shared data only, no client backups. Time Machine has not worked since we setup the Mac Mini, but was working well on the p

  • Access to external drives connected to Airport Extreme via USB Hub

    I have 2 computers connected wirelessly to an Airport Extreme 802.11n base station. I have a Belkin powered USB hub connected to the USB port on the Extreme. There is a Lacie hard drive, a USB printer and a Kingston flash drive connected to the USB h

  • Customizing ODBC errors in OBIEE 11g

    Hi, I have a requirement where the user is expecting to see some Custom error messages instead of the Default ODBC errors OBIEE throws. Like the one below. Error generating view. Error getting cursor in GenerateHead   Error Details Error Codes: OAMP2

  • Problem in adding a new business partner

    hi all            iam getting an error like "Bank account is missing",when i add a new business partner..i think iam missing any mandatory field..can anybody help me..i have posted my add BP coding in the last... <?xml version="1.0" encoding="utf-8"

  • Intel SpeedStep and Fan not working

    Hello, I have an older Toshiba laptop: Satellite M30 (PSM30C-7100K).  A couple of years ago I had replaced the motherboard but have not noticed until now that the fan is never on and that the CPU is always stuck at 600MHz (Capable of 1.6GHz).  I have