Skip to Content
0
May 16, 2013 at 05:53 PM

Leave Validation for ESS/MSS

350 Views

Dear All,

We are implementing ESS MSS on webdynpro abap.

Here the system is ECC 6.0 EHP 5.

As per the requirement we need to write the additonal validation for LEAVE and display error messages as per the validation in ESS SCREEN.

I found a document regarding the same, but one thing is not getting clear from there, so i am pasting the piece of code given in the document.

3. Business Add-Ins (BAdIs)

BAdI: Control Processing of Leave Requests


Implementation name: ZHRESS_CL_PT_ARQ_REQ

Methods: IF_EX_PT_ABS_REQ~SIMULATE_VIA_BLOP

IF_EX_PT_ABS_REQ~POST_VIA_BLOP

a. IF_EX_PT_ABS_REQ~SIMULATE_VIA_BLOP

Validations implemented in this method.


Half day leave check: time has to be either 10:30 to 14:15 or 14:15 to 18:00.

Maternity/Miscarriage Leave: Male employees are not allowed to apply for this type of leave.

Clubbing rules: ZHRPT_COMBINATN This table contains all the invalid clubbing rules.


To read current absence applied from ESS

**Read the current absence record

READ TABLE IM_ATTABS_TAB INTO ATTABS_TEMP INDEX 1.

READ TABLE ATTABS_TEMP-ABS_ATTRIBS INTO WA_ATTRIBS INDEX

Now WA_ATTRIBS will have all the details of the applied leave.


ZHRPT_COMBINATN: this table contains all the leave combinations which are not allowed in the

system.

PTREQ_ATTABSDATA: This table contains all the leaves applied and not

approved by the manager.

SELECT * FROM PTREQ_ATTABSDATA INTO CORRESPONDING FIELDS OF TABLE

I_ATTABSDATA

WHERE PERNR EQ WA_ATTRIBS-PERNR

AND INFOTYPE = '2001'

AND OPERATION = 'INS'

AND BEGDA GE V_DATE1

AND ENDDA LE V_DATE2.


Now check for the invalid combination. I_attabsdata contains all the sent

requests by the employee.


LOOP AT I_ATTABSDATA INTO WA_ATTABS.


**Check for invalid combination


SELECT SINGLE * FROM ZHRPT_COMBINATN INTO WA_COMBI

WHERE AWART1 EQ WA_ATTABS-SUBTY

AND AWART2 EQ WA_ATTRIBS-SUBTY.


**Now give message if you find a record. Please use this method only.

CALL METHOD MESSAGE_HANDLER->ADD_MESSAGE

EXPORTING

IM_TYPE = 'E'

IM_CL = 'HRTIM_ABS_REQ'

IM_NUMBER = '115'

IM_PAR1 = 'SIMULATE_VIA_BLOP'

IM_PAR2 = „IF_EX_PT_ABS_REQ~SIMULATE_VIA_BLOP'

IM_PAR3 = 'BLOP'

IM_CONTEXT = ''

IM_SUBCONTEXT = ''

IM_CLASSNAME = 'CL_PT_ARQ_BLOP_ADAPTER'

IM_METHODNAME = 'MESSAGE'

So here in this piece of code, i am not getting the table ZHRPT_COMBINATN which will contain the invalid combination of leaves.

How to create such table??

The link of the full document is: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/108c31e7-b6a7-2d10-3692-c1a9f7a5c4dc?QuickLink=index&overridelayout=true

Please help me guys!!!!

Regards,

Sujit Karn