cancel
Showing results for 
Search instead for 
Did you mean: 

FOX Formula with "Only Read Changed Data"

former_member192555
Participant
0 Kudos

Hi All,

I must admit FOX is a new thing to me and I am trying to learn it. As always the best way to do that is by recreating something that I have done in the past with BPC Standard Script Logic or Custom Logic BADI.

In this case I am trying to enter something in the Analysis which then creates another one or more entries with FOX. It works fine with "Only Read Changed Data", but what I am struggling with is how I can delete the generated records if I enter "0" (clear the input).

The Example:

1. Entering 1000 Spending, Generating with FOX -1000 Cash

2. Entering 0 Spending, but FOX doesn't read/write 0 to Cash

The option I tired is to run Delete function for the "Cash" before the FOX in my sequence. It works if I untick "Only Read Changed Data", but if it is enabled the data is not cleared.

I am trying to avoid running the sequence from button and trying to do something similar to the so called running in "Default" from BPC Classic/Standard.

Thank you for any suggestions!

Accepted Solutions (1)

Accepted Solutions (1)

former_member192555
Participant
0 Kudos

In addition to very helpful answer from Gregor I found after some search a SAP Note. By default, In-memory doesn't work with empty or zero records.

https://launchpad.support.sap.com/#/notes/0002135884

Answers (5)

Answers (5)

Hi Emiliyan,

from the documentation ...

Working with Empty Records

Almost all planning function types do not read empty records and do not write empty delta records to the buffer. Copy and Generate are exceptions: both read null records and write null delta records.

...

In transaction RSPLF1 you can check the flag 'Process Empty Records' set in a planning function type and read the F1 documentation there.

In your case you can create a exit planning function type with the flag 'Process Empty Records' set.

Regards,

Gregor

former_member192555
Participant
0 Kudos

That was very helpful!!!

former_member186338
Active Contributor

Interesting! I am not an expert in FOX, but can you provide more info about: "Entering 0 Spending, but FOX doesn't read/write 0 to Cash"

former_member192555
Participant
0 Kudos

Hi Vadim,

After doing some debugging, I found out that the subset of data before the *FOREACH statement doesn't contain zero values, hence the reason I can't write 0 in the destination.

The destination that needs to be cleared. May 2017 is the one where the source value is zero.

Below is my code.

DATA FLOW TYPE ZSFLOW.
DATA ACCOUNT TYPE ZSACCOUNT.
DATA DEST_ACC TYPE ZSACCOUNT.
DATA DEST_FL TYPE ZSFLOW.
DATA PERIOD TYPE 0FISCPER.

****

BREAK-POINT.
*****Clear Additions
FOREACH PERIOD, ACCOUNT, FLOW.
  IF FLOW = 'CP005' AND ACCOUNT CP 'CL*'.
    DEST_ACC = ATRV( 'ZDEST_ACC', ACCOUNT ).
    DEST_FL = ATRV( 'ZDEST_FL', ACCOUNT ).
    { 0AMOUNT, PERIOD, DEST_ACC, DEST_FL } = 0.
  ENDIF.
ENDFOR.
            <br>
former_member192555
Participant
0 Kudos

Hi Gregor,

So I see that when I enable Process Empty Records, it works fine if I run it as a seprate step. However, it still doesn't write or read if I use only "Read only changed data".

I guess this is what you meant about creating exit planning function?

Regards,

Emiliyan

cornelia_lezoch
Active Contributor
0 Kudos

what exactly is the fox coding you have written?

former_member192555
Participant
0 Kudos

You can check it in the comment next to answer from Vadim above.

former_member192555
Participant
0 Kudos

OK, so my problem is that I used the default option in FOREACH without specifying "IN SELECTION". The "IN SELECTION" option widens the scope of the loop and the data we are working on. By default, from the debugging I get that the system use REFDATA which doesn't pick the zeroes. This at least according to my findings. Any other suggestions are welcome as "IN SELECTION" is not as good as REFDATA.

https://help.sap.com/viewer/0ecf5244825c4742a7b062a89d11c2ac/7.5.7/en-US/4cae4a55dd6e3b9ee10000000a4...

Further variants of the FOREACH loop:

  • FOREACH <Variable> IN REFDATA uses all characteristic values in the reference data for iteration
  • FOREACH <Variable> IN SELECTION uses all characteristic values in the active planning filter for iteration.
  • FOREACH <Variable> IN VARIABLE Var uses all characteristic values in a global variable (Var) for iteration.