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

Regarding Parameter statement in selection screen

Hi All,

Pls provide me the logic for the below requirement.

The requirement is that in the selection screen if i give the input as 6months in paramenter option field,the employee data for the last six months sud be fetched in the report.And if i give 2 months ..the last 2months employee data sud be fetched by the report.

Pls help me how to proceed further.

Thanks,

Chakradhar.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Posted on Nov 22, 2007 at 07:17 AM

    Hi,

    calculate last 2 months date or six months date using SY-DATUM.

    and in where condition of select query give greater than that calculate and

    less than of todays date

    Regards,

    Prashant

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 22, 2007 at 07:17 AM

    do the following steps.

    parameters p_date type sy-datum.

    at selection-screen on value request p_date.

    select into coresspondig field of table itab where date =p_date.

    pass internal table that funcation module.

    • Call F4 popup

    CALL FUNCTION 'F4IF_START_VALUE_REQUEST'

    EXPORTING

    shlp = l_shlp

    disponly = display_only

    IMPORTING

    rc = l_subrc

    TABLES

    return_values = l_return_tab

    EXCEPTIONS

    OTHERS = 0.

    IF sy-subrc = 0 AND l_subrc = 0.

    • Value selected

    READ TABLE l_return_tab INDEX 1 INTO l_return_wa.

    item_selected = l_return_wa-fieldval.

    ELSE.

    • Popup canceled / no value selected

    RAISE popup_canceled

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 22, 2007 at 07:18 AM

    Hi,

    Directly specify it in the where condition of the select query.

    select empdata from table into itab where date = p_date.

    Reward if helpful..

    Regards,

    Nagaraj

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 22, 2007 at 07:19 AM

    hi

    Hi,

    Use the below function module

    RP_CALC_DATE_IN_INTERVAL

    you can give '-'(minus) for previous date or '+'(plus) for future date

    for the SIGNUM field

    example

    DATA V_DATE TYPE SY-DATUM.

    CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'

    EXPORTING

    DATE = SY-DATUM

    DAYS = 0

    MONTHS = '06'

    SIGNUM = '-'

    YEARS = 0

    IMPORTING

    CALC_DATE = V_DATE.

    write:/ v_date

    try with the above code.

    reward points if that is useful.

    regards

    karthik

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 22, 2007 at 07:25 AM

    Hi you can do like this,

    parameters: months(3) type n.

    data: from_date type sy-datum.

    CALL FUNCTION 'CCM_GO_BACK_MONTHS'

    EXPORTING

    currdate = sy-datum

    backmonths = months

    IMPORTING

    NEWDATE = from_date.

    write:/ from_date, sy-datum,

    / months.

    • now select query with these two dates.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 22, 2007 at 07:28 AM

    Use logic like this..

    data:

    begin of t_pernr occurs 0,

    pernr type pa0001-pernr,

    end of t_pernr.

    parameters:

    p_period type i.

    data:

    w_date type pa0001-begda,

    w_temp type i.

    start-of-selection.

    if p_period lt 1

    or p_period gt 12.

    message 'Period must be between 1 and 12' type 'I'.

    exit.

    endif.

    w_date = sy-datum.

    w_date+6(2) = '01'.

    if w_date+4(2) gt p_period.

    w_date4(2) = w_date4(2) - p_period.

    else.

    w_temp = w_date+4(2) - p_period.

    w_temp = 12 + w_temp.

    w_date0(4) = w_date0(4) - 1.

    w_date+4(2) = w_temp.

    endif.

    select pernr

    from pa0001

    into table t_pernr

    where begda ge w_date.

    if sy-subrc eq 0.

    endif.

    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.