Select last document part 2

Hi
I recently had some assistance that gave me the following query
SELECT Top 1 T1.ItemCode, T1.Dscription, T0.DocDate,T1.Quantity,
T0.DocNum, T0.CardCode, T0.CardName
FROM dbo.OPOR T0
INNER JOIN dbo.POR1 T1 ON T0.DocEntry = T1.DocEntry
WHERE (T1.ItemCode ='[%0]' OR T1.Dscription = '[%1]'
Order By T0.DocDate DESC
However I would like to amend this so I could enter 4 or 5 different ItemCode or Dscription in the Selection Criteria, and it return the latest documents for each one.
Many thanks.
A

Thanks Gordon
I have tried many many different permutations of using UNION ALL to get this working, but I can't!  The query below is the closest I've got, however it returns the first entry (document date wise) rather than the last or latest one.
Apologies if this is very simple, but I'm very much the SQL novice!
Your help is much appreciated.
Andy
SELECT Top 1 T1.ItemCode, T1.Dscription, T0.DocDate,T1.Quantity,
T0.DocNum, T0.CardCode, T0.CardName
FROM dbo.OPOR T0
INNER JOIN dbo.POR1 T1 ON T0.DocEntry = T1.DocEntry
WHERE T1.ItemCode ='[%0]'
UNION ALL
SELECT Top 1 T1.ItemCode, T1.Dscription, T0.DocDate,T1.Quantity,
T0.DocNum, T0.CardCode, T0.CardName
FROM dbo.OPOR T0
INNER JOIN dbo.POR1 T1 ON T0.DocEntry = T1.DocEntry
WHERE T1.ItemCode ='[%1]'
Order By T0.DocDate DESC
Edited by: SimpsonA on Feb 24, 2011 3:26 PM Added DESC to the Order By statement (missed it when pasting)

Similar Messages

  • No v9 properties toolbar access except in last document opened

    Has anyone else noticed this in v9.0 or 9.1 of acrobat?
    You want to change the properties of an object such as the text format in a comment/markup text box and, even though you can select the text, "No current selection" is reported where the properties would normally appear.
    This seems to only happen when the document being edited is not the last one opened by acrobat. It seems to hold true for shapes and other items that could otherwise be modified using the properties toolbar. Disabling and re-enabling the toolbar does not help. Closing the document and then re-opening it does fix the problem for the one document because now the document is the last document opened, but now the prior "last document opened" no longer works in this respect, even if it had been working.

    Still not fixed!
    Assumptions for this test:
    1. Acrobat has been configured so that the "Text Box Tool" (part of the "Comment & Markup Toolbar") is visible on the toolbar.
       (Tools --> Customize Toolbars... may need to be used to se this up)
    2. The "Properties Bar" is visible (a Ctrl-E should bring it up if it is not already so)
    If you had to make changes to get this configuration set, close all Acrobat windows before proceeding so that the settings will be remembered and used when new windows are open.
    ******BUG******
    Text box TEXT PROPERTIES only accessible in most recent file opened.
    Steps to reproduce bug:
    1. Open a 1st PDF
    2. Open a 2nd different PDF
    3. Arrange so both are visible.
    4. in the 1st PDF create a text box and notice how the window for the 2nd PDF gets the TEXT BOX PROPERTIES BAR
    5. notice how there is no way to change the text box properties in the first window.
    Results: Text box properties can only be changed in the most recently opened window.
    Expected results: Text box properties should work for all windows!
    Note that no properties (color, fill, font, ...) of any object (line, rectangle, callout, ...) can be changed using the Properties Bar if the properties bar is not part of the last window opened.
    The only kludgy workaround I've found is that if I need a working properties bar in a particular window I can:
    1) save the file to capture any outstanding changes that might not have been captured (this is an optional step)
    2) make a throw-away minor change to the file (I usually draw a short line segment)
    3) Go to File --> Revert (& Confirm)
    The file will close and reopen without the throw-away change and it will now be the last file opened so it will now have a working properties bar.

  • Not able to add Select Supported Document Types

    Hi
    I am new to Oracle B2B.
    Going through the steps given in the tutorial http://download.oracle.com/docs/cd/E14571_01/integration.1111/e10229/b2b_tps.htm#BABGAJDE
    Completed till 5.3 - Task 2 (Add a User in the Oracle B2B Interface)
    And the Next thing,
    I am not able to Add Select Supported Document Types.When I click on the "Add supported document type for the selected user", i can see "CUSTOM", "EDI_EDIFACT" etc... but in that screen my "Add" Button was disabled.
    Please let me know how to proceed with this.
    Thanks,
    Deepthi.
    Edited by: 796969 on 27/09/2010 14:11

    Hi Deepthi,
    You can download the samples from below location. Samples also has document for step by step configuraion:
    B2B Samples are part of SOA samples:
    http://www.oracle.com/technology/sample_code/products/soa/index.html
    Developer Notes / Step by Step configuration guide:
    http://www.oracle.com/technology/products/soa/b2b/index.html
    http://www.oracle.com/technology/products/soa/b2b/collateral/B2B_TU001_EDI.pdf
    http://www.oracle.com/technology/products/soa/b2b/collateral/B2B_TU002_HL7.pdf
    http://www.oracle.com/technology/products/soa/b2b/collateral/B2B_TU003_ebxml.pdf
    http://blogs.oracle.com/oracleb2bgurus/2010/04/oracle_b2b_started_kit.html
    Please let us know which usecase you are trying for more details.
    Rgds,
    Nitesh Jain
    [email protected]

  • How to Select the Document just back of the Active Document

    If there are 5 documents open in photoshop I want to select the document just behind or back of the Active Document , using script.
    One of my friend suggested me the bleow script, but it is selecting the previous document, not exactly the document back of the active document.
    please help me.
    var id85 = charIDToTypeID( "slct" );
        var desc21 = new ActionDescriptor();
        var id86 = charIDToTypeID( "null" );
            var ref11 = new ActionReference();
            var id87 = charIDToTypeID( "Dcmn" );
            ref11.putOffset( id87, -1 );
        desc21.putReference( id86, ref11 );
    executeAction( id85, desc21, DialogModes.NO )

    I had the same problem. I did not want to go back to the "last viewed" doc but to the doc opened before the active one.
    I use this on F1 key to go back to the previous opened document (index order -1).
    It works great.
    #target photoshop
    // Go back to the last opened doc. If it is the oldest opened one it does not give error window and stays on it.
    if(documents.length>0) {
        var thisIndexImage = getActiveDocumentIndex();
        var theDocs = app.documents;
        if ( thisIndexImage != 0 ) {
            var openedBefore = theDocs[thisIndexImage - 1];
            } else {
            var openedBefore = theDocs[0];
        app.activeDocument = openedBefore;
    } else {
        alert ("You need to have any opened documents to apply this script.")
    // Functions
    function getActiveDocumentIndex(){
         var ref = new ActionReference();
         ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
         return desc = executeActionGet(ref).getInteger(stringIDToTypeID('itemIndex'))-1;

  • Unbale to create new document part with same document number

    Number range assigned to the X Document Type is internal. I have created new document (0001) with Document Part 000 & Version 00. For same Document Number when i tried to create New Document part by mentioning Document Numner 0001, Document Part 001 and Version 00, it says Document Type X can be assigned to internal number range only.
    Even I tried with following selection....
    Document Number = Blank
    Document Part = 001
    Document Version = 00
    Template:
    Document = 0001
    Document Part = 000
    Document Version = 00
    Now system is creating document with new number i.e. 0002.  But we want to create another document part with same Document Number. What is the problem with internal number range for Document Number?

    Hi Pradeep,
    Following are the config parameter of the document type.
    CM Relevnce = blank
    Number assignmt= 01
    Internal Number Range =02
    External Number Range= blank
    Number Exit =MCDOKZNR
    Vers. No. Incr. =0
    Version Sequence = blank
    AlternativeScreen = blank
    Let me know if you need anything more.
    Edited by: JJSingh76 on Dec 7, 2010 7:25 PM

  • Selecting a document field for a field in a condition table/access

    Hello
    I created a pricing condition table using field WGHIE from the standard field catalog.
    Img/SD/Basic Functions/Pricing/Pricing Control/Define Access Seq
    I can assign the table to a access, but when I try to do the field assigment it give's me the message "<i>Select a document field for WGHIE</i>"  at the field assignment part.
    In the fields display the WGHIE field has nothing listed in the Doc Field and it's grayed out so you cant change it.   Also in the I/0 field its red lighted
    Any ideals as to how I can fix this.   
    Thanks

    Rudy,
    For more information, see Transaction SPRO via the path 'Sales and Distribution -> System Modifications -> Create New Fields (Using Condition Technique) -> New Fields for Pricing' and OSS Note 21040
    REWARD IF U FINDS THIS AS USEFUL...
    Regds
    MM

  • Document part field customization

    Hello All,
           Is there anywhere we can customize DIR key field DOCUMENT PART for specific doc type.
    I searched in DC10, but I get only Document Version Numbering only. Where will I find an option to customize DOCUMENT PART?
    Thanks!!
    Regards,
    Saravana

    Hi Saravana,
    Could you check under SPRO --> Cross-Application components --> Document management
    You may get some configuration steps if available.
    When user creates document using CV01N, he may select the part name from the F4 list configured
    Regards,
    Regards,
    Deepak Kori

  • Navigate to next document without saving any changes in last document in AxWebBrowser

    Hi,
    I am opening MS Office Document file in AxWebBrowser after that i navigate to next Office Document ,before navigating i saved the last document like this
    AxWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_SAVE, SHDocVw.OLECMDF.OLECMDF_ENABLED)
    but how can i navigate to next Document without saving it if it also have any changes?
    if i do not use above line of code it ask for "Save","Don't Save" and "Cancel" before navigating to next document.
    help me thankx

    Hi,
    I am opening MS Office Document file in AxWebBrowser after that i navigate to next Office Document ,before navigating i saved the last document like this
    AxWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_SAVE, SHDocVw.OLECMDF.OLECMDF_ENABLED)
    but how can i navigate to next Document without saving it if it also have any changes?
    if i do not use above line of code it ask for "Save","Don't Save" and "Cancel" before navigating to next document.
    help me thankx
    Hello,
    In this case, we need to get the object for that document inside the NavigateComplete2 event.
    And then we could call its
    close method before we navigate to the other document.
    For get the document object we could refer to the sample shared in
    How to use the WebBrowser control in Visual Basic to open an Office document
    Public Class Form1
    Dim OpenFileDialog1 As OpenFileDialog = New OpenFileDialog()
    Dim oDocument As Object
    Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click
    Dim strFileName As String
    'Find the Office document.
    With OpenFileDialog1
    .FileName = ""
    .ShowDialog()
    strFileName = .FileName
    End With
    'If the user does not cancel, open the document.
    If strFileName.Length Then
    oDocument = Nothing
    AxWebBrowser1.Navigate(strFileName)
    End If
    End Sub
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Button1.Text = "Browse"
    With OpenFileDialog1
    .Filter = "Office Documents " & _
    "(*.docx, *.xlsx, *.ppt)|*.docx;*.xlsx;*.ppt"
    .FilterIndex = 1
    End With
    End Sub
    Private Sub Form1_Closing(ByVal sender As Object, ByVal e As _
    System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
    oDocument = Nothing
    End Sub
    Private Sub AxWebBrowser1_NavigateComplete2(ByVal sender As Object, _
    ByVal e As AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event) _
    Handles AxWebBrowser1.NavigateComplete2
    On Error Resume Next
    oDocument = e.pDisp.Document
    'Note: You can use the reference to the document object to
    ' automate the document server.
    MsgBox("File opened by: " & oDocument.Application.Name)
    End Sub
    End Class
    And for closing part, we could refer to
    How to: Programmatically Close Documents.
    Regards,
    Carl
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Why do applications always open the last document or page viewed?

    I love my Mac.  But since I got my new iMac and OS Lion, I've had a hard time with one option and I can't figure out how to turn it off.
    When I open Excel, it opens the last document viewed.  Even when I click on a new document, it still opens the last document.  When I open Safari, it takes me to the last page viewed.  Its very annoying, probably useful to someone other then me. How do I turn this feature off?
    Thanks
    Jim

    That is part of Resume, a feature that re-opens the documents that were open when you quit.
    You can turn it off system-wide in the General System Preferences.
    On a per-app basis, you can only use the cmd-option-q shortcut or menu to close all windows and quit.

  • OSA - Last Document Link - Bug?

    Hi Expert,
    When we click on the Last Document Link(to view last year appraisal document) from the Main Document, the standard Badi will display the full document which include all the part-appraisal columns (PAPP) and Final Colum (FAPP).
    How can we hide the PAPP columns when click on the Last Document Link (i.s. we only want to display the FAPP column)?
    Thanks!
    Regards,
    S.Y

    Hi,
    We are also moving from EHP3- BSP to EHP4 -Webdynpro   PMR application. we have 2 templates
    1.2009 which is BSP ( Completed)
    2.2010 -New Wd   and created the other one with 2009 date(completed)
    If we click the 2010 last document button its picking  the previous year ie 2009 completed one which is  NEW WD one.
    We need to get the old appraisal documents which are in 2009  BSP  ,Please advise us how to bring this functionality using the HRHAP00_LINK_003 .
    Thanks in advance
    Regards
    Kumar

  • Application it starts the the last document opened instead a new one

    After I upgraded to 10.7.2, When I open an application it start the the last document opened when I closed. This is for all MS Office (Word, Excell, PPT), Safari (opens the last tab and not the home site). Any solution to this?

    Doesn't this happen to you too?
    Not any more.
    I unchecked the dialog in System Preferences.
    I properly quit (Command + Q or File > Quit) every application before shutting down. It has always been the default OS behavior that whatever window you had open at shutdown or restart will open when you boot up - that behavior is not new.
    I also uncheck the dialog window before/while shutting down.
    And, I went a step further (this will stop all):
    Open your now hidden User Library folder by holding Option key and going to Go in Menu.
    Scroll down to "Saved Application State" folder.
    Select all content and drag to trash.
    With that folder highlighted, hold Command + I keys.
    In the resulting window (you may have to unlock the lock at the bottom and input your admin password), check the box next to "Locked".
    Lock the lock at the bottom.
    Doing this will prevent any files being written to that folder which means there is nothing "saved". My folder has been empty since I locked it.
    P.S. The macworld article works as well.....

  • FI Last document created.

    Hi experts,
    How can i retrieve the last document created on FI?. I used to get it from a function module, but i can't remember the name. I was looking for it on the se37, but without results.
    Thanks in advance,
    Steve.

    try this
    ..SELECT * UP TO 1 ROWS FROM bkpf
            APPENDING CORRESPONDING FIELDS OF TABLE rec
            ORDER BY cpudt DESCENDING
                     cputm DESCENDING..
    grx
    A.
    P.S.
    hi sql-gurus
    there must be a better solution:
    here's the long version
    ..  SELECT MAX( DISTINCT cpudt ) FROM bkpf INTO rec-cpudt.
      SELECT MAX( DISTINCT cputm ) FROM bkpf INTO rec-cputm
                 WHERE cpudt = rec-cpudt.
      SELECT SINGLE * FROM bkpf
              INTO CORRESPONDING FIELDS OF rec
              WHERE  cpudt =  rec-cpudt
              AND    cputm = rec-cputm.
    is there a solution with native sql???
    Edited by: Andreas Mann on Aug 6, 2010 12:00 PM

  • Get Last Document from document flow

    I would like to retrieve last document flow's document. i use VBFA and pass Preceding sales and distribution document to where condition and get Subsequent sales and distribution document but i don't know how to get the latest one.
    I use
    select single VBELN into last_doc from vbfa
    where VBELV = 'preceding doc'
    order by ERDAT ERZET
    but it's not work. How can i do that. Thanks!

    try like this
    data : begin of vbfat occurs 0,
            last_doc like vbfa-vbeln,      
            last_date like vbfa-erdat,
            end of vbfat.
    select vbeln max( erdat ) into table vbfat from vbfa
            where VBELV = 'preceding doc'
              group by vbeln.
    loop at vbfat.
    <do the processing.>
    endloop.
    regards
    shiba dutta

  • Netprice Picked up from last document-Open PO load using LSMW BAPI method.

    Hi Experts,
    I m doing Open PO load using LSMW BAPI method...(BAPI_PO_CREAT1).
    Inside the LSMW BAPI picks up the NETPR value from the last document and doesnt consider the value from load file...
    Please advice me how to handle this issue...
    I tried giving values to field CALCTYPE at item level or POCOND table with with carry out new pricing options....but nothig works for me...
    PLease give your valuable inputs to achieve the requirement....
    Bharathi.J

    read OSS Note 580225 - Purchasing BAPIs: Conditions and pricing

  • HOW TO FIND LAST DOCUMENT DATE BASED ON MATERIAL NUMBER

    Hi,
           I want to know how to find the last document details based on material number.
    Is there any Functional modulle or BAPI programe?
    i,e, I want know last goods receipt details (MIGO)  based on material number.
    Can u please anybody tell me.
    Thanks,
    S.Muthu.
    Edited by: Subramaniyan Marimuthu on Jan 2, 2008 9:07 AM

    Hello.
    Check the BAPI_GOODSMVT_GETITEMS
    -example--
    Get GRs after a specific date for a specific plant/ storage location and movement types
      wa_budats-sign = 'I'.
      wa_budats-option = 'GE'.
      wa_budats-low = '20071201'.
      APPEND wa_budats TO budats.
      wa_plants-sign = 'I'.
      wa_plants-option = 'EQ'.
      wa_plants-low = '1000'.
      APPEND wa_plants TO plants.
      wa_stlocs-sign = 'I'.
      wa_stlocs-option = 'EQ'.
      wa_stlocs-low = '0001'.
      APPEND wa_stlocs TO stlocs.
      wa_mvts-sign = 'I'.
      wa_mvts-option = 'EQ'.
      wa_mvts-low = '101'.
      APPEND wa_mvts TO mvts.
      wa_mvts-low = '901'.
      APPEND wa_mvts TO mvts.
      wa_mvts-low = '123'.
      APPEND wa_mvts TO mvts.
      CALL FUNCTION 'BAPI_GOODSMVT_GETITEMS'
        TABLES
          plant_ra        = plants
          stge_loc_ra     = stlocs
          move_type_ra    = mvts
          pstng_date_ra   = budats
          goodsmvt_header = header
          goodsmvt_items  = item
          return          = return.
    Reward if helpful.
    Cheers,
    George

Maybe you are looking for

  • BasicService.showDocument() problem on Windows XP

    HI, I have discovered a problem with BasicService.showDocument() on some installations of Windows XP. The symptom is that: basicService.isOffline() return false basicService.isWebBrowserSupported() returns true but basicService.showDocument(url) retu

  • IPod nano 7th gen not found in iTunes/"no disc in drive" Windows computer.

    I bought a brand new iPod nano 7th generation yesterday. When I plugged it into my Windows computer it began set up then stopped and a pop up appeared ''no disc in drive'' directly after that the next pop up read ''iPod cannot sync because it was not

  • EXC_BAD_ACCESS (SIGBUS)--RAM problems???

    Crash help needed...repeatable with iPhoto, Photobooth, Skype, and general dogged-ness of the machine. AN example of one crash log: Process:         iPhoto [278] Path:            /Applications/iPhoto.app/Contents/MacOS/iPhoto Identifier:      com.app

  • Using Right {field, 5} in string search

    Hello, I have an array with the following data  xyz5 = 'US 10411', 'US 10421', 'US 10431', 'US 10441' The SN field is 5 character length with data such as 10411, 10421 10441 etc.. How do I search for the last 5 digits of each of the data in the array

  • OS 10.4.3 install is hanging during upgrade!!!

    I'm upgrading from 10.2 to 10.4.3. The installation has hung at "Installing Base System Part 1". The progress bar isn't moving forward and the estimated time remaining is stuck at "1 hour and 15 minutes". Any ideas on the best way to recover from thi