Skip to Content
0
Former Member
Jun 29, 2007 at 05:32 AM

User exit for Infotype 0102 - Grevience

25 Views

Hi all,

I have a requirement where i have to put a check on infotype 0102 - greivence NA through user exit EXIT_SAPFP50M_002 .

The check is that if the user enters a personnel number , grievence number and a stage for which the record alreday exist in the table for the same personnel number , then system should pp up an error message.

I wrote the below code in EXIT_SAPFP50M_002 :-

data : i0102 like p0102 occurs 3 with header line,

begin of fs2,

pernr like p0102-pernr, grnum like p0102-grnum, grstg like p0102-grstg,

end of fs2.

CASE INNNN-INFTY.

WHEN '0102'.

MOVE INNNN TO I0102.

LOOP AT SCREEN.

SELECT PERNR GRNUM GRSTG FROM PA0102 INTO corresponding fields of fs2 WHERE PERNR = I0102-PERNR.

IF fs2-GRNUM = I0102-GRNUM ANd fs2-GRSTG = I0102-GRSTG.

MESSAGE 'A record already exist for selected combination of Grievence Number and Stage' type 'e'.

endif.

ENDLOOP.

ENDCASE.

Here system is throwing an error as " i0102 and innnn are not mutually convertible".

I tried to use a metod :

<b>cl_hr_pnnnn_type_cast=>prelp_to_pnnnn</b>

but still same error :

call method cl_hr_pnnnn_type_cast=>prelp_to_pnnnn

exporting

prelp = innnn

importing

pnnnn = i0102.

MOVE INNNN TO I0102.

LOOP AT SCREEN.

SELECT PERNR GRNUM GRSTG FROM PA0102 INTO corresponding fields of fs2 WHERE PERNR = I0102-PERNR.

IF fs2-GRNUM = I0102-GRNUM ANd fs2-GRSTG = I0102-GRSTG.

MESSAGE 'A record already exist for selected combination of Grievence Number and Stage' type 'e'.

endif.

ENDLOOP.

Please suggest what to do.

Thanks and regards

Ribhu