Selecting recent doc by date from ekko

I have Vendor (EKKO-LIFNR) & Company code (EKKO-BUKRS)
I want to select EKKO-EBELN checking that Validity start date (EKKO-KDATB) & Validity end date (EKKO-KDATE) are valid i.e. today date is within the above date range.
Also if there is more than one doc for this combination for Vendor & Company code then we I need to select the doc which is the most recent one. (EKKO-AEDAT is the most recent).
Any one please help me how to fetch the recent doc
I have tried  with MAX( aedat ) but its not working.
If possible please provide the select statement.
Thanks ain Advance
Dhananjay.

Hi,
  Try the below logic:
Select ebeln into l_f_ebeln
FROM EKKO
UP TO 1 ROWS
where lifnr =  l_f_vendor
     and bukrs =  l_f_bukrs
     and kdatb <= sy-datum
     and kdate >= sy-datum
ORDER BY aedat descending.
endselect.
This will give you right result.
Edited by: Ramesh Hirial on Dec 18, 2007 2:02 PM

Similar Messages

  • Hello! i am new to Macbook pro, i have recently transferred my data from my Pc to Mac, i can not open .exe file. Please give me any suggestion regarding this!

    hello! i am new to Macbook pro, i have recently transferred my data from my Pc to Mac, i can not open .exe file. Please give me any suggestion regarding this!
    I have using Mac OS 10.9.2

    Try running it through WineSkin or CrossOver Mac, or installing Windows through VirtualBox, Parallels Desktop, VMware Fusion, Boot Camp, or similar software.
    (106527)

  • Select query to read data from a view

    Hi friends,
    We have been using a query to read data from a custom view which used to work perfectly. Now the program sits at that select query forever. We are able to extract same data from se16. Not sure what could be the problem.
    Thanks in advance.

    Dev
    Have a look at the Table Index for the tables involved in the View... I think there is some change in the Indexes.. (Add / Remove / Change)
    Thanks
    Amol Lohade

  • Selecting a range of data from a file

    Is it possible to only display a selected range of data from a binary file? I can read in my binary files but I would like to only send data within a user defineable range to the data portal for viewing. This range may be over multiple binary files also. I can concatenate these files already but I need to select a range to insert into the data portal.
    Thanks,
    AJL

    OK AJL,
    This sounds good. It's convenient to have the start and stop time of each segment file in the name of that file. By the way, you want to check that in the DataPlugin and "Call RaiseError()" if the data file is not named that way, otherwise you will try to read DIAdem *.DAT files with your custom DataPlugin. DIAdem will try each DataPlugin that is registered with the file's extension (i.e. *.DAT) one after the other, until one of them does not give an error. So you should always check for some identifying characteristic in your data file and "Call RaiseError()" if you don't find it, in order to abort DIAdem using that DataPlugin for files it was never intended for.
    Now to your point. How do you know which series of segment files to read from? Does your VBScript ask the user to select a particular directory that contains all these segment files? I'm going to assume so. My recommendation is that your VBScript also create a time slice configuration file in that directory that contains the information about the time slice you want to read in (start and stop times). Then your DataPlugin can look for that file name in the directory passed to it-- if it finds none it will just load the file path it was passed outright, but if it does find the time slice file it will load any and all *.DAT files in that same directory which correspond to that time slice. This includes loading only parts of one or more of the existing binary files.
    It is straightforward enough to pick out the section of the binary file you want to load with the DataPlugin, once you know the time slice information inside the DataPlugin's callback. Use the File.Position property to move the file cursor to the position of the first data point in the time slice, and use the Block.BlockLength property to specify the number of values to read in each of the channels from that starting point (to exclude the values after the desired time slice). I assume that your binary data is stored interleaved and that you are using DirectAccessChannels to read the values in your DataPlugin.
    Finally, for time slices that span multiple segment files, you will need to load these to separate groups in the Data Portal with the DataPlugin. Then the VBScript can consolidate these channels into long concatenated channels in a new group and delete the temporary segmented groups. In a future version of DIAdem the DataPlugin API will have the ability to do this mapping for you, but not yet. I also have VBScripts that do this concatenation already-- you can download them from www.ni.com/support/diasupp. They're designed for concatenating channels from multiple ASCII/Excel/DAT files.
    Let me know what else you need,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • How do i select last 5 minutes data from table

    there is table called 'x' which has cron job set of interval=5 min,i want to select last 5 min data and delete rest of the data in it or save in one of the table say 'y'.how do i going to do it???kindly help out please??
    Edited by: user10341747 on Sep 24, 2008 10:20 AM

    this is just explanation of other members reply
    insert into Y
    select * from X where timestamp_variable between systimestamp - 5/(24*60) and systimestamp
    this select gives last 5 min data out of that table x .
    members can correct me if iam wrong.
    Thank you.

  • Selecting only normal character data from column

    Hi,
    We have a table column which stores party names and this could consist of non english characters. Would anyone know how do we just select regular english character rows from the table using a select query and not include the rows which have non-english characters?
    Thanks

    There iare two points with the suggestion by Frank.
    First i think he missed an +
    and secondly it doesnt work for example with german umlauts.
    with data as (
    select 'SERPI!! GAB' s from dual union all
    select 'SE£ GRA' from dual union all
    select 'ARA%%& sa' from dual union all
    select 'dasssädsa' from dual union all
    select 'ara€ ssa' from dual union all
    select 'gabriele dsa' from dual
    SELECT     *
    FROM     data
    WHERE     REGEXP_LIKE ( s
                  , '^[A-Za-z]+$'
    no rwos selected
    with data as (
    select 'SERPI!! GAB' s from dual union all
    select 'SE£ GRA' from dual union all
    select 'ARA%%& sa' from dual union all
    select 'dasssadsa' from dual union all
    select 'ara€ ssa' from dual union all
    select 'gabriele dsa' from dual
    SELECT     *
    FROM     data
    WHERE     REGEXP_LIKE ( s
                  , '^[A-Za-z]+$'
    S
    dasssadsa
    (without umlaut)
    so perhaps you will give translate a try e.g.
    with data as (
    select 'SERPI!! GAB' s from dual union all
    select 'SE£ GRA' from dual union all
    select 'ARA%%& sa' from dual union all
    select '@dass äsadsa' from dual union all
    select 'ara€ ssa' from dual union all
    select 'gabriele dsa' from dual
    select s
    ,  translate(
        lower(s)
        ,'@abcdefghijklmnopqrstuvwxyz1234567890 '
      ) t
    from data
    where
    length(
      translate(
        lower(s)
        ,'@abcdefghijklmnopqrstuvwxyz1234567890 '
    < length(s)
    S T
    SERPI!! GAB !!
    SE£ GRA £
    ARA%%& sa %%&
    @dass äsadsa @ä
    ara€ ssa € porjection is just for explanation purpose
    regards

  • Exception 'CX_SY_NO_HANDLER' occured while loading data from EKKO

    Hi Friends,
    An exception occurred which is explained in detail below.
    The exception, which is assigned to class 'CX_SY_NO_HANDLER', was not caught
    and
    therefore caused a runtime error.
    The reason for the exception is:
    An exception with the type CX_SY_OPEN_SQL_DB occurred, but was neither handled
    locally, nor declared in a RAISING clause
    The occurrence of the exception is closely related to the occurrence of
    a previous exception "CX_SY_OPEN_SQL_DB", which was raised in the program
    "CL_RSODSO_SEMANTIC_PACKETIZER=CP",
    specifically in line 79 of the (include) program
    "CL_RSODSO_SEMANTIC_PACKETIZER=CM002".
    The cause of the exception was:
    The database returned a value containing an error
    Can you please help?
    Best Regards,
    Deepinder

    Hi Gokhan,
    Really could not get that.
    I got that error while I load data from PSA to the DSO.
    -Deepinder

  • How to retrieve the doc format data from the database?

    Hi Experts,
         I need to retrieve the doc files ( Cv's) from data base to my presentation server. In order to do that what is the field I can use?

    You can use officecontrol UI element for displaying doc files.
    below are some important links
    [Office Control|http://help.sap.com/saphelp_nw04/helpdata/en/5d/a0b16a9d2e4e4d8b2322af6728263f/content.htm]
    [example|http://help.sap.com/saphelp_srm40/helpdata/ru/ef/3483789514b748b6fe1f145e9685ab/content.htm]
    thanks
    sarbjeet singh

  • Select column by comparing data from another column

    I have a table of products by their price.
    Product
    Price
    bag
    1000
    gloves
    200
    socks
    400
    hat
    100
    need to select all products where price is greater than price of "gloves"...
    Dhananjay Rele

    Select * from Table1
    where Price > (Select Max(price) from Table1
    where Product = 'gloves');
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

  • Query to select value for max date from a varchar field containing year and month

    I'm having trouble selecting a value from a table that contain a varchar column in YYYY-MM format. 
    ex.
    Emp_id Date Cost
    10264 2013-01 5.00
    33644 2013-12 84.00
    10264 2013-02 12.00
    33644 2012-01 680.0
    59842 2014-05 57.00
    In the sample data above, I would like to be able to select the for each Emp_id by the max date. Ex. For Emp_id 10264, the cost should be 12.00.

    create table test (Emp_id int, Date varchar(10), Cost decimal (6,2))
    insert into test values(
    10264, '2013-01', 5.00 ),
    (33644, '2013-12', 84.00 ),
    (10264, '2013-02', 12.00 ),
    (33644, '2012-01', 680.0 ),
    (59842, '2014-05', 57.00 )
    Select Emp_id,[Date],Cost FROM (
    select *,row_number() Over(Partition by Emp_id Order by Cast([Date]+'-1' as Datetime) Desc) rn
    from test)
    t
    WHERE rn=1
    drop table test

  • How do I migrate working docs and data from my Mac Pro to my iCloud account?

    Ive just upgraded to IOS 5 in the belief I can make even better use of my iPhone by using it as a fully featured PDA. This really requires the shuffling of docments and spreadsheets in between my iPhone when I'm mobile and my Mac when I'm back at my desk and need the full functionality it has.  Until I can find a way to move things from the Mac into the cloudI'm stuck.  This may be a stupid question but it, to me, is a fairly fundemental one.

    Plex is a bit of a commitment since it creates a library on a server that you can watch from anywhere on just about any sort of device. If it's something you're going to do frequently (e.g. build a library of mkv or mpeg or avi files) then it's a great solution.
    I think you can probably run the client and the server on the same machine, if you want, though I haven't tried doing it before.  Plex can be found at http://www.plexapp.com
    The client (called Plex Home Theater) has a setting that allows you to pipe the raw bitstream directlty through the optical connections. I rip most of my Blurays with the DTS track and plex handles it beautifully by simply passing the data to the optical out connection which gets decoded by my reciever.
    Let me know if you have a hard time finding the setting and I'll boot up my copy and see where they moved it. 
    Good luck!
    FWIW, I never got VLC to play the bitstream directly to my reciever, but I honestly haven't tried it for about 5 years or and it's changed a lot since then.

  • Multiple select queries used in Excel BI report ,fetching data from Sharepoint DB(SP2010_Prod_ProjectServer) causing blockage on DB ,when more than one workbook(same copy of Excel BI Report) refreshed using Refresh All option.

    I am using mutiple select queries to fetch data from Project Server 2010 DB(its sharepoint DB) and these queries fetch data in Excel BI report by establishing connection with DB using instance name and all. I have enhance all these select queries and data
    is being fetched in secs. but when more than one copy of same Excel BI report is refreshed using 'Refresh All' option, then these select queries cause blockage on DB.
    Please let me know mitigation for this blockage issue.
    Should I use begin transaction and commit transaction statements/ shared lock statements.
    please reply

    Hi,
    run same query at the same time?

  • Select query taking too much time to fetch data from pool table a005

    Dear all,
    I am using 2 pool table a005 and a006 in my program. I am using select query to fetch data from these table. i.e. example is mentioned below.
    select * from a005 into table t_a005 for all entries in it_itab
                       where vkorg in s_vkorg
                       and     matnr in  s_matnr
                       and     aplp   in  s_aplp
                       and     kmunh = it_itab-kmunh.
    here i can't create index also as tables are pool table...If there is any solutions , than please help me for same..
    Thanks ,

    it would be helpful to know what other fields are in the internal table you are using for the FOR ALL ENTRIES.
    In general, you should code the order of your fields in the select in the same order as they appear in the database.  If you do not have the top key field, then the entire database is read. If it's large then it's going to take a lot of time.  The more key fields from the beginning of the structure that you can supply at faster the retrieval.
    Regards,
    Brent

  • Master data extraction from EKKO

    Hi Gurus,
    I need to extract data from EKKO and load it into an Infoobject. What kind of data source I need to create wheter transactional data source or Master data data source.
    Thanks=points,

    Shambu,
    Let me make you clear of my issue.
    there are field called EKKO-ERNAM PO (created by) and EKKO-MEMORY (PO on hold). This should be made available as master data for one info object. In my case it is used in various reports which were built on different ODSes and infosets. Instead of changing all the ODSes and Infosets, I am just pulling this data as master data into on of the info object. So I need to creat a data source to load this info object with this data. Now I am not clear what kind of data source I need to create..??
    Thanks in advance.

  • Selecting data from two different tables.

    Do we need to use join two tables with primary/foreign key while trying to use select statement for getting data from those to table.? If no who can i go about do it.

    872959 wrote:
    If i am using From clause to get data from two different tables, is it necessary that both tables have column of identical data in them.In general, they ought to (or you need to join in a third table that tells you how to map rows from one table to rows of the other table).
    It is not strictly necessary that there be any join condition between tables. If you don't provide a join condition, Oracle has to do a Cartesian product. That means that if there are n rows in one table and m rows in the other, the result set will have n * m rows. It is very rarely a good idea to write queries that do Cartesian products but it does occasionally happen.
    Justin

Maybe you are looking for

  • Problem with vCalendar in CFMail tag

    I've created an Outlook meeting invitation using cfmail and vCalendar and it works under normal conditions. But I have an event that is a three-day class. I attempt to create three invitations within the same cfm file, using three diffeent cfmail tag

  • Prevent portal page from open automatic

    Hi there, i got this issue: A portal page opening an external fullscreen window and defined as first entry point in second level navigation, should not be openend automatically when clicking on the corresponding top-level navigation entry.      It sh

  • UNABLE TO BROWSE INTERNET

    DEAR FRIENDS, WOULD U PLZ HELP ME !!! IF I CLICK ON BROWSER it is showing " ur device does not currently have any browser configuration service book entries"contact  service provider to enable the browser on ur device" I told airtel customer care but

  • Coldfusion 9 CFTransaction/CFQuery Timeouts

    I have a script that is pulling in data from an excel document using cfspreedsheet, performing data checks, and inserting the data into the appropriate tables. Each XLS document only has about 1000 records. The scripts are wrapped in a CFTransaction

  • Pls suggest me to improve the perfomance

    Hi all, Pls Suggest me to improve the perfomace of the following query problem : I have a table say cusotmer that contain hierarchy relation customer_id parent_id 1 2 2 3 3 if i input customer_id =1 then i should get all the hierarchy like 2,3, solut