0
Apr 10, 2018 at 03:37 PM

# Planning function formula reads only one infoprovider in multiprovider

108 Views Last edit Apr 10, 2018 at 03:39 PM 2 rev

Hi Experts,

I'm creating a planning application to calculate a rate used to accrue for customer discounts. The target rate is based on several rates, some derived and others manually input. Since the data comes from multiple sources, I created an aggregation level that reads from a multiprovider consisting of the source DSO's.

ZCOP_O14 is the planning DSO which contains the product, customer and rate history. This DSO also will contain the target rate we are setting in the formula.

ZCOP_O02 is a planning DSO containing customer pricing data uploaded by our user.

I need to read data from ZCOP_O14 and fetch records from ZCOP_O02 to calculate a pricing target which will be stored in a KF in ZCOP_O14. I thought I found a solution in another article, but it will only read from one DSO.

I've tried several strategies for the filter and several iterations of the code. How can I get this formula to read from both DSO's?

Here's my formula as it stands now:

DATA CH_TAR TYPE 0DISTR_CHAN.
DATA CH_REF TYPE 0DISTR_CHAN.
DATA CG_TAR TYPE ZCG_SOLD2.
DATA CG_REF TYPE ZCG_SOLD2.
DATA AG_TAR TYPE 0PRODH2.
DATA AG_REF TYPE 0PRODH2.
DATA VER_TAR TYPE ZVERSION1.
DATA VER_REF TYPE ZVERSION1.
DATA AMOUNT TYPE F.
DATA IP_TAR TYPE 0INFOPROV.
DATA IP_REF TYPE 0INFOPROV.

IP_TAR = 'ZCOP_O14'.
IP_REF = 'ZCOP_O02'.

*BREAK-POINT.

FOREACH CH_TAR, IP_TAR, AG_TAR, CG_TAR, VER_TAR.
* BREAK-POINT.
FOREACH CH_REF, IP_REF, AG_REF, CG_REF, VER_REF IN REFDATA.
* BREAK-POINT.
IF CH_TAR = CH_REF AND AG_TAR = AG_REF AND CG_TAR = CG_REF AND VER_TAR = VER_REF.
{ ZPRPOL, CH_TAR, ZCOP_O14, AG_TAR, CG_TAR, VER_TAR } =
{ ZBASERATE, CH_TAR, ZCOP_O14, AG_TAR, CG_TAR, VER_TAR } +
{ ZRA_SBL01, CH_REF, ZCOP_O02, AG_REF, CG_REF, VER_REF } +
{ ZRA_CAM01, CH_REF, ZCOP_O02, AG_REF, CG_REF, VER_REF } +
{ ZRA_CMA01, CH_REF, ZCOP_O02, AG_REF, CG_REF, VER_REF }.
ENDIF.
ENDFOR.
ENDFOR.