Skip to Content
author's profile photo Former Member
Former Member

User exit for Infotype 0102 - Grevience

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 29, 2007 at 05:40 AM

    Hello Ribhu

    in second ex of code:

    call method cl_hr_pnnnn_type_cast=>prelp_to_pnnnn

    exporting

    prelp = innnn

    importing

    pnnnn = i0102.

    <i><b>MOVE INNNN TO I0102.</b></i> " this statement is not required

    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.

    points:

    1 > no need of move INNNN to I0102

    2> dont use loop at screen use loop at i0102.

    hope this helps you reward points.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.