cancel
Showing results for 
Search instead for 
Did you mean: 

different values for key figure in fm.

Former Member
0 Kudos

Hi All,

The following function modules giving different results in q and production.

Pls tell me why different values?

FOLLOWING ARE THE INPUTS I GAVE,

I_DATE_FROM = 31.01.2011

I_TIME_FROM = 08:32:00

I_DATE_TO = 31.01.2011

I_TIME_TO = 12:24:13

In Production iam getting 0

But in Q iam getting A VALUE.

PLS HELP ME HERE..

*" IMPORTING

*" VALUE(I_DATE_FROM) TYPE D

*" VALUE(I_TIME_FROM) TYPE T DEFAULT 0

*" VALUE(I_DATE_TO) TYPE D

*" VALUE(I_TIME_TO) TYPE T DEFAULT 0

*" VALUE(I_WERK) LIKE /BI0/SPLANT-PLANT OPTIONAL

*" VALUE(I_FABKL) LIKE /BI0/SFACTCAL_ID-FACTCAL_ID OPTIONAL

*" EXPORTING

*" REFERENCE(E_DURATION_INT) TYPE F

*" REFERENCE(E_DURATION_EXT) TYPE F

*" REFERENCE(E_UNIT_DAY) LIKE /BI0/SUNIT-UNIT

*"----

-


DATA:

l_start LIKE scal-facdate,

l_end LIKE scal-facdate,

  • L_DURATION_S LIKE MCQAVE-DLZEIT,

l_duration_s TYPE f,

l_flg_error(000001) TYPE c,

l_delta_s TYPE i,

l_t001w LIKE /bi0/pplant,

l_dimension LIKE t006-dimid,

l_factcal_id LIKE /bi0/pplant-factcal_id,

l_delta_d TYPE f,

l_wd_end TYPE scal-indicator,

l_wd_from TYPE scal-indicator.

STATICS

s_unit_day LIKE /bi0/sunit-unit.

*== Compute duration

e_duration_ext

= i_date_to - i_date_from + ( i_time_to - i_time_from ) / 86400.

IF NOT ( i_werk IS INITIAL ) OR

NOT ( i_fabkl IS INITIAL ).

*== Compute duration according to fabrics calender

  • Read Calender ID

  • CALL FUNCTION 'ZEW05_PLANT_READ'

  • EXPORTING

  • WERKS = I_WERK

  • IMPORTING

  • STRUCT = L_T001W

  • EXCEPTIONS

  • OTHERS = 01.

IF i_fabkl IS INITIAL.

*== Selektion der Fabrikkalender-ID abhängig vom Werk.

SELECT factcal_id FROM /bi0/pplant INTO l_factcal_id WHERE

plant = i_werk AND

objvers = 'A'.

ENDSELECT.

ELSE.

l_factcal_id = i_fabkl.

ENDIF.

IF NOT ( l_factcal_id IS INITIAL ).

CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'

EXPORTING

date = i_date_from

factory_calendar_id = l_factcal_id

IMPORTING

factorydate = l_start

workingday_indicator = l_wd_from

EXCEPTIONS

OTHERS = 01.

ENDIF.

IF sy-subrc = 0.

CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'

EXPORTING

date = i_date_to

factory_calendar_id = l_factcal_id

IMPORTING

factorydate = l_end

workingday_indicator = l_wd_end

EXCEPTIONS

OTHERS = 01.

ENDIF.

IF sy-subrc = 0.

*-- Compute duration

IF NOT l_wd_end IS INITIAL.

i_time_to = '000000'.

ENDIF.

IF NOT l_wd_from IS INITIAL.

i_time_from = '000000'.

ENDIF.

e_duration_int

= l_end - l_start + ( i_time_to - i_time_from ) / 86400.

ELSE.

e_duration_int = '0.0'.

ENDIF.

IF e_duration_int < '0.0'. "#EC PORTABLE

e_duration_int = '0.0'.

ENDIF.

ENDIF.

IF s_unit_day IS INITIAL.

CALL FUNCTION 'DIMENSION_GET'

EXPORTING

time = 1

IMPORTING

dimid = l_dimension

EXCEPTIONS

dimension_not_found = 01.

IF sy-subrc = 0.

CALL FUNCTION 'UNIT_GET'

EXPORTING

denominator = 1

dimension = l_dimension

numerator = 86400

IMPORTING

unit = s_unit_day

EXCEPTIONS

unit_not_found = 01.

ENDIF.

ENDIF.

e_unit_day = s_unit_day.

ENDFUNCTION.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks a lot for your quick help.

Former Member
0 Kudos

check the table /bi0/pplant in your production system. and see if the attribute factcal_id contains value.

Make sure that you have Plant master data loaded in your production system.

--- Thanks...

Former Member
0 Kudos

Hi,

Plz check once the factory calendar is maintained across the systems for the factory calendar id which u r getting for the plant.

rgrds,

Sakthi.