06-12-2008 10:04 AM
hi all,
i am taking fiscal period and fiscal year as input from selection screen.
here i am supposed to find the range of posting date when fiscal period and year is given. i am using the function modules FIRST_DAY_IN_PERIOD_GET and LAST_DAY_IN_PERIOD_GET to get the range.
but both the function modules ask for two more inputs. MONMIT and PERIV i.e. first day of second period (which is 00 by default) and fiscal year varint respectively.
what does these two variables mean? are they dependent on company codes (bukrs)?
does the MONMIT change depending on PERIV or BUKRS? my seniors suggested me table T001 and T093C. i can find PERIV from T001 but, does MONMIT change depending on BUKRS or PERIV?
please provide the details on how to get them...
thanks in advance
06-12-2008 10:15 AM
Hi Chinmay,
Check this may be helpful
Get KOKRS
CALL FUNCTION 'SD_GET_KOKRS_BUKRS_FROM_WERKS'
EXPORTING
i_werks = p_werks
i_gsber = ' '
IMPORTING
e_bukrs = v_bukrs
e_kokrs = v_kokrs
EXCEPTIONS
plant_not_valid = 1
valuation_area_not_valid = 2
no_kokrs_found = 3
OTHERS = 4.
First go for this FM to fill to get fl_tka01
CALL FUNCTION 'CO_TA_TKA01_READ'
EXPORTING
kokrs_imp = v_kokrs
IMPORTING
struct = fl_tka01
EXCEPTIONS
not_found = 1
OTHERS = 2.
Check this for 1st FM -
DATA : v_gjahr LIKE t009b-bdatj,
v_poper LIKE t009b-poper,
v_first_day LIKE scal-date.
DATA: BEGIN OF fl_tka01.
INCLUDE STRUCTURE tka01.
DATA: END OF fl_tka01.
* determine the first day of the period
CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = v_gjahr
* I_MONMIT = 00
i_periv = fl_tka01-lmona
i_poper = v_poper
IMPORTING
e_date = v_first_day
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
*- Getting Last day
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = v_gjahr
* I_MONMIT = 00
i_periv = fl_tka01-lmona
i_poper = v_poper
IMPORTING
e_date = v_edate1
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
Edited by: Raj on Jun 12, 2008 2:46 PM
Edited by: Raj on Jun 12, 2008 2:47 PM
Edited by: Raj on Jun 12, 2008 2:48 PM
06-12-2008 10:15 AM
Hi Chinmay,
Check this may be helpful
Get KOKRS
CALL FUNCTION 'SD_GET_KOKRS_BUKRS_FROM_WERKS'
EXPORTING
i_werks = p_werks
i_gsber = ' '
IMPORTING
e_bukrs = v_bukrs
e_kokrs = v_kokrs
EXCEPTIONS
plant_not_valid = 1
valuation_area_not_valid = 2
no_kokrs_found = 3
OTHERS = 4.
First go for this FM to fill to get fl_tka01
CALL FUNCTION 'CO_TA_TKA01_READ'
EXPORTING
kokrs_imp = v_kokrs
IMPORTING
struct = fl_tka01
EXCEPTIONS
not_found = 1
OTHERS = 2.
Check this for 1st FM -
DATA : v_gjahr LIKE t009b-bdatj,
v_poper LIKE t009b-poper,
v_first_day LIKE scal-date.
DATA: BEGIN OF fl_tka01.
INCLUDE STRUCTURE tka01.
DATA: END OF fl_tka01.
* determine the first day of the period
CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = v_gjahr
* I_MONMIT = 00
i_periv = fl_tka01-lmona
i_poper = v_poper
IMPORTING
e_date = v_first_day
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
*- Getting Last day
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = v_gjahr
* I_MONMIT = 00
i_periv = fl_tka01-lmona
i_poper = v_poper
IMPORTING
e_date = v_edate1
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
Edited by: Raj on Jun 12, 2008 2:46 PM
Edited by: Raj on Jun 12, 2008 2:47 PM
Edited by: Raj on Jun 12, 2008 2:48 PM
06-12-2008 11:50 AM
hi,
thanks for the reply.
but i didnt understand how u calculated PERIV..
can you please elaborate what kokrs is .. also, though i have plant (werks) in the selection screen, its not mendatory..
so, if the user doesnt input the plant, this logic will fail.
06-12-2008 12:06 PM
the real problem i m facing is MONMIT..
i am able to get PERIV from table T001 when selected with BUKRS, but sometimes this value is not maintained i.e. space / empty..
so, what should it be if it is empty and is MONMIT 00 for all types of fiscal variant?
06-12-2008 12:31 PM
Hi Check this,
I presume MONMIT can be empty since its option in FM