Skip to Content
0

SL Question BPC 10,1 for NW

Jan 05, 2017 at 11:43 PM

111

avatar image

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. 
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Vadim Kalinin Jan 06, 2017 at 04:59 PM
1

Also I see the main issue: You can't use SELECT inside FOR/NEXT - SELECT is executed only once!

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

Please read help about SELECT:

http://help.sap.com/saphelp_bopacnw101/helpdata/en/77/b5be0a7ff947ab9e98b5e60e17ec2e/content.htm?frameset=/en/82/f51cf12cfc48c58975b9b5e6fba9aa/frameset.htm¤t_toc=/en/82/f51cf12cfc48c58975b9b5e6fba9aa/plain.htm&node_id=192

"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."

0

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?

0

Instead of:

*SELECT (%CTA%, CUENTA, SUPNOM, ID=%NOM%)
*REC(...CUENTAS= %CTA%...

use:

*REC(...CUENTAS=SUPNOM.CUENTA...)

0

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.

:D

0

Sorry but your syntax is incorrect, correct syntax is from my previous post. And without understanding the logic of your script I am unable to help better.

0

P.S. I think the whole script has to be written in the different way.

0
Show more comments

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?

0
Show more comments
Vadim Kalinin Jan 06, 2017 at 04:57 PM
1

Concatenation:

Not:

CEBE="000504"%PUESTO1%,...

But:

CEBE=000504%PUESTO1%,...
Share
10 |10000 characters needed characters left characters exceeded
Vadim Kalinin Jan 06, 2017 at 07:41 AM
0

Hi Sebastian,

Unfortunately this question is from category: "Do my job instead of me"

You have to simplify the script to some test case...

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

Hello Vadim,

Thank you for you post. I am testing the code in TCODE UJKT and I am changing it and reviewing line by line, in fact I am also cheching ratios in RSA1 to check what happened. I am sorry if the post category seems as you say "Do my job .." my intention was an orientation on where to focus. A comment like: you are doing it wrong, pay attention in line yy for example. I think I am using expression are not allowed, that is why I posted all the code, I am going to test something I suspect is wrong and submit againt.

I appreciate your time.

Thank you for the post. I didn't know it was the impression my post caused.

Best regards.

0

Thank you again, I was doing more testing and I have 2 issues.

1. My question is how to concatenate properties to with a prefix to a Dimension. I have search that in the forum but is not answered. I have the next piece of code, but is not lettingme do the concatenation:

*SELECT (%PUESTOS1%, ZL4CECO, CECO, COMP_CODE=1040) // This selects last 4 digits of CostCenter when the company Code is the Source (1040). ZL4CECO is the ID of the property that cotains that last 4 Digits.


*FOR %PUESTO1%= %PUESTOS1% // Since I have a bunch of las 4 digits I am using a loop to make it one by one the selection.


*REC(EXPRESSION=%VALUE%==1050? ([SUPNOM].[%NOM1%]):0, CEBE="000504"%PUESTO1%, CECO= "000504"%PUESTO1%, HOTEL= 0000001050, SOCIEDAD= 1050, SUPNOM=NA_SUPRH, CUENTAS= %CTA1%, CATEGORIA=Presupuesto)
//Here in the Rec I trying to  generatethe record in CEBE and CECO with the fixed text "000504"%PUESTO% Whis the value is in the select one by one. I have tried: "000504"%PUESTO%, 000504%PUESTO%, 000504&%PUESTO% but it doesn't work.

2. I have another Select to select a property called CUENTA (Account) that is a real GL Account where the Benefit is supoused to store:

I checked that all dimensions Members in Dimension SuPnom has the property CUENTA with a value. I have the next piece of code:

*FOR %NOM1% = GRATIF, COMS, CEXT, IMSS, INOM, DFES, TEXT
*SELECT (%CTA1%, CUENTA, SUPNOM, ID=%NOM1%)

then in the *REC i have:

*FOR %NOM% = SVID, GMED,COVA, DESP, COEM, FOAH, AGUI, PDOM, PRAS, PVAC, SAR0, INFO
*SELECT (%CTA%, CUENTA, SUPNOM, ID=%NOM%)
*SELECT (%PUESTO%, 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%)

If you see in the Dimension CUENTAS=%CTA% my intention is to store the property value of SUPNOM for the Dimensions member that are in the for.

I discovered by setting fixed CECO and CEBE that the error that the component "" does not exist was for the account. Seems that is not taking any value.

By setting the account fixed I found out issue 1. Where it doens't let me concatenate the fixed value and with the variable %PUESTO%.

Is something wrong in the select for %CTA%? is there a way to concatenate that variable with the fixed value?

Best regards.

0