on 2017 Jan 05 11:43 PM
Hello Experts.
I am developing a script logic to copy data from one company to another. but I have some problems with the Logic.
The requirement is the next:
Company A has payroll but company B pays for it. I already have payroll Planned in company A so I need to move it to company B to Differents Company Code, Profit Ctr, Cost Ctr, Hotel Here is my Code:
//Scope
*XDIM_MEMBERSET CATEGORIA = Presupuesto
*XDIM_MEMBERSET OP_SUPUESTOS= NA_SUP
*XDIM_MEMBERSET ZRELACIONCTACEBE= NA_ZREL
*XDIM_MEMBERSET ZSTAGL= NA_ES
*XDIM_MEMBERSET CUENTAS= 0000611010
*XDIM_MEMBERSET PERIODO= %PERIODO_SET%
//Selección de año
*SELECT(%YRS%,"[YEAR]",PERIODO,"[ID]='%PERIODO_SET%'")
*SELECT(%MNTH12%,"[ID]",PERIODO,"[YEAR]='%YRS%' AND [PERIOD]='DEC'")
*SELECT(%YR%,"[YEAR]",PERIODO,"[ID]='%MNTH12%'")
// SUPUESTOS DE NÓMINA CON MONEDA NA Y ESTÁN SOLAMENTE EN EL MES DE DICIEMBRE
// Some of SUPNOM (Benefits) are just in december, and doens't have currency so the user have to capture just once and I have to tranlate them to the other company in MXN.
*WHEN MONEDA
*IS NA_MONEDA
*WHEN OP_RRHH
*IS <>NA_RH
*WHEN SOCIEDAD
*IS 1040
*WHEN HOTEL
*IS "0000001040"
*WHEN SUPNOM
*IS CIAA
*FOR %T%= 01.%YR%, 02.%YR%, 03.%YR%, 04.%YR%, 05.%YR%, 06.%YR%, 07.%YR%, 08.%YR%, 09.%YR%, 10.&%YR%, 11.&%YR%, 12.%YR%
*FOR %NOM% = SVID, GMED,COVA, DESP, COEM, FOAH, AGUI, PDOM, PRAS, PVAC, SAR0, INFO
//Profitctr CEBE and CostCenter Ceco composition is for source 001040(company) + employee and for target in this case is 000504(companyB + last 2 of company A 40 in this case but since PUesto already has the 0 I skip it since it comes with CECP property ZL4CECO.
//
*SELECT (%CTA%, CUENTA, SUPNOM, [ID]=%NOM%)
*SELECT (%PUESTOS%, ZL4CECO, CECO,COMP_CODE=1040)
*FOR %PUESTO%=%PUESTOS%
*REC(EXPRESSION=%VALUE%==1050? ([SUPNOM].[%NOM%],[PERIODO].[12.%YR%]):0,CEBE="000504"%PUESTO%, MONEDA=MXN, CECO= "000504"%PUESTO%, HOTEL= 0000001050, SOCIEDAD= 1050, SUPNOM=NA_SUPRH, CUENTAS= %CTA%, PERIODO=%T%, CATEGORIA=Presupuesto)
*NEXT
*NEXT
*NEXT
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
//This SUPNOM are capture by month in currency MXN
*WHEN MONEDA
*IS MXN
*WHEN OP_RRHH
*IS <>NA_RH
*WHEN SOCIEDAD
*IS 1040
*WHEN HOTEL
*IS 0000001040
*WHEN SUPNOM
*IS CIAA
*FOR %NOM1% = GRATIF, COMS, CEXT, IMSS, INOM, DFES, TEXT
*SELECT (%CTA1%, CUENTA, SUPNOM, ID=%NOM1%)
*SELECT (%PUESTOS1%, ZL4CECO, CECO, COMP_CODE=1040)
*FOR %PUESTO1%= %PUESTOS1%
*REC(EXPRESSION=%VALUE%==1050? ([SUPNOM].[%NOM1%]):0, CEBE="000504"%PUESTO1%, CECO= "000504"%PUESTO1%, HOTEL= 0000001050, SOCIEDAD= 1050, SUPNOM=NA_SUPRH, CUENTAS= %CTA1%, CATEGORIA=Presupuesto)
*NEXT
*NEXT
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
I run this script in TCODE ujkt and I get the error that "Component "" does not exist.
Any ideas.
Best regards.
Also I see the main issue: You can't use SELECT inside FOR/NEXT - SELECT is executed only once!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please read help about SELECT:
"The SELECT instruction is not specific to a given logic section, but it can be written once anywhere in the logic and used across multiple commit sections."
Thank you very much for this, now I see what I need to change. Therfore I guess the correct Question would be for issue 2.
2. How to set a dynamic Dimension Property as Dimension Member in *REC? In this case I have to set CUENTAS= SUPNOM.%NOM%.CUENTA, WHAT WOULD BE THE CORRECT SYNTAXIS. ?
1. Since I don't have a scope for CosCenter and ProfitCenter how to use the actual cost center and profit center property that is using the script?
Would that be the correct Question? to open another post?
Thank you, just one little detail, the *rec is not for all SUPNOM dimension members, just the ones in the for:
*FOR %NOM1% = GRATIF, COMS, CEXT, IMSS, INOM, DFES, TEXT
Do you think *REC(...CUENTAS= ([SUPNOM].[%NOM1%]).CUENTAS will work?
I am testing, but I also need to check the other part to make the full test.
😄
Thank you Vadim,
Well the requirement is Company Code 40 has the payroll planed, I have to pass that planned payroll to the company 50 that is the company that pays.
I have the next dimensions fixed in the scope
Categoria: Presupuesto ( budget)
Moneda: MXN
Op supuestos: NA_SUP
Zrel: NA_ZREL
Zstagl : NA_ZSTAGL
Cuentas: 611010 //this account is where all the payroll is planned).
On the other Hand I have
Company: code that needs to change from 40 to 50
Cuentas: ( Accounts) that needs to be according the dimension supnom.
SUPNOM. -> This makes reference to payroll details for example: insurarce, vacations, etc.
Hotel: Is the building becaus 40 is an admin Comany Code.
CECO and CEBE, are Cost Center and Profit Center.
this is where I have most of the problems. Well this and accoutn.
OP_RRHH: it is the employee
For Account it makes reference to the Dimension SUPNOM Property CUENTA.
for CECO and CEBE, for instance
a CECO in 40 is 0001040111 for company 50 has to be 0005040111 is tha same for the profit Center. In the posted Code from:
WHEN MONEDA*IS NA_MONEDA
*WHEN OP_RRHH
*IS<>NA_RH
*WHEN SOCIEDAD
*IS1040*WHEN HOTEL
*IS"0000001040"*WHEN SUPNOM
*IS CIAA
*FOR%T%=01.%YR%,02.%YR%,03.%YR%,04.%YR%,05.%YR%,06.%YR%,07.%YR%,08.%YR%,09.%YR%,10.&%YR%,11.&%YR%,12.%YR%
*FOR %NOM% = SVID, GMED,COVA, DESP, COEM, FOAH, AGUI, PDOM, PRAS, PVAC, SAR0, INFO
Here I scope the records that user captured in a template to pass from company 40 to 50. This values doesn't have Currency NA_RH is the employee and I use the for because i have that SUPNOM (payroll details) that I need to fill with a record.
The second part is pretty much the same but it has the SUPNOM capture for each month and it has currency so i don't need the %T%.
What I am having problems with is the logic to convert for instead
CECO= 0001040111 to CECO= 0005040111.
It has to be for each employee ( the last 3 digits makes reference to the employe and are part of a CECO Porperty. That is the reason I was looking how to set 000504 as fixed + the property dinamic 0111.
Is anything wrong in the logic?
Hello Vadim,
This answer is to the last comment, I couldn't post for the other.
As I posted later I have 12 Dimensions. I have to practically copy the data from about 5 company codes to other 3 depending on Signeddata. This signeddata is in one dimension member of dimension SUPNOM. The member is called Compay. The user capture to wich company the data needs to be copy:
I have companies:
10
20
30
40
41
Where the data is already planned. I need to post that data to companies:
50, 51 or 52, depending on the signeddata captured by the user on memer Company. (user capture 50, 51 or 52 depending on the employee. )
The only dimension members that change during the copy -paste information is:
CECO (Cost Center) , CEBE (Profit Center) and CUENTA(Account). In the last case the account is a property of the Dimension SUPNOM. so for instance if I have in Company 40 that employee 111 gets paid for vacations let say 100, for insurance 200, for other reason 300. I have to copy - paste those records to company 50.
What do I see in company 40:
Categora= Presupuesto
Moneda = NA_MONEDA
OP_Supuestos: NA_SUP
ZREL: NA_ZREL
ZSTAGL: NA_ZSTAGL
Cuentas (Account): 611010
Company Code: 40
CECO: 1040111
CEBE: 1040111
HOTEL: 0000001040
RRHH: 111
SUPNOM: Dynamic (Has multiple values: insurance, vacations... etc)
How should I do the compy paste
If Company is 50:
Categoria= Presupuesto
Moneda= MXN (always fixed)
OP_SUPUESTOS: NA_SUP (always fixed)
ZREL: NA_ZREL (always fixed)
ZSTAGL: NA_ZSTAGL( always fixed)
Cuentas: (depends of supnom property CUENTA)
Company Code: 50 (if signeddata for company is 50 could be 51 or 52)
CECO: 5040111 (if you see the structure is company 50 (target), 40 (source) +dimension RRHH. last 4 digits
CEBE: same as CECO.
Hotel: 0000001050 ( when CC is 50 when 51 it changes aswell as when it is 52)
RRHH: NA_RRHH (always fixed)
SUPNOM: ( NA_SUPNOM) always fixed.
If you see the main changes are for CECO, CEBE and account.
I have the script to record the CECO depending on a variable, as well as the CEBE and ACCOUNT. What I can't do is getting dynamically the value of CECO, CEBE and Account as you could see.
I am setting the CECO as it is: 000504 (fixed value) + variable. The sem for CEBE.
For account I am coding SUPNOM.CUENTA since is a property of S]UPNOM.
Is it more clear to suggest what is wrong with the logic'?
Thank you very much for your help and orientation .
Best regards.
Still not 100% clear:
"captured by the user on memer Company. (user capture 50, 51 or 52 depending on the employee. )" what member? what dimension?
In general the required logic can be implemented in custom logic badi, not sure that script logic can do the job.
User | Count |
---|---|
8 | |
5 | |
2 | |
2 | |
1 | |
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.