Application Development and Automation 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: 
Read only

Problem in HR- Abap code

Former Member
0 Likes
861

Hi ,

I am writing HR Abap. I m using IF condition inside GET PERNR. As i am not givin personnel number in selection screen, it should fetch all possible persoonel number details. but in my case this loop gets termintaed if any one of the personnel number fails the if condition. But i want loop to continue to fetch other PERNR details. Please can any one help me out in this.


GET pernr.
 
  IF pnpstat2-low EQ '3' OR pnpstat2-low EQ '1'.
    PERFORM get_terminatedate.
    PERFORM fetch_employee_details.
 
  ELSEIF pnpstat2-low EQ '0' OR pnpstat2-low EQ '2'.
    PERFORM get_terminatedate.

IF v_termdate LE 45.                               "This is that if condition
  PERFORM fetch_rehire USING '12'.
    IF g_rehiredate NE high-date.
      hiredate = g_rehiredate.
      wa_final-t_rehiredate = hiredate.
    ELSE.
      PERFORM fetch_rehire USING '01'.
      IF g_rehiredate NE high-date."endda.
        hiredate = g_rehiredate.
        wa_final-t_rehiredate = hiredate.
      ENDIF.
    ENDIF.
    PERFORM fetch_employee_details.
  ELSE.
     MESSAGE text-001 TYPE 'E'.
   ENDIF.

Edited by: Vanitha P on Sep 2, 2010 11:28 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
766

Hi,

Remove the error message ...

IF v_termdate LE 45. "This is that if condition

PERFORM fetch_rehire USING '12'.

IF g_rehiredate NE high-date.

hiredate = g_rehiredate.

wa_final-t_rehiredate = hiredate.

ELSE.

PERFORM fetch_rehire USING '01'.

IF g_rehiredate NE high-date."endda.

hiredate = g_rehiredate.

wa_final-t_rehiredate = hiredate.

ENDIF.

ENDIF.

PERFORM fetch_employee_details.

ELSE.

MESSAGE text-001 TYPE 'E'. <-- instead write REJECT.

ENDIF.

Regards,

Srini.

5 REPLIES 5
Read only

Former Member
0 Likes
767

Hi,

Remove the error message ...

IF v_termdate LE 45. "This is that if condition

PERFORM fetch_rehire USING '12'.

IF g_rehiredate NE high-date.

hiredate = g_rehiredate.

wa_final-t_rehiredate = hiredate.

ELSE.

PERFORM fetch_rehire USING '01'.

IF g_rehiredate NE high-date."endda.

hiredate = g_rehiredate.

wa_final-t_rehiredate = hiredate.

ENDIF.

ENDIF.

PERFORM fetch_employee_details.

ELSE.

MESSAGE text-001 TYPE 'E'. <-- instead write REJECT.

ENDIF.

Regards,

Srini.

Read only

Nawanandana
Active Contributor
0 Likes
766

hi


GET pernr.
 
  IF pnpstat2-low EQ '3' OR pnpstat2-low EQ '1'.
    PERFORM get_terminatedate.
    PERFORM fetch_employee_details.
 
  ELSEIF pnpstat2-low EQ '0' OR pnpstat2-low EQ '2'.
    PERFORM get_terminatedate.
    CHECK firedate GT v_termdate.     "you have to chk this statement  

IF v_termdate LE 45.                               "This is that if condition
  PERFORM fetch_rehire USING '12'.
    IF g_rehiredate NE high-date.
      hiredate = g_rehiredate.
      wa_final-t_rehiredate = hiredate.
    ELSE.
      PERFORM fetch_rehire USING '01'.
      IF g_rehiredate NE high-date."endda.
        hiredate = g_rehiredate.
        wa_final-t_rehiredate = hiredate.
      ENDIF.
    ENDIF.
    PERFORM fetch_employee_details.
  ELSE.
     MESSAGE text-001 TYPE 'E'.
   ENDIF.


if ur using chk statement if the condition fail program should exit.

put the if condition instated of check

Regard

nawa

Read only

Former Member
0 Likes
766

Hi Vanitha,

I got your problem. If you will use if else statement den it will work like that only means if any one pernr fails the condition loop will end. So better use CHECK statement there instead of giving if-else.

like-

GET pernr.
 
  IF pnpstat2-low EQ '3' OR pnpstat2-low EQ '1'.
    PERFORM get_terminatedate.
    PERFORM fetch_employee_details.
 
  ELSEIF pnpstat2-low EQ '0' OR pnpstat2-low EQ '2'.
    PERFORM get_terminatedate.
 

 check firedate GT V_DATE .        "  Use this Check statement. 
 PERFORM fetch_rehire USING '12'.
    IF g_rehiredate NE high-date.
      hiredate = g_rehiredate.
      wa_final-t_rehiredate = hiredate.
    ELSE.
      PERFORM fetch_rehire USING '01'.
      IF g_rehiredate NE high-date."endda.
        hiredate = g_rehiredate.
        wa_final-t_rehiredate = hiredate.
      ENDIF.
    ENDIF.
    PERFORM fetch_employee_details.
  ELSE.
     MESSAGE text-001 TYPE 'E'.
   ENDIF.

Use one fm "RP_HIRE_FIRE" to capture fire date and then compare it with ur variable v_date.

Thanks and Regards,

Nidhi Srivastava.

Read only

MarcinPciak
Active Contributor
0 Likes
766

The issue is the error message which terminates the processing. The best is to either remove it or to build some error table which will hold all collected messages and at the end of processing END-OF-SELECTION shows the EEs which were skipped because of some reason.

Also avoid any messages in GET PERNR event. Imagine you are running the report for 1000 EEs and half of them has incorrect data. Would you like to see all those 500 messages?

If you persist on the message write it like


message text-001 type 'S' display like 'E'.

This way you get the message and are able to process furhter.

Regards

Marcin

Read only

Former Member
0 Likes
766

Hi All,

Thanks for ur answers. I m using CHECK but not using if-else.

By de way i m already using tat FM to get firedate in one perform. Now its workin fine.

Thanks and Regards,

Vanitha P