Skip to Content
0

Planning function formula reads only one infoprovider in multiprovider

Apr 10 at 03:37 PM

37

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Eric Wootan Apr 13 at 03:26 PM
0

See my response to Cornelia for the solution I applied.

Share
10 |10000 characters needed characters left characters exceeded
Cornelia Lezoch Apr 11 at 11:43 AM
0

Hi Eric,

do you have data records already before you start the function or is the result set empty?

becasue if there are no data records available to be read, the function never reaches the "... refdata" loop.

if there are already records in the result set AND records in refdata,

put after this command

FOREACH CH_REF, IP_REF, AG_REF, CG_REF, VER_REF IN REFDATA.

and additional

IF { one key figure tuple from refdata which will be available} <> 0.

then your code...

ENDIF.

regards

Cornelia

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thank you Cornelia. Each of the infoproviders in this aggregation level have data. I'm still mystified.

I eventually found my way back to the help for this loop and discovered "FOREACH ... IN INFOPROVIDER". There is another aggregation level based solely on the infoprovider I needed. I added the following declaration:

INFOPROVIDER ZCOP_AL02.

And now my inner loop reads:

FOREACH CH_REF, AG_REF, CG_REF, VER_REF IN ZCOP_AL02.
IF CH_TAR = CH_REF AND AG_TAR = AG_REF AND CG_TAR = CG_REF AND VER_TAR = VER_REF.
{ ZPRPOL, CH_TAR, AG_TAR, CG_TAR, VER_TAR } =
{ ZBASERATE, CH_TAR, AG_TAR, CG_TAR, VER_TAR } +
ZCOP_AL02.{ ZRA_SBL01, CH_REF, AG_REF, CG_REF, VER_REF } +
ZCOP_AL02.{ ZRA_CAM01, CH_REF, AG_REF, CG_REF, VER_REF } +
ZCOP_AL02.{ ZRA_CMA01, CH_REF, AG_REF, CG_REF, VER_REF }.
ENDIF.
ENDFOR.

Thanks again.

Best Regards,

Eric

0