Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Planning function fox formula not generate records

hello ,

I have written a fox formula planning function to generate records.

i want to

A = B1 * C1 * D1 * E1

_____________________________ __________________________

Sum for week (B2 * C2) Sum for Fiscal year (D2 * E2)

Where

A = Distribution key (day, specific profit center)

To be calculated. Result should be saved in Infoprovider ZIP_RREF1 with IP Planning formula = 99.

B,C, D,E all are taken from the different cubes,

Below is the code for the fox formula

DATA CHA_CALWEEK TYPE 0CALWEEK.

DATA CHA_COMP_CODE TYPE 0COMP_CODE.

DATA CHA_FISCPER3 TYPE 0FISCPER3.

DATA VAR_POPER TYPE 0FISCPER3.

DATA SUM_YEAR TYPE F.

DATA TEMP_D TYPE F.

DATA SUM_WEEK TYPE F.

DATA CHA_INFOPROV TYPE 0INFOPROV.

DATA COUNTER_WEEK TYPE I.

DATA TEMP_DE TYPE F.

DATA ATR_PCSTAT TYPE ZPC_STAT.

DATA CHA_PC TYPE 0PROFIT_CTR.

DATA TEMP_L TYPE F.

  • CURRENCY IS LOCAL CURRENCY. FOR DATA SELECTION TO BE RIGHT, NECESSARY TO DERIVE FROM CC.

*DATA UN_LOC_CURRCY TYPE 0LOC_CURRCY.

BREAK-POINT.

*UN_LOC_CURRCY = VARV(Z_U_I000).

CHA_COMP_CODE = VARV(Z_U_I000).

VAR_POPER = VARV(Z_U_I004).

*CHA_PC = VARV(Z_U_I0061).

*EXECUTE THE PF FOR EACH COMPANY CODE & ITS SPECIFIC PROFIT CENTER.

FOREACH CHA_COMP_CODE,CHA_PC,CHA_FISCPER3.

*DERIVE THE PROFIT CENTER STATUS

ATR_PCSTAT = ATRV('ZPC_STAT',CHA_PC).

BREAK-POINT.

  • FOR ALL COMPARABLE STORES.

IF ATR_PCSTAT = 1.

  • TO CALCULATE THE D

SUM_YEAR = 0.

TEMP_D =0.

IF CHA_FISCPER3 > VAR_POPER.

FOREACH CHA_CALWEEK.

TEMP_D = {ZSA_BUD2X, CHA_FISCPER3,CHA_COMP_CODE,CHA_FISCPER3,YBUDG_01X,CHA_PC,#}.

  • TO CALC ( D * E)

SUM_YEAR = SUM_YEAR + TEMP_D * {ZIPINDEX,CHA_CALWEEK,CHA_COMP_CODE,CHA_FISCPER3,ZIP_RREF1,CHA_PC,092} .

ENDFOR.

code} & many many more lines of code

There is no syntax error.

I debugged the function suing the report also.the variable values are also passed properly.

However, i could conclude that CHA_FISCPER is always 0. & also the KF ZSABUD2X is always returning 0 for the selectino , even though there are data for this selection in the Cube.

Hence TEMP_D becomes 0 & all futher calc based on TEMP_D becomes 0 with no records generated in the CUbe.

Can someone help me to resolve this , i believe the syntax & logic are all correct. still the KF returns 0.

any help , appreciable.

regards,

John

Hence the data records from the 1st bold line

Former Member
Not what you were looking for? View more on this topic or Ask a question