cancel
Showing results for 
Search instead for 
Did you mean: 

Formula error - in IP while using VARC

Former Member
0 Kudos

Hi Experts,

Please see my requirement below :

Total of item 11207000 should be equal to the sum total of 4 other items. So I have created a variable (VAR_ENTRY_ITEMS) to capture all the 4 items.

Item is compounded with '0CS_CHART'.

I am getting error as 'Formula error: ) was expected. Syntax error in row 21, column 30'.

And the Operand is {key figure name, 0COMPANY, 0CS_ITEM, 0CS_VERSION, 0FISCPER3).

Please see code below :

DATA DIFF TYPE F.

DATA CCOMPANY TYPE 0COMPANY.

DATA CPERIOD TYPE 0FISCPER3.

DATA CITEMS TYPE 0CS_ITEM.

DATA CCHART TYPE 0CS_CHART.

CCHART = 'BG' .

CCOMPANY = VARV(0S_COM_M).

CPERIOD = VARV(ZPER_MTH).

CITEMS = VARC(VAR_ENTRY_ITEMS, CCHART).

DIFF = {0CS_TRN_LC, CCOMPANY, 11207000, 100, CPERIOD} - {0CS_TRN_LC, CCOMPANY, CITEMS, 100, CPERIOD}.

IF DIFF <> 0.

MESSAGE E001(UPF) WITH 'REENTER THE VALUES'.

ENDIF.

Thanks in advance for your advise.

Regards

Shanthi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You cannot use a multiple value variable like this.

You need to use the VARC statement to count number of values in the variable like CITEMS = VARC(VAR_ENTRY_ITEMS).

And you can access individual entries in this variable using the VARI statement as VARI(VAR_ENTRY_ITEMS, 1) etc. Then access these individual items and subtract one by one. You cannot get the sum of all items by using a multi value variable.

Hope this helps.

Former Member
0 Kudos

Hi Again,

I think what Mayank is saying is right. In that case it should probably look like this:-

DATA DIFF TYPE F.

DATA TOTAL TYPE F.

DATA CCOMPANY TYPE 0COMPANY.

DATA CPERIOD TYPE 0FISCPER3.

DATA CITEMS TYPE 0CS_ITEM.

DATA CCHART TYPE 0CS_CHART.

DATA Count TYPE F.

DATA TCount TYPE F.

CCHART = 'BG' .

CCOMPANY = VARV(0S_COM_M).

CPERIOD = VARV(ZPER_MTH).

CITEMS = VARV(VAR_ENTRY_ITEMS, CCHART).

TCOUNT= VARC(VAR_ENTRY_ITEMS, CCHART).

TOTAL=0.

DO.

COUNT=1.

CITEMS = VARI(VAR_ENTRY_ITEMS, CCHART,COUNT)

TOTAL= TOTAL+{0CS_TRN_LC, CCOMPANY, CITEMS, 100, CPERIOD}.

COUNT=COUNT+1.

IF COUNT > TCOUNT.

ENDDO.

EXIT.

DIFF = {0CS_TRN_LC, CCOMPANY, 11207000, 100, CPERIOD} - TOTAL.

IF DIFF <> 0.

MESSAGE E001(UPF) WITH 'REENTER THE VALUES'.

Regards

Former Member
0 Kudos

Hi SC and Mayank,

thanks for your suggestions. I am going to try this and let you know if it works.

Regards

Shanthhi

Former Member
0 Kudos

Hi,

its still giving the same error (Formula error: ) was expected - Syntax error in row 26, column 30).

Please note I haven't declared '0CS_CHART' under neither 'to be changed' or 'used in conditions'. Please let me know if i need to tick any of these.

Your help is much appreciated.

Kind regards

Shanthi

The current code :

DATA DIFF TYPE F.

DATA TOTAL TYPE F.

DATA CCOMPANY TYPE 0COMPANY.

DATA CPERIOD TYPE 0FISCPER3.

DATA CITEMS TYPE 0CS_ITEM.

DATA CCHART TYPE 0CS_CHART.

DATA COUNT TYPE F.

DATA TCOUNT TYPE F.

CCHART = 'BG'.

CCOMPANY = VARV(0S_COM_M).

CPERIOD = VARV(ZPER_MTH).

CITEMS = VARV(VAR_ENTRY_ITEMS, CCHART).

TCOUNT= VARC(VAR_ENTRY_ITEMS, CCHART).

TOTAL=0.

DO.

COUNT=1.

CITEMS = VARI(VAR_ENTRY_ITEMS, CCHART,COUNT).

TOTAL= TOTAL+{0CS_TRN_LC, CCOMPANY, CITEMS, 100, CPERIOD}.

COUNT=COUNT+1.

IF COUNT > TCOUNT.

ENDDO.

EXIT.

DIFF = {0CS_TRN_LC, CCOMPANY, 11207000, 100, CPERIOD} - TOTAL.

IF DIFF <> 0.

MESSAGE E001(UPF) WITH 'REENTER THE VALUES'.

ENDIF.

Former Member
0 Kudos

Hi experts,

please see my requirement and let me know if the above approach of writing the formula is needed.

I have set of items which has value. Few new items are added and the value of the new items will be entered manually. Lets say there are a set of 4 new items and one old item. Total of new 4 items should be equal to the value of the old item.

Here is where I have used the above formula to validate the total.

Please advise.

Regards

Shanthi

Former Member
0 Kudos

Hi,

Can you please tell which is row 26? Count this in the formula editor taking into consideration blank rows also (easier would be to set the no. of displayed rows as 26 so that the last line displayed when cursor is on top would be the one).

Also I see that in some lines in the code, you still have no spaces around operands like + = etc; please make sure that you space operands etc otherwise you can face error messages.

Former Member
0 Kudos

Hey friends,

I can see the reward point information in the forum!! Is it something due to my settigns or there is something wrong with the forum?

Regards,

SK

Former Member
0 Kudos

I too have this issue... wonder what is the reason?

Former Member
0 Kudos

HI Mayank,

I am so sorry as my lead has changed his mind he said we can't allow users to enter item values through variables. So I am told to create planning function for specific set of item numbers. So I have written below formula. Fortunately, formula is correct but it is not throwing error even though the key figure value for item 1+item2 + item3 + item 4 is not equal to the main item while this is executed in BEx Analyser.

Steps followed :

Created a button first to execute the planning function and then save.

when clicked on the button, its not throwing any warning messages. Its just saying 'Planning function xxx executed successfully and data saved'

Please advise as I need to validate the values entered for the key figures.

DATA DIFF TYPE F.

DATA TOTAL TYPE F.

DATA CFISCYEAR TYPE 0FISCYEAR.

CFISCYEAR = VARV(0P_FYEAR).

TOTAL = {0CS_TRN_LC, 11205000, CFISCYEAR} + {0CS_TRN_LC, 11205500, CFISCYEAR} + {0CS_TRN_LC, 11206000, CFISCYEAR} + {0CS_TRN_LC, 11206500, CFISCYEAR}.

DIFF = {0CS_TRN_LC, 11207000, CFISCYEAR} - TOTAL.

IF DIFF <> 0.

MESSAGE E001(UPF) WITH 'REENTER THE VALUES'.

ENDIF.

Regards

Shanthi

Former Member
0 Kudos

Hi,

So now your syntax errors are taken care of... right? These 11205000,... are the item numbers... is this correct?

As such, the formula is looking good to me. What I would suggest you to do is to create message statements and see if the calculations are taking the correct numbers you are entering in the layout.

Use message statements like:

MESSAGE I001(UPF) WITH 'total diff ' TOTAL DIFF.

You can also check if all the four figures forming part of TOTAL are correct similarly. I hope this will help.

Former Member
0 Kudos

HI Mayank,

You are right. That is item number.

I have added your suggested message statement and this is what I am getting ;

TOTAL DIFF 0.0000000000000000E00 0.0000000000000000E00

even though i have positive valid values for each item.

May be this is why I am not getting the error message.Please advise.

Please also note that I am not getting option to assign the points.

Regards

Shanthi

Former Member
0 Kudos

Hi,

It seems the selection in the input-query using which you are entering the figures, are different from the ones used in the FOX. Please compare the value of each characteristic in query and in the FOX for the intended records.

Regarding the points probelm I dont have any solution :-)... you can come back to the thread and assign points as and when this problem gets resolved on SDN... i hope someone can throw some light on this strange issue!

Former Member
0 Kudos

HI Mayank,

I am sorry.

Please elaborate what do you mean by selection.

I just build a query on aggregation level on which this Fox formula is written.

If you meant filters, I have the same ones in the query as well as the fox.

Regards

Shanthi

Message was edited by:

Shanthi Shanthi

Former Member
0 Kudos

I am getting same 'TOTAL DIFF 0.0000000000000000E00 0.0000000000000000E00'

even when I have executed the planning function using the planning sequence. May be this is not related to the selection as in this case, I haven't used query at all.

Please advise

Regards

Shanthi

Former Member
0 Kudos

Hi,

if you are using the same filter, then other characteristic values should be fine... but what about these which you are accessing in FOX - eg: {0CS_TRN_LC, 11205000, CFISCYEAR}. Are these values the same as what you are having in the input ready query where you enter the figures?

Run the function (using planning sequence) with trace... examine the records accessed by the function... that should give you some clues.

Former Member
0 Kudos

HI Mayank,

As mentioned in the previous post, I am just using the planning sequence to execute the planning function.

Could you please advise me what other types we can define of TYPE other than F.

For example : DATA DIFF TYPE F.

I tried 'I' and its returning a value of 0(zero). So i am wondering if this TYPE is causing the problem

Thanks for your support

Regards

Shanthi

Former Member
0 Kudos

Hi,

It would not be the TYPE causing problem. You should use TYPE F anyway. What I was trying to say is that maybe the value of some characteristic you are populating in the records using the query might be different that what you are trying to access in the FOX. As an eg., maybe you are populating fiscyear value as <i>F1</i> from the query but in FOX, you are trying to access some other value <i>F2</i>. Try to match your query and FOX configuration.

Former Member
0 Kudos

Thanks Mayank.

Fitler and formula were using the same values to the variables. I just found that,

there is a conversion, so I had to prefix the item number with '00' to pick the right value.

Once again thank you very much for your continued support on SDN.

Regards

Shanthi

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Please try if tyhe below FOX works...

Regards,

SK

DATA DIFF TYPE F.

DATA TOTAL TYPE F.

DATA CCOMPANY TYPE 0COMPANY.

DATA CPERIOD TYPE 0FISCPER3.

DATA CITEMS TYPE 0CS_ITEM.

DATA CCHART TYPE 0CS_CHART.

CCHART = 'BG' .

CCOMPANY = VARV(0S_COM_M).

CPERIOD = VARV(ZPER_MTH).

CITEMS = VARV(VAR_ENTRY_ITEMS, CCHART).

TOTAL=0.

FOREACH CITEMS.

TOTAL= TOTAL+{0CS_TRN_LC, CCOMPANY, CITEMS, 100, CPERIOD}.

ENDFOR.

DIFF = {0CS_TRN_LC, CCOMPANY, 11207000, 100, CPERIOD} - TOTAL.

IF DIFF <> 0.

MESSAGE E001(UPF) WITH 'REENTER THE VALUES'.