cancel
Showing results for 
Search instead for 
Did you mean: 

Formula planning function not executed the fox code

Former Member
0 Kudos

Hi All,

The formula planning function hadn't executing the fox code. Previously it used to work, i hadn't changed any thing (fields to be changed) in the planning function (it is same as previous). Please look at below

Your valuable inputs are appreciated

Thanks in advance

Regards,

Narendra

Fields to be changed:

0CALDAY.

0DOC_CURRCY.

IO_U2_UN.

0VERSION.

0MATERIAL.

0SOLD_TO.

IODSOPER.

0DOC_CURRCY

The fox code is as follows.

  • This fox calculates plan-sales per day according to

  • business days.

  • Internal Characteristics

DATA DAY TYPE 0CALDAY.

DATA CURR TYPE 0DOC_CURRCY.

DATA UNIT TYPE IO_U2_UN.

DATA VERSION TYPE 0VERSION.

DATA DOC_VERSION TYPE 0VERSION.

DATA PROD TYPE 0MATERIAL.

DATA SOLD_TO TYPE 0SOLD_TO.

DATA OPER TYPE IODSOPER.

  • Internal key figures

DATA WEIGHT TYPE F.

DATA SALES TYPE F.

DATA QUAN TYPE F.

DATA SUM TYPE F.

DATA BUS_DAY TYPE I.

DATA WEIGT_BUS TYPE F.

DATA SALES_DAY TYPE F.

DATA QUAN_DAY TYPE F.

  • Initiate keyfigures and read variable

WEIGHT = 0. SALES = 0. QUAN = 0. SUM = 0.

VERSION = VARV(DSIVERS).

  • Calculate sum of weigtet business days.

FOREACH DOC_VERSION,OPER, DAY, PROD.

IF OPER = 00000100.

WEIGHT = {IODSWGT,DAY,#,#,#,#,00000100,#,DS000001}.

BUS_DAY = {IODSINV,DAY,#,#,#,#,00000100,#,DS000001}.

IF WEIGHT = 0. WEIGHT = 1. ENDIF.

SUM = SUM + (BUS_DAY * WEIGHT).

ENDIF.

ENDFOR.

SALES = 0. QUAN = 0.

  • calculate daily plan-sales

FOREACH DAY,OPER.

  • read business day and weight.

WEIGHT = {IODSWGT,DAY,#,#,#,#,00000100,#,DS000001}.

IF WEIGHT = 0. WEIGHT = 1. ENDIF.

BUS_DAY = {IODSINV,DAY,#,#,#,#,00000100,#,DS000001}.

WEIGT_BUS = WEIGHT * BUS_DAY.

IF WEIGT_BUS <> 0.

FOREACH DOC_VERSION, CURR,UNIT,PROD, SOLD_TO.

  • Split executed on selected version

IF VERSION = DOC_VERSION.

  • Read plan-data

SALES =

{IODSPSAL,#,CURR,PROD,SOLD_TO,DOC_VERSION,

#,UNIT,DS000004}.

QUAN =

{IODSPQTY,#,CURR,PROD,SOLD_TO,DOC_VERSION,

#,UNIT,DS000004}.

  • Calculate daily sales.

IF SALES <> 0 OR QUAN <> 0.

SALES_DAY = (SALES/SUM) * WEIGT_BUS.

QUAN_DAY = (QUAN/SUM) * WEIGT_BUS.

  • write result

{IODSPSAL,DAY,CURR,PROD,SOLD_TO,VERSION,

#,UNIT,DS000004}

= SALES_DAY.

{IODSPQTY,DAY,CURR,PROD,SOLD_TO,VERSION,

#,UNIT,DS000004}

= QUAN_DAY.

ENDIF.

ENDIF.

ENDFOR.

ENDIF.

ENDFOR.

  • Delete original planposting on not-allocated day

FOREACH DAY, DOC_VERSION, CURR, UNIT, PROD.

IF DOC_VERSION = VERSION.

{IODSPSAL,#,CURR,PROD,SOLD_TO,DOC_VERSION

,#,UNIT,DS000004} = 0.

{IODSPQTY,#,CURR,PROD,SOLD_TO,DOC_VERSION

,#,UNIT,DS000004} = 0.

ENDIF.

ENDFOR.

Accepted Solutions (0)

Answers (2)

Answers (2)

Soulsurfer
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

may be the reason is in absence of data, on which FOX formula is executed? If there is no data in level, FOX formula executes 0 times.

Please check this (enter fw_tm in tcode input - and you'll see all data in the level).

Former Member
0 Kudos

Hi,

the best way to check is, is to debug it. Add "break-point" in your FOX forumula, create a selection variable for your planning sequence and then run via SE38 program RSPLS_PLSEQ_EXECUTE .

D

Former Member
0 Kudos

I can see there is data on which FOX formula was executed

Former Member
0 Kudos

Can you please explain in a bit more detail? What happens exactly when you execute this function?

Former Member
0 Kudos

Theout put was shown as un-assigned values for all the fields to be changed