Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

prg should execute only while creating the record in PA30 screen

Former Member
0 Kudos

Hi,

Scenario is like this:

When the user creates the record in IT2001 (Absence) for a particular employee with (leave type = ‘vacation’ subty = ‘1000’) the system should not allow the user to crate more than two records in a given year. Therefore at no circumstances the employee can have more than two vacation leave records in a single year .

For this I have coded in the include ZXPADU02 under user-exit EXIT_SAPFP50M_002.

This is working fine and not allowing the user to create more than two records in PA30 transcation screen in a given year.

But at the same time when the user wants to delete or change already created vacation leave record using PA30 screen,the program is not allowing to do so.

What I mean to say is the my prog should only execute while at the time of record creation and not while deleting or changing the leave record from PA30 screen.

Please suggest.

Regards,

3 REPLIES 3

piyush_mathur
Active Participant
0 Kudos

Hi Ramesh,

Check for the sy-ucomm = 'UPD'.

Call below function, to populate the internal table IT_P2001 with current data.

CALL METHOD CL_HR_PNNNN_TYPE_CAST=>PRELP_TO_PNNNN

EXPORTING

PRELP = INNNN

IMPORTING

PNNNN = IT_P2001.

Now check for the records in database for the data avaliable in IT_P2001.

If there is no corresponding records, means it a new record, in this case process your validation.

Thanks

Piyush

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Jan 22, 2008 5:55 PM

0 Kudos

Hi ,

In ur user exit , have one more check

IF ipsyst-ioper = 'INS' OR ipsyst-ioper = 'MOD'.

Write your code .

ENDIF.

So when u r deleting it won't fire ur exit .

Hope this helps .

Regards.

0 Kudos

Thanks Suresh,

Your suggestion worked out and the problem is resolved.

Regds,