Skip to Content
0
Former Member
Mar 02, 2012 at 11:31 AM

BW ABAP Code - small modification needed

30 Views

Hi All,

I am using a small piece of ABAP code in CMOD to derive a customer exit variable.

based on the current Fiscal Period Month the customer exit variable determines the previous forecasting version (-1).

I am trying to copy the code of the Previous forecasting version to develop Previous forecasting version (-1) customer exit variable.

This is my code and I do not think it will work at the start of the next year when the Fiscal Period returns to value of 1.

-


WHEN 'ZCC0VRFORV4'.

IF i_step = 1.

CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'

EXPORTING

i_date = sy-datum

i_periv = 'V3'

IMPORTING

e_buper = e_buper

e_gjahr = e_gjahr.

IF sy-subrc <> 0.

ENDIF.

IF e_buper = '001'.

l_s_range-low = 'V01'.

l_s_range-sign = 'I'.

l_s_range-opt = 'EQ'.

APPEND l_s_range TO e_t_range.

ELSE.

e_buper = e_buper - 1.

CONCATENATE 'F' e_buper+1 INTO l_s_range-low .

l_s_range-sign = 'I'.

l_s_range-opt = 'EQ'.

APPEND l_s_range TO e_t_range.

ENDIF.

ENDIF.

-


I do not think it is as simple as changing e_buper = e_buper - 1 to e_buper = e_buper - 2???

Any ideas how to make this dynamic so that when we move to Fiscal period 1 the code is smart enough to know what the forecasting version (-2) is?

e.g if current forecast version is F01 the previous is F12 and the previous(-1) is F11.

Thanks

Flash