How to Write a FOX Formula in Intergrated Planning Functions?
HI BI-IP Experts,
I have just written a FOX formula to call an ABAP Function Module which will execute a Process CHain to run.
Here is what I wrong in the FOX formula in the Planning Function ZPF_FOX_CALL_PC.
Call Function Z_CALL_PROC_CHAIN
= * 1.
I had to add in this line otherwise the system do not allow me to save the FOX.
In the Function Module Z_CALL_PROC_CHAIN, it contains the following codes:
SUBMIT rsprocess
WITH type = 'CHAIN'
WITH variant = 'Process chain name'
AND RETURN.
Next I created a workbook with a button that executes this Planning Function ZPF_FOX_CALL_PC.
The button contains 3 lines:
CMD => Execute Planning Function
Planning Function Name => ZPF_FOX_CALL_PC
CMD => SAVE_AREA.
After I clicked on the button, my excel seems to be running and I waited for very long but nothing happens.
And it seems to be running and running and won't stop.
Is it because the program is running in a loop because I missed out some codes in the FOX?
Thanks,
Shunhui.
hi,
Since you have not given any condition, the fox formula is being executed for all the number of records...thats why you are seeing the loop.
example if you have 10 records in your BPS template, the formula is getting executed 10 times for each
you need to select the field for condition which will make 1 entry, so the function module gets executed just once..
or.. in the function module when you trigger the process chain, make an entry in a database table... when the 2nd row starts, it will check the table... if the entry exists, it will skip the scheduling of process chain... so on..
In the process chain.. at the end, delete the entry from the database..
so your code in the function module should be like this ... assume you have 10 records..
select * from table zlock where process chain name = pc name
(this is to check if the process chain is already running, if yes skip, if no trigger the process chain)
if sy-subrc eq = 0.
exit
else.
DATA: number TYPE tbtcjob-jobcount,
name TYPE tbtcjob-jobname VALUE 'JOB_TEST',
print_parameters TYPE pri_params.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
(this will trigger the process chain in background)
IF sy-subrc = 0.
SUBMIT rsprocess
WITH type = 'CHAIN'
WITH variant = 'PC name'
VIA JOB name NUMBER number
AND RETURN.
(after the process chain started, make an entry in the lock table.. so it will not be executed again)
insert entry in table zlock
ENDif.
endif.
I understand this is complex, but I think its one solution I can think of.
Similar Messages
-
Fox formula for actual/plan data - Planning function
Hello,
I am working on the following scenarios for developing a planning functions for a monthly forecast.
It is rolling montly forcast where user starts the planning in Jan and he has to show the actaul value for the month of Jan and blank values for the remaining 11 months of the year and then the user post his new forecast values for the remain 11 of the year(to replace initial balnk values) so that the data will be saved to real time cube with version v108
In Feb, Jan & Feb months has to show the act values and remaining 10 months has to show last month forecast data. The the user may revise the forecast for the 10 months and then we have to write the data to the real time cube with version v208
In Mar, Jan, Feb and Mar has to show the actual values and the reamining 9 months has to show the last month forecast and then users may revise the forecast data and then i have to write back to the cube with version v308.
I want to automate this process for all the months and all years without manual intervention. So, i decideed to write a fox formula for this scenario with following draft code.
I will get the fy period & year as a variable values and then take the system date into the variable
for each fy period
if the fy perio <= sys date.
{version, infoprovider,value type,amount} = {0,act cube, 10, 0amount)
else
{version, infoprovider,value type,amount} = {result,plan cube, 20, 0amount)
endif.
result will be calculated on the separe routine and populated here
case (fy per)
when 01.
concatenate v1 with fy+2(2) into y
result = v1+y
when 02.
concatenate v2 with fy+2(2) into y
result = v2+y
when 03.
concatenate v3 with fy+2(2) into y
result = v3+y
when 04.
concatenate v4 with fy+2(2) into y
result = v4+y
when 05.
concatenate v5 with fy+2(2) into y
result = v5+y
when 06.
concatenate v6 with fy+2(2) into y
result = v6+y
when 07.
concatenate v7 with fy+2(2) into y
result = v7+y
etc...for all months
So, can you please let me know the best way to implement this (either by fox formuls or exits)...your inputs are really appreciated
Thanks,
Srini
Edited by: srini on Mar 28, 2008 12:05 PMHi Srini,
If I 've understood u r problem clearly ,You have to write two Fox Functions and you can call exit variable in both to check the system date.
I think first you should create exit varriable which would return the system date,use the same variable in data slice to lock the data till current period.
After that create one fox restricted with any one version where you can copy the data for planning .for example:-
1)First Fox:-
DATA TIM_FISCPER TYPE 0FISCPER.
TIM_REF_FISCPER = VARV(ZEXIT_FPER).
Get the last month
version using modlue or any another logic .(v108)
FOREACH TIM_FISCPER.
IF TIM_FISCPER <= TIM_REF_FISCPER.
{0amount,version(001) ,tim_fiscper} = {0amount,version(000) ,tim_fiscper}.
else.
{0amount,version(001) ,tim_fiscper} = {0amount,version(v108) ,tim_fiscper}.
endfor.
Its just n example use the granularity according to the requirement.
2)Second fox would save the changed plan data:-
DATA TIM_FISCPER TYPE 0FISCPER.
TIM_REF_FISCPER = VARV(ZEXIT_FPER).
Get the last month
version using modlue or any another logic .(v208)
FOREACH TIM_FISCPER.
IF TIM_FISCPER > TIM_REF_FISCPER.
{0amount,version(v208) ,tim_fiscper} = {0amount,version(001) ,tim_fiscper}.
endfor.
Here ZEXIT_FPER is an exit variable created using cmod and populated with system date.
Hope it will helpful for u.
Rgds,
Indu -
How to write a "Count" Formula in Webi 4.1
Hi,
I have a webi report (Datasource is Excel) where I have a self join (merged Dimension) on the 'YearMonth' . I am bringing all the 'filed Dates' from one query and all the 'Settled' dates from another query. (Same excel datasource for these queries, created a merged dimension). Now, I am trying to write a 'Count' formula (Please see below), to count all the '#GO" where 'Settled Date is Current Year. The issue is, when the 'Filed date' and 'Settled Date' is 'current year', but the filed month is different, then it is counting the 'Settled Month' in the 'Filed Month'. For ex: If the issue is settled in 'April'2014, but filed in 'March'2014, it is counting the settled Month as 'March'2014' instead of 'April'2014'. How do I get the count of all the issues settled in the current year, regardless of 'Filed Month' or 'Filed Year'. Please help.
Thanks,
Charvi.Hi,
IS the empty rows comming from backend or do you have any variables in the columns that has null values?.
If it is a varaible then Create : =if(Var1 = 0 or isnull(Var1)) then "Hide" else "Display"
Create a report filter on "Var1" and select "Hide".
Thanks,
Jothi -
How to display my FOX formula result on the layout
Hi Guru's,
I have created one Fox Formula for OTB using the given below calculation
Planned Open-To-Buy (Retail Price) = Sales / Retail Value + Last Planned Stock (Retail Value) - Open Purchase Orders (Retail Value with Tax) - GR Posting Date / Vendor RtlT + Promotion Sales / Retail .
When I am executing my Planning function (using BPS0) then it is working fine. It is showing the correct OTB value.
I have insterted this FOX function into my layout using UPSPM tcode. When I execute the OTB calc function from UPSPM then correct data gets saved into my real-time cube. However OTB data is not getting displayed on my layout.
Is there something else which I am supposed to do to display the result on the final layout ?
Thanks,
Ashu gupta.Hii Guys,
Thanks a lot for your inputs. My issue has been resolved. I was not able to get the FOX formula output on the layout as the formula was not giving unique record. I have removed version char from my level and flds for selection. Now everything is working fine.
Thanka again for your valuable time. -
Fox Formula in Integrated planning.
Hi All,
I have a requirement like this.
My data in cube is like this.
SEASN BR DU ST PS VOL..
SS09 AD BB ST1 PS1 100
SS09 AD BB ST1 PS2 200.
SS09 AD BB ST2 PS3 300.
SS09 AD BB ST3 PS4 400.
i need to count the no.of PS under one ST i.e for ST1 the count should be 2 and for ST2 it should be1.
The fox formula thar we are using is ,
DATA DU TYPE ZDEVPUN.
DATA SR TYPE ZGSMSR.
DATA BR TYPE ZORBRANDS.
DATA PS TYPE ZPRODSPEC.
DATA SEASON TYPE ZSEANI.
DATA ST TYPE ZSOURCTYP.
DATA COUNTER TYPE I.
DATA PSA TYPE STRING.
DATA PSB TYPE STRING.
PSA = 'XXX'.
COUNTER =0.
FOREACH SEASON,BR,DU,SR,ST,PS.
PSB =ST.
IF PSA <> PSB AND PSA <> 'XXX'.
COUNTER =0.
ELSE.
COUNTER =COUNTER +1.
ENDIF.
PSA = ST.
ENDFOR.
but while executing this code PS is considering all four values i.e PS1,PS2,PS3,PS4 for ST1 and populating COUNTER with value 4.
Please provide any inputs for this problem.
Thanks in Advance.
Reshma.Keep only PS and key figure name in fields to be changed and the remaining in field list.
Write code as below.
count = 0.
Foreach PS.
count = count + 1.
Endfor.
This will give you the count of PS for each combination of SEASN BR DU ST. -
What is the use of fox formula in integrated planning
what is the use of fox formula in integrated planning
Hi,
just as a follow up - the FOX Extension Formula capability of the IP in BW is as others have mentioned - to help develop formulas to execute calculations during planning, forecasting, budgeting, etc. - it allows consultants, like myself, to develop these formulas without the help of an ABAP consultant - but creates ABAP programs behind the scenes.
You can also use these ABAP programs separate from the IP component - once you create a FOX formula you can retrieve the ABAP program and then use it for other activities.
With the FOX you can use variables in a formula, call another ABAP program, generate loops of data both master and transactional, allows IF, THEN statements, and a number of other activiities. There is a limit to the usefulness of the FOX formula process - you may find if the FOX formula is too complex or long that your process will run slowly during the calculations. If this is occurring you will need to debug your ABAP program to see if you can increaase the performance.
Thanks and hope this helps, Pete -
How to write the sql statement of my finder function in cmp?
hi,
I create a cmp ejb from table INFOCOLUMN,and I create a my finder function ,which sql statement is :
select * from INFOCOLUMN WHERE employee_id=id
employee_id is a column of the table,and id is the finder function parameter.
The error is : invalid column name
So,how to write the sql statement.
Thanks .Mole-
Bind variables are of the form $1, $2, etc., so your query stmt should look like:
select * from INFOCOLUMN WHERE employee_id=$1
-Jon -
Use Formula variable in planning function
Hello,
I would like to use a formula variable in a planning function.
The problem is that when I execute this function all keyfigures values are set to 0 so the FOX is not executed.
The idea is to have something like
= VARV(FORMULAVARIABLE).
How could this be achieved using FOX ?
Or how using an exit function could I call this FORMULAVARIABLE which is not used in the query ?
Thanks,
MatthieuHello Matthieu,
Please search the forum before posting:
http://forums.sdn.sap.com/click.jspa?searchID=70350665&messageID=9814615
Regards,
Marc
SAP Techology RIG
PS: You closed the thread so I have to add some details here. The FOX runtime is hardcoded to 0RSPLS_FORMULA. Therefore, 0RSPLS_FORMULA cannot be copied to a custom planning function type as you suggest.
Edited by: Marc Bernard on Feb 23, 2011 3:36 PM -
How to pass multiple values from workbook to planning function ?
Hi,
I have created Planning function in Modeler and it has one parameter(Variable represents = Multiple single values).
When executing the planning function by create planning seq. in the web template : I see value of variable store data like ...
A.) input one value -> V1
B.) input three values -> V1;V2;V3
This function execute completely in web.
However, I want to use the planning function in workbook(Excel).
The value of variable can't input V1;V2;V3... I don't know how to pass multiple values from workbook to parameter(Multiple single values type) in planning function ?
thank you.Hi,
Please see the attached how to document (page no 16).
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0881371-78a1-2910-f0b8-af3e184929be">how to</a>
Hope this was helpful
thanks -
How to link the variable entry with the planning function execution
Hi All,
I am new to IP , we have a requirement where the user enters the value 2008 for a variable year. Then we are supposed to copy the same combinations for the next four years against which the user will be able to input the key figure values. But i have only 2008 data in the cube, so i need to generate new records for the same characteristic combinations as present for 2008 for the next four years. I am planning to use a copy function for this but how can i trigger this planning function once the user enters the value for the year variable. I want the planning function to get executed once the user clicks OK after the variable entry. Request your valuable inputs on the same.Hi Tilak,
for this u have an option of executing the planning sequence when the web template loads ie. after the variable screen.
open the WAD.
go to the properties of Web Template web item. Under the section standard action of the webtemplate, we have a n option to include planning functions under action before rendering.
If u include your planning sequence in this this will get executed every time the layout loads.
guess this is usefull to u.
Regards.
Shafi. -
Help: How to write a query formula?
Problem. There are 4 tables of a database of a store:
Table 1: Tarifs
Columns: Tarif_number, Price
Primary key: Tarif_number
Table 2: Products
Columns: Product_number, Product_name, Quantity;
Primary key: Product_number
Data: Tarif 1 - 100%, Tarif 2 - 75 %, Tarif 3 - 50 %, Tarif 4 - 25 % (discounts)
Table 3: Customers
Columns: Customer_Number, Customer_Name, Address, Phone;
Primary Key: Client_Number
Table 4: Sales
Columns: Date, Product_Number, Tarif_Number, Quantity_Sold, Customer_Name
Primary key: Date, Product_Number, Customer_Number, Tarif_Number
The problem is to write SQL PLUS queries, which would bring the following results:
i. Data off all customers (name, address, phone), who within the period from 3/4/2009 to 4/4/2009 purchased products containing the string "abc" in its name. The data should be arranged alphabetically by product name. The report should have a footnote including name of its author.
ii which product was purchased the most frequently and the total purchase value. The footnote should include the title and the date of the printout.
iii Catalogue product number, product name, quantity on store, quantity sold for any product in the database. The product name should be introduced from keyboard in order to make possible to enter this or similar query later.Queries not tested*
I) SELECT cs.customer_name, cs.address, cs.phone
FROM customers cs, sales sl, products prd
WHERE cs.customer_number = sl.customer_number
AND prd.product_number = sl.product_number
AND sl.DATE BETWEEN TO_DATE ('3/4/2009', 'DD/MM/YYYY')
AND TO_DATE ('4/4/2009', 'DD/MM/YYYY')
AND LOWER (prd.product_name) LIKE '%abc%'
II) SELECT prd.product_name, SUM (sl.quantity_sold * tf.price)
FROM sales sl, product prd, tarifs tf
WHERE sl.product_number = prd.product_number
AND tf.tarif_number = sl.tarif_number
GROUP BY sl.product_number
HAVING COUNT (1) = (SELECT MAX (COUNT (1))
FROM sales sl1
GROUP BY sl1.product_number)
III) SELECT prd.product_name, prd.quantity, SUM (sl.quantity_sold)
FROM sales sl, product prd, tarifs tf
WHERE sl.product_number = prd.product_number
AND tf.tarif_number = sl.tarif_number
GROUP BY sl.product_number -
How to write ABAP code behind, the OLAP navigation functions
Hi SDN Community,
We have created an artificial hierarchy within BEx, using order structure elements, or characteristic key figures as SAP calls them.
Now, the only feature that dosent seem to be present within the OLAP, is to expand all hiearchy nodes.
It allows you to expand one hierarchy node, but not all the structure element nodes.
I have tried command sequencing by specifying the technical id's of the the structure elements found via RSRT2, but this dosen't work.
I have seen that when the nodes are expanded, that there is indeed standard SAP ABAP code executing back in the datawarehouse.
Hence, do you know
- Where to make ABAP enhancements for OLAP functionality
- How to execute this ABAP (will it be by using Web API and javascript enhancements)
- Is this possible, or has it been done by anyone?
Thank you.
SimonHi Thomas,
I have been working with a brilliant ABAP'er, and together we
implemented a solution in the START method, that makes use of the
following methods and expands all the hierarchy nodes at start.
And this class can be omitted in the Print all view we have formulated
as only a collapsed view has been specified there.
thank you.
Simon
I found this all in that class interface CL_RSR_REQUEST
for N_R_REQUEST
for N_R_DATA_SET
Initial Value: Set Drilldown State of a Hierarchy
Description: 'SET_DRILL_STATE'
this looks like the method that gets executed. what do you think?
can you code this in the program
constants C_CMD_SET_DRILL_STATE type RSRCMDID
value 'SET_DRILL_STATE'. "#EC NOTEXT
methods SET_DRILL_STATE
importing
value(I_AXIS) type RRXAXIS optional
value(I_POSITION) type I optional
value(I_FOCUS_IOBJNM) type RSIOBJNM optional
value(I_DRILLSTATE) type RRXDRILLSTATE optional
value(I_TOGGLE) type RS_BOOL default RS_C_FALSE
!I_R_PARAMETER type ref to CL_RSR_PARAMETER optional
exporting
!E_KEEP_LAST_LINES type I
!E_KEEP_FIRST_LINES type I
!E_NEW_LINES_FROM type I
!E_NEW_LINES_TO type I
!E_NODE_POSITION_FROM type I
!E_NODE_POSITION_TO type I
exceptions
NO_PROCESSING
X_MESSAGE . -
Need to write a custom formula for accrual plan in Leave
Hi , I have also one problem related to leave.
How to create fast formula for leave setup because i want to create fast formula accordingly If People will present 20 days in month then they will get 1 PL and If people will present 60 days then they will get 1 CL.So for this how to do leave setup and fast formula.Please help me out.
I Waiting for your reply,Please refer following notes:
How to create and use Oracle FastFormula functions [ID 214027.1]
Fast Formula FAQ [ID 211422.1] -
How to write this formulas without error in Business Objects..
1: '=substr([D Bank File Warrant Status];2;1)
2: '= If [Chk Recon Check/EFT Amt] = '0' and ([Chk Recon Status Detail] = "Paid" and [Bank File Warrant Status Displayed]= 'V') then "No" else "Yes"
what is this 'v', here it gvn as void, bt i dont know how to write it in formula....
3: '=IF [Bank File Status Detail] inlist ('0V'; '0S') and [Chk Recon Check/EFT Amt] does not exist (is null) then 'Yes' else 'No'
4: '= IF [Chk Recon Status Detail] inlist ("Cancelled" or "Void" and [Bank File Warrant Amount] does not exist (is null) then 'Yes' else 'No'
plz let me know how to write them in formula asap... Thank u in advance..Plese post your query to the [WEBI|SAP BusinessObjects Web Intelligence; forum then.
And don't forget to close this thread.
- Ludek -
Problem in writing Fox Formula
Hello All,
I need to write a formula to fill values in the key figure.
The value is to be sum of other two input ready key figures.
ex a = b +c ( B and c are input ready key figures)
To implement this i have to write a fox formula in planing function.
I am new to Integrated Planning.
Please let me know how this formula will be written.
Regards,
Pratighya.Hi,
If you want to do a simple calculation like price = Quantity * Revenue for the year 2009. Then the code is
Data prc type f.
Data qty type f.
Data rev type F.
data d type 0fiscyear.
prc = {2009,zprice}.
qty = {2009,zquantity}.
rev = {2009,zrevenue}.
= * .
{2009,zprice} = .
Here prc,qty,rev are some buffer variables created here. zprice, zquantity, zrevenue are the keyfigures of your Infoprovider. 0fiscyear is the Time Characteristic of your Info Provider.
Fields to be changed should be Ofiscyear becoz you are restricting the data based on year.
If you dont want to restrict then the code will be
Data prc type f.
Data qty type f.
Data rev type F.
prc = .
qty = .
rev = .
prc = qty * rev.
Regards,
Pushpa M
Maybe you are looking for
-
My ancient HP worked with 10.4.11 and 10.5.1 thru 10.5.5 wirelessly. With 10.5.6 thru 10.5.8 installed, the printer did ot work and only the Adobe printer appeared in the Printer/Fax setup. With 10.5.5, I was experiencing random horizontal gray lines
-
HP Photosmart prints with PC, Droid phone but will only print wirelessly with MacBook OX 10.7.5 if I turn off printer and turn it back on. HP has tried, Belkin (router) has opened all ports, the problem persists.
-
I'm a language translator. My source files are very often pdf's containing huge tables with hundreds of embedded figures as well as text. So far, I've been unable to find a way to automatically convert such a structure to MS Word format. When selecti
-
Please help me with this error in this code snippet!
Code Snippet: REPORT ZMKTEST6. data : f1(2) type c, f2(2) type c, f3(10) type n value '12345'. clear: f1 with 'X', f2 with f1, f3 with '3'. write :/ f1 ,f2, f3. Process Error: The field "F1" must have the length 1.
-
I just switched from a pc laptop to a mbp i7. I'd like to rename multiple jpg files but can't even figure out how to rename ONE file, let alone multiple files. Example: xxxxx.jpg to trip.jpg where all the files will be named "trip" and numbered. Make