cancel
Showing results for 
Search instead for 
Did you mean: 

Check for Greivence

Former Member
0 Kudos

Hi all,

I have to put a check on infotype 0102 - Grevience, on fields, Grevience number and stage ( p0102-GRNUM and p0102-GRSTG) as mentioned below .

1) If a user copies any existing record, and changes any field other than the grevience number and stage, and try to save it, then system should allow to save this value as it will overwrite the previous record for the same grevience number and stage.

2) If there are no changes in the record after copying,and if user tries to save it , then system should throw an error like" A record already exist for selected combination of Grievence Number and Stage. Please change the values."

Please advice how can i proceed for the same.

Thanks & Regards,

Ribhu

Accepted Solutions (1)

Accepted Solutions (1)

suresh_datti
Active Contributor
0 Kudos

You can use the AFTER_INPUT method of the BAdI HRPAD00INFTY. Goto SE19 & create an implementation for this BAdI definition & put your validations in the AFTER_INPUT method & activate.. you can put a break point in the method to test your code..

~Suresh

Former Member
0 Kudos

I am coding it all in user exit PBAS0001 - component - EXIT_SAPFP50M_002. Though The check is runnin fine but it is creating problems when it comes to change mode. When I am in the change mode, then also it si giving me the error ' 'A record already exist for selected combination of Grievence Number and Stage. Please change the values. Herez what i coded:

WHEN '0102'.

CALL METHOD CL_HR_PNNNN_TYPE_CAST=>PRELP_TO_PNNNN

EXPORTING

PRELP = INNNN

IMPORTING

PNNNN = I0102.

SELECT PERNR GRNUM GRSTG seqnr FROM PA0102 INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE PERNR = I0102-PERNR .

LOOP AT ITAB.

IF ITAB-GRNUM = I0102-GRNUM .

IF ITAB-GRSTG = I0102-GRSTG .

MESSAGE 'A record already exist for selected combination of Grievence Number and Stage. Please change the values.' TYPE 'E'.

ENDIF.

ENDIF.

ENDLOOP.

ENDCASE.

suresh_datti
Active Contributor
0 Kudos

You can put a check for sy-ucomm immediately after the when '0102' statement & proceed with your code only if it is a COPY.Pl make the following chnage to your code

WHEN '0102'.

if ipsyst-ioper = 'COP'.

CALL METHOD CL_HR_PNNNN_TYPE_CAST=>PRELP_TO_PNNNN

EXPORTING

PRELP = INNNN

IMPORTING

PNNNN = I0102.

SELECT PERNR GRNUM GRSTG seqnr FROM PA0102 INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE PERNR = I0102-PERNR .

LOOP AT ITAB.

IF ITAB-GRNUM = I0102-GRNUM .

IF ITAB-GRSTG = I0102-GRSTG .

MESSAGE 'A record already exist for selected combination of Grievence Number and Stage. Please change the values.' TYPE 'E'.

ENDIF.

ENDIF.

ENDLOOP.

endif.

ENDCASE.

~Suresh Datti

Former Member
0 Kudos

Dude,

This problem is solved. Please look at the thread on Appraisal pointo (infotype 0025) of mine...........

Thanks

Ribhu

Answers (0)