Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to use this function modules

Former Member
0 Kudos

Read Function modules FIRST_DAY_IN_PERIOD_GET and LAST_DAY_IN_PERIOD_GET to ge the first and last dates of the periods entered on the selection screen. Here Year = First 4 characters and Period = Next two characters of YearPeriod field of the selection screen.

4 REPLIES 4

Former Member
0 Kudos

Hi,

find below the sample code

call function 'FIRST_DAY_IN_PERIOD_GET'

EXPORTING

i_gjahr = p_year

i_periv = 'CY'

i_poper = p_month

IMPORTING

e_date = s_date-low.

call function 'LAST_DAY_IN_PERIOD_GET'

EXPORTING

i_gjahr = p_year

i_periv = 'CY'

i_poper = p_month

IMPORTING

e_date = s_date-high.

reward if helpful

Former Member
0 Kudos

HEY CAN YU PLEASE CLARIFY WHAT EXACTLY U WANT

COZ U HAVE ALREADY TOLD WHAT WILL BE THE INPUT PARAMETRS AND WHAT WILL BE THE UPTPUT

THEN WHAT U WANT

IF YOU CAN CLARIFY THEN WE CAN TRY TO HELP YOU OUT

Former Member
0 Kudos

* get the first day of the period
CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
  EXPORTING
    I_GJAHR              = wgjahr
*   I_MONMIT             = 00
    I_PERIV              = 'V9'
    I_POPER              = wbuper
  IMPORTING
    E_DATE               = wfirstday
  EXCEPTIONS
    INPUT_FALSE          = 1
    T009_NOTFOUND        = 2
    T009B_NOTFOUND       = 3
    OTHERS               = 4.

* if today is not the first day of the period, return an error.
if sy-datum <> wfirstday.

* Date is not the first day of the fiscal period.
  MESSAGE E003(ZBW).

endif.


CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
           EXPORTING
                I_GJAHR        = LOC_YEAR
                I_PERIV        = '01'
                I_POPER        = LOC_POPER
           IMPORTING
                E_DATE         = LOC_DATE
           EXCEPTIONS
                INPUT_FALSE    = 1
                T009_NOTFOUND  = 2
                T009B_NOTFOUND = 3
                OTHERS         = 4.
      L_S_RANGE-LOW      = LOC_DATE.
      L_S_RANGE-SIGN     = 'I'.
      L_S_RANGE-OPT      = 'EQ'.

Former Member
0 Kudos

Hi,

You can do it in following manner...

DATA: L_YEAR TYPE NUMC4,

L_MONTH1 TYPE NUMC3,

SDATE TYPE SY-DATUM,

EDATE TYPE SY-DATUM.

L_YEAR = P_PERIOD+0(4).

L_MONTH1 = P_PERIOD+4(2)

call function 'FIRST_DAY_IN_PERIOD_GET'

EXPORTING

i_gjahr = L_YEAR

i_periv = 'CY' "YOUR FISCAL YEAR VARIANT

i_poper = L_MONTH1

IMPORTING

e_date = SDATE.

call function 'LAST_DAY_IN_PERIOD_GET'

EXPORTING

i_gjahr = P_YEAR

i_periv = 'CY'

i_poper = P_month

IMPORTING

e_date = EDATE.

REWARD IF USEFUL

Edited by: SHREE WADEKAR on Apr 24, 2008 10:38 AM