Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ABAP codification

Hi all,

I'm working in the "MD-PErson key routine" and when i verifies it, the system will send the following message: u201CE:Statement "AND" is not defined. Check your spelling. spelling.

spelling. spelling.u201D I checked the parts of the routines where AND is appeared, but i didn't find any mistake..Could you help me?

thanks in advance,

the code:

ROGRAM UPDATE_ROUTINE.

$$ begin of global - insert your declaration only below this line -

  • TABLES: ...

  • DATA: ...

TYPES: BEGIN OF S_PYD1A,

EMPLOYEE TYPE /BIC/AHRPY_D0100-EMPLOYEE,

CALMONTH TYPE /BIC/AHRPY_D0100-CALMONTH,

END OF S_PYD1A.

TYPES: BEGIN OF S_PYD1B,

EMPLOYEE TYPE /BIC/AHRPY_D0100-EMPLOYEE,

CALMONTH TYPE /BIC/AHRPY_D0100-CALMONTH,

COUNTRY_ID TYPE /BIC/AHRPY_D0100-COUNTRY_ID,

WAGETYPE TYPE /BIC/AHRPY_D0100-WAGETYPE,

CURRENCY TYPE /BIC/AHRPY_D0100-CURRENCY,

AMOUNT TYPE /BIC/AHRPY_D0100-AMOUNT,

RTNUM TYPE /BIC/AHRPY_D0100-RTNUM,

END OF S_PYD1B.

DATA: T_PYD1A TYPE TABLE OF S_PYD1A WITH HEADER LINE.

DATA: T_PYD1B TYPE SORTED TABLE OF S_PYD1A WITH UNIQUE KEY EMPLOYEE

CALMONTH WITH HEADER LINE.

DATA: T_PYD1C TYPE SORTED TABLE OF S_PYD1B WITH UNIQUE KEY EMPLOYEE

CALMONTH COUNTRY_ID WAGETYPE WITH HEADER LINE.

DATA: V_EMP LIKE /BIC/AHRPY_D0100-EMPLOYEE.

DATA: V_EMP_I LIKE /BIC/AHRPY_D0100-EMPLOYEE.

DATA: V_EMP_F LIKE /BIC/AHRPY_D0100-EMPLOYEE.

DATA: V_MES LIKE /BIC/AHRPY_D0100-CALMONTH.

DATA: V_MES_I LIKE /BIC/AHRPY_D0100-CALMONTH.

DATA: V_MES_F LIKE /BIC/AHRPY_D0100-CALMONTH.

DATA: V_TEO TYPE I.

DATA: V_RTN TYPE /BIC/AHRPY_D0100-RTNUM.

TYPES: BEGIN OF S_EMP,

EMPLOYEE TYPE /BI0/MEMPLOYEE-EMPLOYEE,

DATETO TYPE /BI0/MEMPLOYEE-DATETO,

DATEFROM TYPE /BI0/MEMPLOYEE-DATEFROM,

CNTRCTTYPE TYPE /BI0/MEMPLOYEE-CNTRCTTYPE,

COMP_CODE TYPE /BI0/MEMPLOYEE-COMP_CODE,

CO_MST_AR TYPE /BI0/MEMPLOYEE-CO_MST_AR,

EMPLGROUP TYPE /BI0/MEMPLOYEE-EMPLGROUP,

EMPLSGROUP TYPE /BI0/MEMPLOYEE-EMPLSGROUP,

EMPLSTATUS TYPE /BI0/MEMPLOYEE-EMPLSTATUS,

ENTRYDATE TYPE /BI0/MEMPLOYEE-ENTRYDATE,

ESGFORCAP TYPE /BI0/MEMPLOYEE-ESGFORCAP,

HRPOSITION TYPE /BI0/MEMPLOYEE-HRPOSITION,

JOB TYPE /BI0/MEMPLOYEE-JOB,

MAST_CCTR TYPE /BI0/MEMPLOYEE-MAST_CCTR,

ORGUNIT TYPE /BI0/MEMPLOYEE-ORGUNIT,

PAYRL_AREA TYPE /BI0/MEMPLOYEE-PAYRL_AREA,

PAYSCALEAR TYPE /BI0/MEMPLOYEE-PAYSCALEAR,

PAYSCALEGR TYPE /BI0/MEMPLOYEE-PAYSCALEGR,

PAYSCALELV TYPE /BI0/MEMPLOYEE-PAYSCALELV,

PAYSCALETY TYPE /BI0/MEMPLOYEE-PAYSCALETY,

PERS_AREA TYPE /BI0/MEMPLOYEE-PERS_AREA,

PERS_SAREA TYPE /BI0/MEMPLOYEE-PERS_SAREA,

SALARYAR TYPE /BI0/MEMPLOYEE-SALARYAR,

SALARYGR TYPE /BI0/MEMPLOYEE-SALARYGR,

SALARYLV TYPE /BI0/MEMPLOYEE-SALARYLV,

SALARYTY TYPE /BI0/MEMPLOYEE-SALARYTY,

/BIC/HRIDCON TYPE /BI0/MEMPLOYEE-/BIC/HRIDCON,

END OF S_EMP.

DATA: T_EMP TYPE SORTED TABLE OF S_EMP WITH UNIQUE KEY EMPLOYEE DATETO

DATEFROM WITH HEADER LINE.

TYPES: BEGIN OF S_ANT,

EMPLOYEE TYPE /BI0/MEMPLOYEE-EMPLOYEE,

DATETO TYPE /BI0/MEMPLOYEE-DATETO,

DATEFROM TYPE /BI0/MEMPLOYEE-DATEFROM,

JOB TYPE /BI0/MEMPLOYEE-JOB,

ORGUNIT TYPE /BI0/MEMPLOYEE-ORGUNIT,

END OF S_ANT.

DATA: T_ANT_A TYPE TABLE OF S_ANT WITH HEADER LINE.

DATA: T_ANT_B TYPE TABLE OF S_ANT WITH HEADER LINE.

DATA: T_ANP TYPE SORTED TABLE OF S_ANT WITH UNIQUE KEY EMPLOYEE DATETO

DATEFROM WITH HEADER LINE.

DATA: T_ANC TYPE SORTED TABLE OF S_ANT WITH UNIQUE KEY EMPLOYEE DATETO

DATEFROM WITH HEADER LINE.

TYPES: BEGIN OF S_PER,

PERSON TYPE /BI0/MPERSON-PERSON,

DATETO TYPE /BI0/MPERSON-DATETO,

DATEFROM TYPE /BI0/MPERSON-DATEFROM,

CITY TYPE /BI0/MPERSON-CITY,

COUNTRY TYPE /BI0/MPERSON-COUNTRY,

DATEBIRTH TYPE /BI0/MPERSON-DATEBIRTH,

GENDER TYPE /BI0/MPERSON-GENDER,

NATION TYPE /BI0/MPERSON-NATION,

PERSLANGU TYPE /BI0/MPERSON-PERSLANGU,

POSTAL_CD TYPE /BI0/MPERSON-POSTAL_CD,

REGION TYPE /BI0/MPERSON-REGION,

END OF S_PER.

DATA: T_PER TYPE SORTED TABLE OF S_PER WITH UNIQUE KEY PERSON DATETO

DATEFROM WITH HEADER LINE.

TYPES: BEGIN OF S_PLD,

EMPLOYEE TYPE /BIC/AHRPD_D0100-EMPLOYEE,

/BIC/HR_B_PLDE TYPE /BIC/AHRPD_D0100-/BIC/HR_B_PLDE,

DATETO TYPE /BIC/AHRPD_D0100-DATETO,

DATEFROM TYPE /BIC/AHRPD_D0100-DATEFROM,

END OF S_PLD.

DATA: T_PLD TYPE SORTED TABLE OF S_PLD WITH UNIQUE KEY EMPLOYEE

/BIC/HR_B_PLDE DATETO DATEFROM WITH HEADER LINE.

TYPES: BEGIN OF S_ORG,

ORGUNIT TYPE /BI0/MORGUNIT-ORGUNIT,

DATETO TYPE /BI0/MORGUNIT-DATETO,

DATEFROM TYPE /BI0/MORGUNIT-DATEFROM,

/BIC/HRTIPCEN TYPE /BI0/MORGUNIT-/BIC/HRTIPCEN,

/BIC/HRSTIPCEN TYPE /BI0/MORGUNIT-/BIC/HRSTIPCEN,

COUNTRY TYPE /BI0/MORGUNIT-COUNTRY,

REGION TYPE /BI0/MORGUNIT-REGION,

/BIC/HRCATEGOR TYPE /BI0/MORGUNIT-/BIC/HRCATEGOR,

CITY TYPE /BI0/MORGUNIT-CITY,

/BIC/HR_SITUAC TYPE /BI0/MORGUNIT-/BIC/HR_SITUAC,

END OF S_ORG.

DATA: T_ORG TYPE SORTED TABLE OF S_ORG WITH UNIQUE KEY ORGUNIT DATETO

DATEFROM WITH HEADER LINE.

TYPES: BEGIN OF S_OR0,

/BIC/C_ORGUNIT TYPE /BIC/MC_ORGUNIT-/BIC/C_ORGUNIT,

DATETO TYPE /BIC/MC_ORGUNIT-DATETO,

DATEFROM TYPE /BIC/MC_ORGUNIT-DATEFROM,

/BIC/C_ORG_DT TYPE /BIC/MC_ORGUNIT-/BIC/C_ORG_DT,

/BIC/C_ORG_DG TYPE /BIC/MC_ORGUNIT-/BIC/C_ORG_DG,

/BIC/C_ORG_DAN TYPE /BIC/MC_ORGUNIT-/BIC/C_ORG_DAN,

END OF S_OR0.

DATA: T_OR0 TYPE SORTED TABLE OF S_OR0 WITH UNIQUE KEY /BIC/C_ORGUNIT

DATETO DATEFROM WITH HEADER LINE.

TYPES: BEGIN OF S_CC0,

COUNTRY_ID TYPE /BIC/MC_LGART_1-COUNTRY_ID,

/BIC/C_LGART_1 TYPE /BIC/MC_LGART_1-/BIC/C_LGART_1,

DATETO TYPE /BIC/MC_LGART_1-DATETO,

DATEFROM TYPE /BIC/MC_LGART_1-DATEFROM,

CHRT_ACCTS TYPE /BIC/MC_LGART_1-CHRT_ACCTS,

GL_ACCOUNT TYPE /BIC/MC_LGART_1-GL_ACCOUNT,

END OF S_CC0.

DATA: T_CC0 TYPE SORTED TABLE OF S_CC0 WITH UNIQUE KEY COUNTRY_ID

/BIC/C_LGART_1 DATETO DATEFROM WITH HEADER LINE.

DATA V_DA0_I TYPE RSCALDAY.

DATA V_DA0_F TYPE RSCALDAY.

DATA V_ORG_I LIKE /BI0/MORGUNIT-ORGUNIT.

DATA V_ORG_F LIKE /BI0/MORGUNIT-ORGUNIT.

DATA V_ORG LIKE /BI0/MORGUNIT-ORGUNIT.

DATA V_EMP_DF TYPE RSCALDAY.

DATA V_PLD_DF TYPE RSCALDAY.

DATA V_PER_DF TYPE RSCALDAY.

DATA V_ORG_DF TYPE RSCALDAY.

DATA V_OR0_DF TYPE RSCALDAY.

DATA V_AGE_DF TYPE RSCALDAY.

DATA V_VAL_DF TYPE RSCALDAY.

DATA V_AGE TYPE I.

DATA V_AGE_R TYPE I.

DATA V_ANE TYPE I.

DATA V_ANP TYPE I.

DATA V_ANC TYPE I.

$$ end of global - insert your declaration only before this line -

FORM compute_key_field

TABLES MONITOR STRUCTURE RSMONITOR "user defined monitoring

USING COMM_STRUCTURE LIKE /BIC/CS8HRPY_D02

RECORD_NO LIKE SY-TABIX

RECORD_ALL LIKE SY-TABIX

SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS

CHANGING RESULT LIKE /BIC/VHRPY_C01T-GENDER

RETURNCODE LIKE SY-SUBRC

ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update

*

$$ begin of routine - insert your code only below this line -

  • fill the internal table "MONITOR", to make monitor entries

IF V_EMP IS INITIAL OR V_EMP NE COMM_STRUCTURE-EMPLOYEE.

V_EMP = COMM_STRUCTURE-EMPLOYEE.

CLEAR V_EMP_DF.

CLEAR V_PER_DF.

CLEAR V_PLD_DF.

CLEAR V_AGE_DF.

CLEAR V_AGE.

CLEAR V_AGE_R.

CLEAR V_VAL_DF.

CLEAR V_ANE.

CLEAR V_ANP.

CLEAR V_ANC.

ENDIF.

IF V_ORG IS INITIAL OR V_ORG NE T_EMP-ORGUNIT.

V_ORG = T_EMP-ORGUNIT.

CLEAR V_ORG_DF.

CLEAR V_OR0_DF.

ENDIF.

IF V_EMP_DF LT '18000101'.

CLEAR T_EMP.

LOOP AT T_EMP WHERE EMPLOYEE = COMM_STRUCTURE-EMPLOYEE AND

DATETO GE '18000101'

AND DATEFROM LE '18000101'.

V_EMP_DF = T_PER-DATETO.

EXIT.

ENDLOOP.

ENDIF.

IF V_VAL_DF NE '18000101'.

V_VAL_DF = '18000101'.

IF T_EMP-ENTRYDATE IS NOT INITIAL.

CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'

EXPORTING I_DATE_FROM = T_EMP-ENTRYDATE I_DATE_TO = V_VAL_DF

"I_FLG_SEPARATE = ' '

IMPORTING E_DAYS = V_ANE.

"E_MONTHS = L_MONTHS. E_YEARS = EYEARS.

ENDIF.

CLEAR T_ANP.

LOOP AT T_ANP WHERE EMPLOYEE = COMM_STRUCTURE-EMPLOYEE AND

DATEFROM LE '18000101'AND

JOB = '18000101'.

ENDLOOP.

IF T_ANP-DATEFROM IS NOT INITIAL.

CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'

EXPORTING I_DATE_FROM = T_ANP-DATEFROM I_DATE_TO = V_VAL_DF

"I_FLG_SEPARATE = ' '

IMPORTING E_DAYS = V_ANP.

"E_MONTHS = L_MONTHS. E_YEARS = EYEARS.

ENDIF.

CLEAR T_ANC.

LOOP AT T_ANC WHERE EMPLOYEE = COMM_STRUCTURE-EMPLOYEE AND

DATEFROM LE '18000101' AND

ORGUNIT = T_EMP-ORGUNIT.

ENDLOOP.

IF T_ANC-DATEFROM IS NOT INITIAL.

CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'

EXPORTING I_DATE_FROM = T_ANC-DATEFROM I_DATE_TO = V_VAL_DF

"I_FLG_SEPARATE = ' '

IMPORTING E_DAYS = V_ANC.

"E_MONTHS = L_MONTHS. E_YEARS = EYEARS.

ENDIF.

ENDIF.

IF V_PER_DF LT '18000101'.

CLEAR T_PER.

LOOP AT T_PER WHERE PERSON = COMM_STRUCTURE-EMPLOYEE AND

DATETO GE '18000101' AND

DATEFROM LE '18000101'.

V_PER_DF = T_PER-DATETO.

EXIT.

ENDLOOP.

ENDIF.

IF V_PLD_DF LT '18000101'.

CLEAR T_PLD.

LOOP AT T_PLD WHERE EMPLOYEE = COMM_STRUCTURE-EMPLOYEE AND

DATETO GE '18000101' AND

DATEFROM LE '18000101'.

V_PLD_DF = T_PER-DATETO.

EXIT.

ENDLOOP.

ENDIF.

IF V_ORG_DF LT '18000101'.

CLEAR T_ORG.

LOOP AT T_ORG WHERE ORGUNIT = T_EMP-ORGUNIT AND

DATETO GE '18000101' AND

DATEFROM LE '18000101'.

V_ORG_DF = T_ORG-DATETO.

EXIT.

ENDLOOP.

ENDIF.

IF V_OR0_DF LT '18000101'.

CLEAR T_OR0.

LOOP AT T_OR0 WHERE /BIC/C_ORGUNIT = T_EMP-ORGUNIT AND

DATETO GE '18000101' AND

DATEFROM LE '18000101'.

V_OR0_DF = T_OR0-DATETO.

EXIT.

ENDLOOP.

ENDIF.

CLEAR T_CC0.

LOOP AT T_CC0 WHERE COUNTRY_ID = COMM_STRUCTURE-COUNTRY_ID

AND /BIC/C_LGART_1 = COMM_STRUCTURE-WAGETYPE

AND DATETO GE '18000101'.

AND DATEFROM LE '18000101'.

EXIT.

ENDLOOP.

IF V_AGE_DF LT '18000101'AND T_PER-DATEBIRTH IS NOT INITIAL

.

" Calculamos edad y lo guardamos en variable para reuso posterior.

V_AGE = '18000101'0(4) - T_PER-DATEBIRTH0(4).

CONCATENATE '18000101'0(4) T_PER-DATEBIRTH4(4) INTO

V_AGE_DF.

IF '18000101'4(4) LT T_PER-DATEBIRTH4(4).

V_AGE = V_AGE - 1.

SUBTRACT 1 FROM V_AGE_DF.

ELSE.

ADD 364 TO V_AGE_DF.

ENDIF.

IF V_AGE LT 25. V_AGE_R = 1.

ELSEIF V_AGE LT 30. V_AGE_R = 2.

ELSEIF V_AGE LT 35. V_AGE_R = 3.

ELSEIF V_AGE LT 40. V_AGE_R = 4.

ELSEIF V_AGE LT 45. V_AGE_R = 5.

ELSEIF V_AGE LT 50. V_AGE_R = 6.

ELSEIF V_AGE LT 55. V_AGE_R = 7.

ELSEIF V_AGE LT 60. V_AGE_R = 8.

ELSE. V_AGE_R = 9.

ENDIF.

ENDIF.

  • result value of the routine

RESULT = T_PER-GENDER.

$$ end of routine - insert your code only before this line -

Former Member
Not what you were looking for? View more on this topic or Ask a question