How to get last week of the month from a month

Hello,
I want to get last week of the month from a month. For example: If Input = April then Output = Week17. Is there any function module? Or what should be the logic inorder to meet such requirement?
Thanks in advance for your answers.
Nitin.

Hi,
Just cpoy and past this program, and see the result and apply for you requirements.
Data: ZSCDATUM TYPE SCDATUM,
      ZKWEEK TYPE KWEEK,
      ZDAY TYPE SY-DATUM,
      ZLDAY TYPE SY-DATUM,
      ZWK(3) TYPE N,
      ZM(2) TYPE N.
      ZDAY = SY-DATUM.
      ZM = ZDAY+4(2).
      CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
        EXPORTING
          day_in                  = ZDAY
        IMPORTING
         LAST_DAY_OF_MONTH       =  ZLDAY
*       EXCEPTIONS
*         DAY_IN_NOT_VALID        = 1
*         OTHERS                  = 2
      IF sy-subrc <> 0.
*         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      ZSCDATUM = ZLDAY.
      CALL FUNCTION 'DATE_GET_WEEK'
        EXPORTING
          date               = ZSCDATUM
       IMPORTING
         WEEK               = ZKWEEK
*       EXCEPTIONS
*         DATE_INVALID       = 1
*         OTHERS             = 2
      IF sy-subrc <> 0.
*         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      ZWK = ZKWEEK+4(2).
      WRITE: ZKWEEK.
      WRITE: ZWK.
Thanks
Reddy

Similar Messages

  • How to get last date of the week

    hi,
    how to get last date of the week like FM WEEK_GET_FIRST_DAY gives the date of the first day of the week i need the date of the last day of the week..
    thnx

    data : p_week type KWEEK,
    p_Date type SYDATUM.
    p_week = <incoming value in week of year>
    CALL FUNCTION 'WEEK_GET_FIRST_DAY'
    EXPORTING
    week = p_week
    IMPORTING
    DATE = p_date
    EXCEPTIONS
    WEEK_INVALID = 1
    OTHERS = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    To get the last day of the week.
    p_date = p_date + 6.
    You can find the available fm in the system from se37 transaction code.

  • How to calculate last week of the month

    i want calculate dollar on the basis of last week of the month.

    Hi prashant,
    try to filter with the required month. if this is not your question, explain little bit clear..so, that some one will help you if they have the solution with.
    or do you want to create a variable and then filter prompts...
    cheers...
    Edited by: ManiEswar on 24-Jan-2011 12:59

  • How to get last day of the year

    Hi All ,
    Thanks in advance ...
    How will I get the last day of the year as I am passing date at run time .
    I can manage to get first day of year by
    SELECT TRUNC(SYSDATE,'YEAR') AS FDAY_YEAR
    from dual
    Thanks in advance
    Regards
    Sachin

      1*  select ADD_MONTHS(trunc(sysdate,'yyyy'),12)-1 dd from dual
    SQL> /
    DD
    31-DEC-2010

  • How to get  --Last date of the Last value .

    Dear All,
    I have a report like
    Material – Country – Current Price
    1112-----  Singapore  -
      100
    1112-----  Japan  -
      120
    1112-----  Malesia   -
      99
    Here current price is Last Value of the particular Material on particular Date.
    This I can get based on Key figure Aggregation ( Last Value and reference Character 0CALDAY ), It is giving the last Value of the Particular Material.
    Now my user wants to see Last date of the value ( Date of the Value )
    Example :-
    Material – Country –  Date --Current Price
    1112-----  Singapore  -
    01/04/2008 -- 100
    1112-----  Japan  -
    04/05/2008 -- 120
    1112-----  Malesia   -
    05/05/2008 -- 99
    If  I drill down the date in my  report  it is showing all dates , my user wants to see only last date .
    Hope some one has solved this issue , please help me to solve this issue.
    Regards,
    SHAIK.

    I have created a keyfigure with date as a data type.
    In aggregation tab, I selected  aggregation Maximum.
    Upto DSO, data is Loaded perfect. Ok.
    I added the same key figure in cube , When I am trying to Activate the Transformation,
    It is giving Error message.
    Rule 17 is invalid and is being deleted. The reason for this is that a field or InfoObject that is used in rule 17 has been deleted in the source or target of the transformation ODSO ZPL_DSO1 -> CUBE ZPLATT_C (0GH6MHANQ2J79LXZBLGIJ9ZK9LWHK6RS)
    Plz Advice.
    Regards,
    SHAIK
    Edited by: shaik on May 7, 2008 5:46 PM

  • Get first week of the month

    Hi,
    how to get first week of the month from the query
    i tried this but not gwtting
    SELECT TO_CHAR('09/30/2007','W') FROM DUAL
    thanks
    Edited by: 896398 on Jan 18, 2012 3:17 AM

    896398 wrote:
    how to get first week of the monthAssuming week starts Sunday:
    SELECT  GREATEST(TRUNC(TRUNC(your_date,'MM') + 1,'IW') - 1,TRUNCyour)date,'MM')) week_start_date,
            TRUNC(TRUNC(your_date,'MM') + 1,'IW') - 1 + 6) week_end_date
      FROM  dual
    / If week starts Monday:
    SELECT  GREATEST(TRUNC(TRUNC(your_date,'MM'),'IW'),TRUNCyour)date,'MM')) week_start_date,
            TRUNC(TRUNC(your_date,'MM'),'IW') + 6) week_end_date
      FROM  dual
    / SY.

  • Setting up the sender communication last week of the month

    Hi All,
    I am doing right now JDBC to RFC, now my problem is i need to featch the data in this way "daily during the last week of the fiscal month, and first few days of the following month" i need to extract the data and send it RFC as receiver.
    How can i schedule my JDBC Adaptor communication chennal..
    I have checked with Availability Time Planning  but i am not sure how i can do it.
    Could you pls give some info how can achive this.
    Thanks in advance
    Venkat

    Hi,
    the problem is that you can't trigger the JDBC Sender Adapter.
    There was already a similar discussion in this thread:
    How to trigger XI scenario from a SQLServer Database?
    Regards
    Patrick
    (Sorry it was a wrong link first)
    Edited by: Patrick Koehnen on Jan 19, 2009 12:25 PM

  • Report selecting last week of the last 12 months

    Hi,
    we're loading snapshots on a weekly basis into a cube, updating a 0calweek field from the loading date.
    The requirement for one of the reports is to have the data for the last week for each of the last 12 months, incl the current month (query filter contains calmonth restricted by variable 0CML12CM).
    For the current month, the last week available in the cube is to be selected.
    Thanks for help!
    Michel

    Add a characteristic to your cube, which shows if the week is the last week in the month. This char can be updated during data load, to either store a Y or a N.
    Then, in your query, you just get all the data where ZLASTWEEK = 'Y'
    Cheers,
    Andrew

  • Getting last day of the month

    hi ,
    is there an existing date funtion to get last day of the month ?
    pls advise
    else
    i'll try to add_month + 1 to current month and format to the first day and minus 1 day from that new month
    tks & rdgs

    last_day function
    <br>
    jeneesh

  • How to get last Build date of a dll in the real time target

    Info On My Project    
       I am working on LabWindows CVI 12.0 for development . This project is a real time application for hardware, which is having Phar Lap ETS as RTOS...  
    I am facing some problems while checking Build date of my Application file( .dll)
    I have tried to use GetFileDate API. But it is not supporting for realtime Target..
    So i have tried __DATE__ macro.. That also having some problems..
    How to get last Build date of a dll from the real time target  ??
    Please Help to solve this....
    Thanks
    Vaishakh A  K

    Please reply if any one have suggestion...

  • HT1766 I recently replaced my iphone and took 6 weeks of new pictures, I plugged it to my computer and by accident I restored the back from 4 months ago and erased my new pictures. How can I recover the new pictures ?? Help!!

    I recently replaced my iphone and took 6 weeks of new pictures, I plugged it to my computer and by accident I restored the back from 4 months ago and erased my new pictures. How can I recover the new pictures ?? Help!!

    Sorry those pics might be gone, since you restored from your backup.
    Only way possible if by some possibility you were able to backup your current data to itunes, then you can restore from that backup.
    Open itunes - edit - preference - devices - backup - see if there is an up to date backup.
    If you don't have one then sorry those pics are gone.

  • I set iCloud up last week and the next day when out in the field I could not get Outlook to open up.  I want to change my settings so I can get mail at home or in the field

    I set iCloud up last week and the next day when out in the field I could not get Outlook to open up.  I want to change my settings so I can get mail at home or in the field, not just when i'm at home.  I have a PC and fios internet with Verizon at home.  I have a Sprint air card in the field or access an available wifi.  I want to change my settings to allow for receiving email in the field.  What's the point of an air card and icloud for backup fi it doesn't work in the field for some odd reason?

    Apple - Support - Mail Setup Assistant

  • 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 do I retrieve a older backup on itunes that I saved last week in the PC. Currently, it shows the latest backup was yesterday, but I need the backup I saved on 18.10.13. Can anyone help?

    How do I retrieve a older backup on itunes that I saved last week in the PC. Currently, it shows the latest backup was yesterday, but I need the backup I saved on 18.10.13. Can anyone help?

    It keeps only the last backup.

  • Good evening Messrs. Apple Buy this product an 5S on 02/13/2014 by amazon iphone, computer during this time I worked perfect, came last week when the new ios 8.2 software perform the download via OTA and when I get the notification to download, press

    Good evening Messrs. Apple
    Buy this product an 5S on 02/13/2014 by amazon iphone, computer during this time I worked perfect, came last week when the new ios 8.2 software perform the download via OTA and when I get the notification to download, press the same and my team since then no more answered, apple screen with the download bar appears but never start downloading but within seconds appeared blue screen and then black, try to Reproduce recommendations restore through itunes and I throw the error No. 9.
    Desperate to bring it to a technical service here in my country and according to them is not nor flex battery charging, and recommended me to come to pc for warranty issues.
    Messrs apple, I appreciate all your support since my investment was $ 826.69 and you are a well known and highly regarded worldwide so I appreciate you can give me options to resolve my situation marks

    Bonjour
    Mise à jour du logiciel iOS de votre iPhone, iPad et iPod touch - Assistance Apple
    Mise à jour de votre appareil avec iTunes
    Si la mise à jour via une connexion sans fil échoue, ou si vous souhaitez l’effectuer à l’aide d’iTunes, procédez comme suit :
    Installez la dernière version d’iTunes sur votre ordinateur.
    Connectez votre appareil à l’ordinateur.
    Dans iTunes, sélectionnez votre appareil.
    Dans la sous-fenêtre Résumé, cliquez sur Rechercher les mises à jour.
    Cliquez sur Télécharger et mettre à jour.
    Si vous ne disposez pas de suffisamment d’espace libre pour effectuer la mise à jour à l’aide d’iTunes, vous devez supprimer manuellement du contenu de votre appareil.
    Découvrez la marche à suivre si vous recevez des messages d’erreur lors de la mise à jour de votre appareil.
    Dernière modification: 11 févr. 2015

Maybe you are looking for