Need to find the last day of the previous month

hi folks,
the code goes like this...
data: xt247 type t247,
      monthn(30) type c,
      monthnumber type i,
      bforwardmonth type i.
call function 'RP_LAST_DAY_OF_MONTHS'
  EXPORTING
    day_in            = s_date
  IMPORTING
    last_day_of_month = e_date.
write: 'The last day of the month', e_date.
select single * from t247 into xt247
        where spras = sy-langu
          and mnr = e_date+4(2).
monthnumber = xt247-mnr.
write:' The month number', monthnumber.
determine the previous month.
bforwardmonth = monthnumber - 1.
From here I need to determine the last day of the previous month How can I do?
Thanks for your help.
Santhosh

Hi all,
here's the shortest solution:
REPORT z123.
PARAMETERS p_datum LIKE sy-datum DEFAULT sy-datum.
DATA ultimo  LIKE sy-datum.
<b>ultimo = p_datum - p_datum+6(2).</b>
WRITE: / p_datum, 20 ultimo COLOR 2.
it's not my solution :
it's from <a href="http://www.abapforum.com/forum/viewtopic.php?t=1434&highlight=ultimo">Andrew_</a>
regards Andreas

Similar Messages

  • How to get Last Day of a Previous Month

    Hi all,
    I need to get Last Day of the Previous Month. I am able to get Current Month Last Day using Calendar.getActualMaximum(Calendar.DATE)
    But I need previous Month's Last Day.
    Thanks
    Vamshi.

    Thanks all....
    I have been trying the same and could get it.....
    here is the code for that....
    SimpleDateFormat simpleDate = new SimpleDateFormat("MM/dd/yyyy");
    Calendar calendar = Calendar.getInstance();
    month = calendar.get(Calendar.MONTH);
    //year = calendar.get(Calendar.YEAR);
    calendar.set(Calendar.MONTH, month-1);
    calendar.set(Calendar.DATE, calendar.getActualMaximum(Calendar.DATE));
    //lastDayOfMonth = calendar.getActualMaximum(Calendar.DATE);
    System.out.Println("Previous Month End Date is :: " + simpleDate.format(calendar.getTime()));
    this works....
    thanks for ur replys....

  • How to get the last day of the previous month

    Hello Team,
    If  my input date is today , then i need to find out the last day of the previous month for the same.
    Can someone help me  to find out .. how can this be done.
    Regards,
    Ravi

    Hi,
    Try the below code.
         // get a calendar object
        GregorianCalendar calendar = new GregorianCalendar();
        // convert the year and month to integers
        int yearInt = Integer.parseInt(year);
        int monthInt = Integer.parseInt(month);
         int dayInt = Integer.parseInt(day);
        // adjust the month for a zero based index
        monthInt = monthInt - 1;
        // set the date of the calendar to the date provided
        calendar.set(yearInt, monthInt, dayInt);
        int day = calendar.getActualMaximum(GregorianCalendar.DAY_OF_MONTH);
        return Integer.toString(day);
    Regards
    Venkat

  • Need help finding the right codec to play QT files

    Like many others who have posted, all the quicktime files on my drive have turned to black. Previously when I opened the file, I saw picture and sound. Now every single file has only audio, but the picture is black.
    I am operation on Mac O.S. 10.4.11. I am using Quicktime Pro 7.5. I have been trying to fix this problem for a month now. Many people have suggested I need to find the right codec, but so far I have not found it. I have tried: A52codec.component, AC3codec, MacOS 8.x, 9.1.x, Apple Intermediate Codec.com, Apple MPEG2.codec.component, Avilmporter-r7.component, DivX Decoder.component, DivX Encoder.component, DivX Pro 6.8.0.19 + keymaker, EnsharpEncoderMacOsX.cmg, Fbx 20091quicktime_macemu.pkg.tar, Fbx QT.pkg, Flipsformac, WMV Advanced.component, Flipsformac WMV Advanced Exports.component, Flipsformac WMV Import.component, IMXCodec.component, LAAME Universal Installer.mpkg, LAAMEncoder.component, QSSP_2.1.dmg, QSXEssentials.component, QSXEssentials.dmg, QTFvx.component, Red Quicktime Codec v3.1.pkg, Red Code iedcod.qt.component, Spectrograph.component, TSCC.component xiphqt.component, XviD_codec-r58.component, XviDELEGATE.component
    Nothing worked!
    I also tried to install Perian. This did not work.
    What should I do? Should I re-install my operating system and start over? About a month ago, all the video clips played just fine. Is there any solution?
    Thanks

    Hi Wangerer!
    I haven't even heard of half of those! You may have reached overkill on codecs!
    Get rid of some of them and read this:
    These are the downloads and the settings you need in order to view/hear pretty much everything that the net can throw at you: The setup described below has proved repeatedly successful on both PPC and Intel macs, but nothing in life carries a guarantee!
    It is known to work in the great majority of cases with Safari 3.0.4, 3.1, 3.1.1, QT 7.3, 7.4.x and 7.5 and OS 10.4.11.
    Assuming you already run Tiger versions OS 10.4.11 and have Quicktime 7.4 or above, and are using Safari 2 or 3, download and install (or re-install even if you already had them) the latest versions, suitable for your flavor of Mac, of:
    RealPlayer 11 (which is no longer in beta) for Mac from:
    http://www.versiontracker.com/dyn/moreinfo/macosx/15540
    Flip4Mac WMV Player from http://www.microsoft.com/windows/windowsmedia/player/wmcomponents.mspx (Windows Media Player for the Mac is no longer supported, even by Microsoft)
    Perian from http://perian.org/
    You should read this support page http://perian.org/#support in case you need to delete older codecs.
    Adobe FlashPlayer should first be uninstalled using the appropriate uninstaller available here:
    http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14157&sliceId=2
    and then the latest version obtained from here:
    http://www.adobe.com/shockwave/download/download.cgi?P1ProdVersion=ShockwaveFlash
    and installed.
    (You can check here: http://www.adobe.com/products/flash/about/ to see which version you should install for your Mac and OS, but please see my footnote if you are running Leopard.)
    In earlier versions than QT 7.1.3 in Quicktime Preferences, under advanced, UNcheck Enable Flash, and under Mime settings/Miscellananeous only check Quicktime HTML (QHTM).
    You should also ensure, if you are running Tiger 10.4.11, that you have downloaded and installed all the correct version for your Mac of Security Updates up to and including 2008-004. (N.B. Security Updates require both a restart and a permission repair.)
    In Macintosh HD/Library/Quicktime/ delete any files relating to DivX (Perian already has them). However it should be noted that Perian is not an internet plugin and will not play DivX files imbedded on a website. For that you will need the DivX Player browser plugin available from http://www.divx.com/divx/mac/
    Now go to Safari Preferences/Security, and tick the boxes under Web Content (all 4 of them) to enable Java.
    Lastly open Audio Midi Setup (which you will find in the Utilities Folder of your Applications Folder) and click on Audio Devices. Make sure that both Audio Input and Audio Output, under Format, are set to 44100 Hz, and that you have selected 'Built in Audio'.
    Important: Now repair permissions and restart.
    You should also consider having the free VLC Player from http://www.videolan.org/ in your armory, as this plays almost anything that DVD Player might not.
    There is an additional 'fix' you could try if you are having problems with Flash and Quicktime, depending on which type of Mac you have:
    On Intel Macs, make sure that you are not running Safari in Rosetta. You can check this, and change it, in the Get Info window.
    On PPC Macs, go to the Hard Disk/Library/Internet Plug-Ins folder, and drag the file 'QuickTime Plugin.webplugin' to the desktop. Quit and restart Safari. If things have improved you can trash that file. If they haven't put it back, as the lack of this plug-in can cause QT content in some widgets to cease functioning.
    And now there is an additional kid on the block: SilverLight. Microsoft has created their own version of what a replacement for Flash should be. You can read more about it here:
    http://silverlight.net/
    So, if you go to any sites that have been designed for this new Silverlight stuff, you can download the plug-in from here (but make certain that you are downloading SilverLight v.1.0 for OS X (10.4.8 upwards):
    http://silverlight.net/GetStarted/
    FOOTNOTE
    If you are running Leopard:
    Some users have mentioned that the latest Flash Player (v.9.0.115.0) conflicts with Leopard, and that they have needed to revert to v. 9.0.47. This can be downloaded from here:
    http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14266&sliceId=1

  • Help find the Last run date from previous month

    Hi all
    I am stuck trying to find the Last Run Date from the previous month.
    select distinct(date_ran) from TABLE X where date_ran like '%/11-%' order by date_ran desc gives
    "03/30/11-06:19
    "03/25/11-03:01
    "03/24/11-03:00
    "03/23/11-03:00
    "03/22/11-03:00
    "03/21/11-03:00
    "03/18/11-03:00
    "03/17/11-00:00
    "03/16/11-06:31
    "02/15/11-07:42
    "02/15/11-06:00
    "02/14/11-08:19
    Here the result I am trying to acheive is 02/15/11-07:42 ;Note the column date_ran is a VARCHAR2(255) and not a TIMESTAMP
    I tried
    select ADD_MONTHS(to_date(max(date_ran), 'MM/DD/YYYY-HH24:MI'),-1)
    from daily_tests_a
    where date_ran like '%/11-%'
    order by date_ran desc
    which returns 2/28/0011 6:19:00 AM and that is not the result I am looking for
    Regards
    SMK

    Welcome to the forum!
    user2931503 wrote:
    Hi all
    I am stuck trying to find the Last Run Date from the previous month.
    select distinct(date_ran) from TABLE X where date_ran like '%/11-%' order by date_ran desc gives
    "03/30/11-06:19
    "03/25/11-03:01
    "03/24/11-03:00
    "03/23/11-03:00
    "03/22/11-03:00
    "03/21/11-03:00
    "03/18/11-03:00
    "03/17/11-00:00
    "03/16/11-06:31
    "02/15/11-07:42
    "02/15/11-06:00
    "02/14/11-08:19
    Here the result I am trying to acheive is 02/15/11-07:42 ;Note the column date_ran is a VARCHAR2(255) and not a TIMESTAMPThat's a very bad idea. Points in time should always be stored in DATE (or maybe TIMESTAMP) columns. If not, you're going to waste resources converting them to DATEs whenever you need them to behave like DATEs, and risk run-time errors because of bad data.
    Normally, the "previous" month means the month before the current month. In April, the previous month is March.
    By "previous" month, do you mean the 2nd latest month in the table? That is, this data contains data from February and March, 2011; March 2011 is the latest of those months, February 2011 is the next-to-last, and so is that why you want a date from February?
    I tried
    select ADD_MONTHS(to_date(max(date_ran), 'MM/DD/YYYY-HH24:MI'),-1)
    from daily_tests_a
    where date_ran like '%/11-%'
    order by date_ran desc
    which returns 2/28/0011 6:19:00 AM and that is not the result I am looking for
    Regards
    SMKTry this:
    WITH   got_real_date   AS
         SELECT     TO_DATE ( SUBSTR (date_ran, 1, 14)
                   , 'MM/DD/RR-HH24:MI'
                   )     AS real_date
         FROM     table_x
    --     WHERE     ...     -- If you need any filtering, put it here
    SELECT     TO_CHAR ( MAX (real_date)
              , 'MM/DD/RR-HH24:MI'
              )     AS last_date
    FROM    got_month_num
    WHERE     real_date     < (
                               SELECT  TRUNC (MAX (real_date), 'MONTH')
                         FROM    got_real_date
    ;Edited by: Frank Kulash on Apr 5, 2011 3:59 PM

  • I NEED TO FIND THE PURCHASE ORDER NO.

    HAI ALL,
         I NEED TO FIND THE PURCHASE ORDER NO.
    I have MATNR (material no.), LIFNR (vendor no.), RDOC OR MBLNR (material doc.no). values of these in my internal table. Using this i need to find purchase order no. I HAVE TRIED WITH MSEG TABLE ,but purchase order no. is not stored there.
    PL. tell me TABLE NAME OR HOW TO JOIN THA TABLES OR ANY VIEWS to find purchase order no.
    If u need any clarification regarding my req. pl send mail to below address.
    [email protected]
    THANKS IN ADVANCE,
    SENTHIL KUMAR

    HAI,
        THANKS FOR UR REPLY.
    I am using 541 movement type, (which is used for subcontracting)
    my req. is for 541 movement type in which table purchse order no. and mblnr(material doc. no.) are stored.
    Thanks in advance
    senthil kumar

  • Need to find the Difference between two table

    Hello ,
    I have stucked in program as below scenario:-
    I have two tables of huge data of same structure in a same schema.I need to find the difference exact values in tables.
    By using MINUS we can find the difference between two table ,i need to find the what exact difference in the there values with colunm and value at that column.
    Example TableA
    Col1 col2 col3 col4 col5.... col50
    10 ABC 2001 EE 444 TT
    40 XYZ 3002 RR 445 TT3
    80 DEF 6005 YY 446 YY8
    TableB
    Col1 col2 col3 col4 col5.... col50
    10 ABC 2001 EE 444 TT
    40 XYZ 3002 RR 445 TT3
    81 DEF 6005 Yu 447 YY8
    I need to the out put like this :-
    The Diffence between two table is
    TableA.COL1=80 TableB.Col1=81, Different
    TableA.Col4=YY TableB.col4=Yu,Different
    TableA.Col5=446TableB.col5=447,Different
    Please suggest me to write the pl/sql program for the same
    thanx in advance
    KK

    Thanx friends for all your efforts
    I have a sample code for the same,this will compare the two tables for single row in each table .
    what r the modification needed for the multiple rows of values in the two tables??
    Please suggest!!
    CREATE OR REPLACE PROCEDURE test_compare
    IS
    TYPE t_col
    IS
    TABLE OF VARCHAR2 (30)
    INDEX BY PLS_INTEGER;
    l_col t_col;
    j NUMBER := 0;
    l_sql VARCHAR2 (2000);
    col1 VARCHAR2 (30);
    col2 VARCHAR2 (30);
    val1 NUMBER;
    val2 NUMBER;
    status VARCHAR2 (30);
    CURSOR c1
    IS
    SELECT column_id, column_name
    FROM all_tab_columns
    WHERE table_name = 'TEST1';
    BEGIN
    FOR i IN c1
    LOOP
    j := j + 1;
    l_col (j) := i.column_name;
    END LOOP;
    FOR k IN 1 .. j
    LOOP
    l_sql :=
    'SELECT '
    || ''''
    || l_col (k)
    || ''''
    || ', '
    || 'TEST2.'
    || l_col (k)
    || ', '
    || ''''
    || l_col (k)
    || ''''
    || ', '
    || 'TEST1.'
    || l_col (k )
    || ', '
    || 'DECODE(TEST2.'
    || l_col (k)
    || ' -TEST1.'
    || l_col (k)
    || ', 0, ''NO CHANGE'', ''CHANGED'') FROM TEST2, TEST1';
    EXECUTE IMMEDIATE l_sql INTO col1, val1,col2, val2, status;
    IF status = 'CHANGED'
    THEN
    DBMS_OUTPUT.put_line( 'TEST2.'
    || col1
    || '='
    || val1
    || ', TEST1.'
    || col2
    || '='
    || val2
    || ', '
    || status);
    END IF;
    END LOOP;
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line ('Error:- ' || SQLERRM);
    END;
    /

  • Need to find the assets associated to a BCC project using SQL query

    Hi,
    Given a BCC project (project_id), I need to find the assets (type of asset, version, status etc) in that project using SQL queries.
    I need this for reporting purpose and cannot do this programatically using any code.
    Surprisingly ATG does not store this association in a direct way. Can someone provide me the query if you have already done this before?
    I tried enabling loggingDebug in PublishingRepository and VersionManagerRepository to get the queries, but I did not get what I want.
    Thanks in advance,
    Gopinath Ramasamy

    UPDATE:
    When a project is selected in BCC, ATG is doing something crazy, as it appears to me, of querying all the tables (ofcourse when there is a cache miss) in all the versioned item descriptor with the workspace id of the project to display the assets contained in it.
    I do not see an easy or direct way of coming up with a query for this requirement.
    Please let me know if anyone has any other idea.
    Thanks,
    Gopinath Ramasamy

  • Need to find the SID of a forms session.

    Hi,
    I need to find the SID of a form session. How to find the same.
    Eg:- If a user connected to our EBS system, Then automatically one sid will be generated to that user. I need to find the SID for this user. If given detailed steps it would be great help.
    Regards
    SR.

    Hello,
    Although I am a bit unclear about the question. But please see if the following helps;
    I can query the v$session to know about the SID. Here is a simple example;
    select  sid,
    substr(username,1,15) "DB UserName",
    substr(osuser,1,15) "OS UserName",
    substr(command,1,3) CMD,
    substr(machine,1,10) Machine,
    terminal, process, status,
    substr(program,1,50) "OS Program Name"
    from v$session
    where type = 'USER'
    order by usernameHere is a sample output;
                SID DB UserName     OS UserName     CMD MACHINE    TERMINAL         PROCESS      STATUS   OS Program Name
                  7                 SYSTEM          0   ORAAPPPROD ORAAPPPROD       976          ACTIVE   ORACLE.EXE
                  8                 SYSTEM          0   ORAAPPPROD ORAAPPPROD       3548         ACTIVE   ORACLE.EXE
    Additionally you can also review Oracle Metalink Script: How To Identify The apps User Using The O/S PID For Forms Users In 11i Doc ID: Note:185762.1.
    https://metalink.oracle.com/metalink/plsql/f?p=130:14:38346007578631471::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,185762.1,1,1,1,helvetica
    Hope it helps. Maybe others might add in this.
    Adith

  • Hello , I need to find the serial number of my programs . Would anyone know where and how to do it? The programs are installed on PC Thank you

    Hello , I need to find the serial number of my programs .
    Would anyone know where and how to do it?
    The programs are installed on PC
    Thank you

    Find your serial number quickly

  • HT4910 I need to find the file location for my iCal in iCloud

    I need to find the file location for my iCal in iCloud for my Mac. I inadvertently changed the file location in Terminal and need to restore the proper location but do not know how to locate that information. Any help is much appreciated,

    You should find "Preferences" in your Edit menu in iTunes.

  • Need to find the free space on storage server

    Hi,
    I need to find the free space on storage server through Java code, and even find whether web server has access to the storage server.
    So please tell me how do i do that.

    This will be through an API for your "storage
    server". It would be helpful if you at least
    indicated what this "storage server" is: a NFS? an
    FTP site? something else?I forgot to mention that. Its NFS. Please let me know
    clearly, what APIs I need to use and in simple how.How am I supposed to clearly know this?
    Consult the documentation for your NFS system and figure it out. That's what to do.

  • BW3.5 : Busness content == Need to find the source cube from an web item

    Hi,
      While executing( preview) an iview  of the predelivered CRM business package( com.sap.pct.crm.slsAnalyt.spa.Customer iview for Sales manager), in Enterprise Portal, I get an error " Error loading template 0TPL_0CRM_SM_CUSTOMER".
      I can see this perticular web template in BW and when trying to activate this by tranferring into the content windows it brought thousands of other objects( even when I selected 'Only necessary object'). I am not sure whether I should go ahead with the activation.
      I would like to know what is the relationship between a cube and a web template and how to findout the related cube from the template?
      Also is it possible to activate only certain webtemplates only for queries of a perticular cube?
      Thanks
    Arunava

    Thanks Dinesh,
    \ BW3.5 : Busness content ==>Need to find the source cube from an web item
    Posted: Nov 2, 2005 10:00 PM        Reply      E-mail this post 
    Thanks Dinesh
    I would still like to know the relationship between a cube and a web template and how to find out the related cube( or query etc) from the template?
    Please let me know,
    Thanks
    Arunava

  • HT3819 I have turned two computers on to home sharing. I am now on this computer wanting to put my music on to this itunes and i know i need to find the other computer in the drop down menu from " Home Sharing " but that menu isnt there on the left?

    I have turned two computers on to home sharing. I am now on this computer wanting to put my music on to this itunes and i know i need to find the other computer in the drop down menu from " Home Sharing " but that menu isnt there on the left?

    If you have the horizontal menu bar showing (File, Edit, View,...), select View, then select Show Sidebar. 
    If the menu bar is not showing, dorp down the menu in the very upper left corner and select show menu bar, then follow steps above.
    Hope that helps.  Good luck.

  • I need to find the download for ACR 7.3 to use my nikon d600 raw files. i have cs5 running on macboo

    i need to find the download for ACR 7.3 to use my nikon d600 raw files. i have cs5 running on macbook pro with mountain lion OS.

    Hi,
    Unfortunatly the 7.x series of camera raw plugin is not compatible with photoshop cs5.
    You could download the 7.4 DNG Converter and convert your d600 files to dng copies which then photoshop cs5 will open.
    http://www.adobe.com/support/downloads/detail.jsp?ftpID=5568

Maybe you are looking for

  • Reg creating Catalog Views through R/3

    Hi Guys, I am working on an internet sales application with backend as SAP R/3 ECC 6.0. We are not supposed to use CRM. Can someone tell me how to create them? I have to create Catalog Views. I tried to acess the SAP Note 998453 and 998458, but i am

  • Why do placed images in illustrator print a different shade of black than the black in the document?

    It has happened to me more than a few times. For example, I'll place artwork that was created in photoshop into an illustrator document, and the blacks are inconsistent. Any advice?

  • Sound in a simple Equalizer

    Hey there, A couple of moths ago, I made this Swing app that demonstrates an equalizer. Here is how it looks : http://i250.photobucket.com/albums/gg244/varsamakos/screenshot_002-5.png Now, I want it to be more practical. Ι want it to handle real soun

  • YouTube Widget

    I have just been updated with the latest version of Muse CC and can confirm that the YouTube widget does not work but the Vimeo widget does. With the YouTube widget you simply get the logo and no controls and it will not connect to the video when you

  • Mass generation of activities (for field force) from Trade Promotion

    Hi gurus, is it possible to mass generate activities from Trade Promotions? I've done it several times using campaigns but i don't know if it's possible from Trade Promo. The business scenario is the following: The Sales manager define some extradisp