Skip to Content

date ranges(5 months)

Hi all...

Iam having one date field in the selection screen....

so when i excuted the program i have to get exact five months back date as low range and current date as high range...

thank you,

Naveen

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 28, 2008 at 12:18 PM

    Hi,

    do like this.

    select-options:s_date for sy-datum.
    data:past_date type sy-datum.
    
    initialization.
    s_date-high = sy-datum.
    past_date = sy-datum.
    past_date+4(2) = past_date+4(2) - 5.
    IF past_date+4(2) <= 0.
      past_date(4) = past_date(4) - 1.
      past_date+4(2) = 12 - ( 5 - sy-datum+4(2) ).
    ENDIF.
    s_date-low = past_date.
    append s_date.
    

    rgds,

    bharat.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 28, 2008 at 12:15 PM

    Hi,

    1.Call this Function module in Initialization.

    2.You can use the function module 'SALP_CALC_DATE'.

    Pass 'M' to IN_RECTYPE, '-5' to IN_NBR_DWXMQY and current date to IN_DATE import parameters of the function module.

    Regards,

    Shiva kumar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 28, 2008 at 12:25 PM

    Hi Naveen

    try the following

    data : bk_date type sy-datum.

    select-options: so_date for sy-datum.

    INITIALIZATION.

    call function 'CCM_GO_BACK_MONTHS'

    exporting

    currdate = sy-datum

    backmonths = 5

    importing

    newdate = bk_date.

    .

    clear so_date.

    so_date-sign = 'I'.

    so_date-option = 'BT'.

    so_date-low = bk_date.

    so_date-high = sy-datum.

    append so_date.

    reward if useful.

    Regards

    Prabumanoharan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 28, 2008 at 12:12 PM

    you mean you want to display the dates on selection screen

    itself?

    then you can query in

    At selection screen output

    something like

    select date from table where s_low = sy-datum-

    i guess this is what you want ?

    Hope it helps else if you clear a little bit more

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 28, 2008 at 12:13 PM

    hi naveen,

    use this code

    CALL FUNCTION 'CCM_GO_BACK_MONTHS'
      EXPORTING
        currdate         = v_today
        backmonths       = 5
      IMPORTING
        NEWDATE          = v_mback.
    

    regards,

    Peter

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 28, 2008 at 12:24 PM

    Hi

    You can make use of the code below :

    
    Ranges : gr_date for bsis-budat.
    
    data : gv_datum like sy-datum.
    
      CALL FUNCTION 'CCM_GO_BACK_MONTHS'
        EXPORTING
          currdate   = sy-datum
          backmonths = '5'
        IMPORTING
          newdate    = gv_datum.
    
    gr_date-sign = 'I'.
    gr_date-option = 'BT'.
    gr_date-low = gv_datum.
    gr_date-high = sy-datum.
    append gr_date.
    

    Thanks,

    Sriram Ponna.

    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.