on 2015 Sep 28 8:42 AM
Hi all,
We have the following scenario where we want to use RunLogic_PH:
We want to copy data from one model to another.
We want to copy LAB to MIS, but run it from MIS.
The model LAB uses Cost Center as an Entity type dimension, but MIS uses Profit Center as the Entity type dimension.
The logic in MIS:
AMPS_MIS_LAB_TO_MIS
*START_BADI RUNLOGIC_PH
QUERY = OFF
WRITE = ON
DEBUG = OFF
APPSET = AMPS
APP = AMPS_LAB
LOGIC = AMPS_HC_LAB_TO_MIS.LGF
DIMENSION CATEGORY = %CATEGORY_SET%
DIMENSION TIME = %TIME_SET%
//DIMENSION ZPROFIT_CENTRE = %ZPROFIT_CENTRE_SET%
//DIMS in LAB not in MIS
DIMENSION COST_CENTRE = <ALL>
DIMENSION COST_ELEMENT = <ALL>
DIMENSION DISCIPLINE = <ALL>
DIMENSION HALF_LEVEL = <ALL>
DIMENSION JOBS = <ALL>
DIMENSION PATTERSON = <ALL>
DIMENSION REEF_OFF_REEF = <ALL>
DIMENSION SHIFTS = <ALL>
//DIMS in MIS not in LAB
DIMENSION OP_ACCOUNT = <NONE>
DIMENSION CUSTOMER = <NONE>
DIMENSION G_ACCOUNT = <NONE>
DIMENSION PRODUCT = <NONE>
DIMENSION SEGMENT = <NONE>
DIMENSION ZPROFIT_CENTRE = <NONE>
*END_BADI
This is calling the AMPS_HC_LAB_TO_MIS.LGF script:
AMPS_HC_LAB_TO_MIS
*XDIM_MEMBERSET CATEGORY = %CATEGORY_SET%
*XDIM_MEMBERSET TIME = %TIME_SET%
//*XDIM_MEMBERSET COST_CENTRE = %COST_CENTRE_SET%
*XDIM_MEMBERSET AMPS_VARIABLE= LCST_VLAB_HEAD_ATWRK,LCST_VLAB_HEAD_INSER
*DESTINATION_APP = AMPS_MIS
*SKIP_DIM = COST_CENTRE,COST_ELEMENT,DISCIPLINE,HALF_LEVEL,JOBS,PATTERSON,REEF_OFF_REEF,SHIFTS
*ADD_DIM OP_ACCOUNT=NO_OP_ACCOUNT,G_ACCOUNT=NO_G_ACCOUNT, SEGMENT=COST_CENTRE:SEGMENT, ZPROFIT_CENTRE=COST_CENTRE:PROFIT_CENTRE,CUSTOMER=NO_CUSTOMER,PRODUCT=NO_PRODUCT
*WHEN CATEGORY
*IS %CATEGORY_SET%
*REC(EXPRESSION=%VALUE%)
*ENDWHEN
*COMMIT
Cost Center in LAB has a property Profit Center.
From MIS, we want to run the RunLogic_PH to specify Profit Center, and all cost centers in LAB associated with the profit center must be copied, thus in the script it is ZPROFIT_CENTRE=COST_CENTRE:PROFIT_CENTRE.
This works when we run the script in the LAB model, but as soon as the RunLogic_PH is used in MIS, it gives an error.
It says that ZPROFIT_CENTRE does not exist in the LAB model.
When we add it, it says COST_CENTRE is not in the MIS model.
Is there a work around for this?
Thanks a million in advance!
Request clarification before answering.
Hi Jako,
Not clear: all "cost centers in LAB associated with the profit center must be copied, thus in the script it is ZPROFIT_CENTRE=COST_CENTRE:PROFIT_CENTRE"
Can you provide the full list of dimensions for both models and what do you have in COST_CENTRE properties: SEGMENT, PROFIT_CENTRE
I think the issue is here: DIMENSION COST_CENTRE = <ALL>
<ALL> will include members with incorrect properties!
use something like:
*SELECT(%CC%,[ID], COST_CENTRE,"[SEGMENT]<>'' AND [PROFIT_CENTRE]<>''")
then:
DIMENSION COST_CENTRE = %CC%
Vadim
P.S. If you mention "it gives an error." - screenshot of UJKT with error is required!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vadim,
Q - ""Not clear: all "cost centers in LAB associated with the profit center must be copied, thus in the script it is ZPROFIT_CENTRE=COST_CENTRE:PROFIT_CENTRE" ""
A - LAB uses Cost Centers as Entity. In MIS we want to select a Profit Center, Enitity, to copy all Cost Centers regarding the Profit Center, thus in in the script logic (AMPS_HC_LAB_TO_MIS) we use the line ZPROFIT_CENTRE=COST_CENTRE:PROFIT_CENTRE.
This works correctly when the script is run in LAB, but when the script is run via RunLogic_PH, it does not work.
Q - "Can you provide the full list of dimensions for both models and what do you have in COST_CENTRE properties: SEGMENT, PROFIT_CENTRE"
A:
| LAB Dimensions and Type | MIS Dimensions and Type | ||
| ACTIVITY | U - User defined | ACTIVITY | U - User defined |
| AMPS_VARIABLE | U - User defined | AMPS_VARIABLE | U - User defined |
| AUDITTRAIL | D - Audit | AUDITTRAIL | D - Audit |
| CATEGORY | C - Categry | CATEGORY | C - Categry |
| COST_CENTRE | E - Entity | CURR_TYPE | U - User defined |
| COST_ELEMENT | A - Account | CUSTOMER | U - User defined |
| CURR_TYPE | U - User defined | EXPENDITURE_TYPE | U - User defined |
| DISCIPLINE | U - User defined | G_ACCOUNT | U - User defined |
| EXPENDITURE_TYPE | U - User defined | LABOUR_TYPE | U - User defined |
| HALF_LEVEL | U - User defined | MINING_METHOD | U - User defined |
| JOBS | U - User defined | OP_ACCOUNT | A - Account |
| LABOUR_TYPE | U - User defined | PRODUCT | U - User defined |
| MINING_METHOD | U - User defined | PRODUCT_TYPE | U - User defined |
| PATTERSON | U - User defined | RPTCURRENCY | R - Currency |
| PRODUCT_TYPE | U - User defined | SEGMENT | U - User defined |
| REEF_OFF_REEF | U - User defined | TIME | T - Time |
| RPTCURRENCY | R - Currency | ZPROFIT_CENTER | E - Entity |
| SHIFTS | U - User defined | ||
| TIME | T - Time | ||
Cost Center Properties:
| ACTIVITY |
| CAP_OWNER |
| CAP_REVIEWER |
| COMPANY |
| CONTROL_LEVEL |
| COST_CENTRE_TYPE |
| CTRL_CURRENCY_NOT_LC |
| CURRENCY |
| DISCIPLINE |
| ELIMINATION |
| FI_OWNER |
| FI_REVIEWER |
| FUNCTION |
| FX_TYPE |
| GR_CURR |
| HR_OWNER |
| HR_REVIEWER |
| INTCO |
| LOCATION |
| MINING_METHOD |
| OWNER |
| PROD_OWNER |
| PROD_REVIEWER |
| PROFIT_CENTRE |
| REEF_TYPE |
| REGION |
| RESPONSIBILITY |
| RESP_OWNER |
| REVIEWER |
| SEGMENT |
| SHAFT |
| TYPE_OF_OPERATION |
Q - "
I think the issue is here: DIMENSION COST_CENTRE = <ALL>
<ALL> will include members with incorrect properties!
use something like:
*SELECT(%CC%,[ID], COST_CENTRE,"[SEGMENT]<>'' AND [PROFIT_CENTRE]<>''")
then:
DIMENSION COST_CENTRE = %CC%"
A - To derive the Cost Centers from the profit Center we used: "ZPROFIT_CENTRE=COST_CENTRE:PROFIT_CENTRE".
If the Profit Center is AP100, al Cost Centers with the Profit Center AP100 must be copied.
It is working perfectly fine in the LAB model when we assign the script to package, but once the script is called from MIS (using RunLogic_PH), it says that ZPROFIT_CENTRE does not exist in LAB.
If we add ZPROFIT_CENTRE by un-commenting the line in the script, (AMPS_MIS_LAB_TO_MIS
//DIMENSION ZPROFIT_CENTRE = %ZPROFIT_CENTRE_SET%) it says that Cost Center does not exist in MIS.
Comment - "P.S. If you mention "it gives an error." - screenshot of UJKT with error is required!"
Response - Our DEV and QA environment is down where we have the scripts to test.
Comment - "P.P.S. NEVER use COMMIT with WHEN/ENDWHEN - useless: Re: Transport of data from model to model"
Response - I know Vadim, and as in our discussion previously I agree 100% , but I did not write these two scripts, they just asked me to help because they are stuck.
Thanks for the reply,
Jaco de Kock
Sorry,
"I did not write these two scripts" - really bad answer! It's better to talk directly to script authors!
Issue:
"ZPROFIT_CENTRE=COST_CENTRE:PROFIT_CENTRE".
If the Profit Center is AP100, al Cost Centers with the Profit Center AP100 must be copied.
In LAB model you have COST_CENTER dimension and some of it's members has AP100 as a PROFIT_CENTRE property. AP100 is a valid member of ZPROFIT_CENTRE dimension in MIS model.
But if PROFIT_CENTRE property is empty or contain an invalid member then you will get an error!
Same for SEGMENT
Test script with proposed *SELECT and post UJKT results.
Vadim
Hi Jaco de Kock,
I can see 2 issues:
1. You have Model A as a source and Model B as a target. If DESTINATION_APP runs in Model A it will do what you want. If you run DESTINATION_APP in Model B (even calling it from Model A) it will move data from B to B.
2. If Dimension DDD is in Model A, but not in Model B you should have a line
DIMENSION DDD = <NONE> in RUNLOGIC call.
Regards,
Gersh
Hi Gersh,
I still think that the issue is due to the missing property values for some members!
1. Script with RUNLOGIC_PH is executed in MIS having:
APP = AMPS_LAB
...
DIMENSION COST_CENTRE = <ALL> //ALL Cost Ceners selected!!!
DIMENSION ZPROFIT_CENTRE = <NONE> //Correct - ZPROFIT_CENTRE is missing in LAB
2. Script with DESTINATION_APP is executed in LAB, having scope:
COST_CENTRE = <ALL> //passed by RUNLOGIC_PH
then:
*DESTINATION_APP = AMPS_MIS
...
*ADD_DIM ...,SEGMENT=COST_CENTRE:SEGMENT, ZPROFIT_CENTRE=COST_CENTRE:PROFIT_CENTRE
I think that when script with DESTINATION_APP was tested only some subset of COST_CENTRE members was used!
Vadim
| User | Count |
|---|---|
| 9 | |
| 8 | |
| 6 | |
| 3 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.