Skip to Content
author's profile photo Former Member
Former Member

FM for First and Last Day_Current Month

Hello All,

Inorder to update the TVARV table, two new variables were needed which will get the First and Last Day of current month.

One FM i was able to find was BKK_GET_MONTH_LASTDAY which takes the Todays date and outputs the Last date of the month. IS there any FM for FIRSTDAY Current month....

Regs,

-PSK

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 27, 2005 at 06:54 AM

    Hi,

    For the first day, you can use a simple logic:

    DATA first_day TYPE d.
    first_day = sy-datum.
    first_day+6 = '01'.
    

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      I think there may be another way to solve this:

      When you save your variant you mark the checkbox SELECTION VARIABLE for your date-variables and press the

      button SELECTION VARIABLE.

      Now you mark the traffic-light (so it is in 6.20) of the

      column D (Dynamic date calculation) so it change from yellow to green. Pressing F4 you get a reselection of SAP-defined variables which calculate e. g. the first or the last day of current month.

      regards

      Olaf

  • author's profile photo Former Member
    Former Member
    Posted on Jan 27, 2005 at 05:48 AM

    Hi Sravan,

    Following help may help you.

    FM - BUILD_PERIOD_TABLE

    code is mentioned below.

    data: it_cperiod type table of range_prds with header line,

    define one variable as range like -

    ranges: r_cperiod for sy-datum,

    CALL FUNCTION 'BUILD_PERIOD_TABLE'

    EXPORTING

    YEAR = <current year>

    TABLES

    PERIOD_TABLE = it_cperiod.

    read table it_cperiod with key per_id = <current month>

    refresh r_cperiod.

    r_cperiod-sign = 'I'.

    r_cperiod-option = 'BT'.

    r_cperiod-low = it_cperiod-begda.

    r_cperiod-high = it_cperiod-endda.

    append r_cperiod.

    Now, you can see begin and end of moth in r_cperiod.

    Regards,

    Parag

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 27, 2005 at 10:36 AM

    Try to use FM END_TIME_DETERMINE.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.