2010 Mar 15 5:09 PM
Hi,
I have created a custom FM- Z_HRGPBS_ME_P46_DAYS_ACTIVE.
If i test it for 1 employee it gives me correct result...then if i green arrow back and test for second employtee it gives me incorrect result.
Similarly if i use this FM in a loop where it has to process for multiple employees, it give me incorrect result.
Please help me correct this problem.
Thank You!
Hi,
I have created a custom FM- Z_HRGPBS_ME_P46_DAYS_ACTIVE.
If i test it for 1 employee it gives me correct result...then if i green arrow back and test for second employtee it gives me incorrect result.
Similarly if i use this FM in a loop where it has to process for multiple employees, it give me incorrect result.
Please help me correct this problem.
Thank You!
2010 Mar 15 5:21 PM
Clear your global variables in the FM before doing anything else.
Rob
2010 Mar 15 5:34 PM
Thanks Rob!
Below is the code in this FM. Export parameter is p_days and input parameter is P_PERNR. I have cleared the p_days toward the begning of the program.
Can you please recommend why it work for 1 employee at atime but not in a loop (or if i test second employee after first one without totally exiting the FM)
Thank a lot!
FUNCTION Z_HRGPBS_ME_P46_DAYS_ACTIVE.
DATA: p0000_tab TYPE TABLE OF p0000 INITIAL SIZE 1.
DATA: msgv_date TYPE symsgv.
STATICS: s0000 TYPE p0000.
DATA it0000 type p0000.
DATA l_begda TYPE DATUM.
DATA l_endda TYPE DATUM.
DATA a type num1.
DATA b type num1.
Data c type p decimals 2.
DATA l_days type i.
DATA message_handler TYPE REF TO if_hrpa_message_handler.
PERFORM create_dummy_handler CHANGING message_handler.
clear P_DAYS.
CALL FUNCTION 'HR_ECM_READ_INFOTYPE'
EXPORTING
pernr = P_PERNR
infty = '0000'
subty = '*'
begda = '20090401'
endda = '20100331'
no_auth_check = ' '
message_handler = message_handler
IMPORTING
infotype_tab = p0000_tab.
p_days = 0.
a = 0 + 1.
b = sy-tabix.
Do.
READ TABLE p0000_tab INDEX a INTO it0000.
If it0000-STAT2 = '1'.
write it0000-begda to l_begda.
write it0000-endda to l_endda.
If l_endda = '99991231'.
l_endda = '20100331'.
ENDIF.
p_days = l_endda - l_begda.
ENDIF.
a = a + 1.
if a = b.
Exit.
endif.
ENDDO.
p_days = p_days - 30.
2010 Mar 15 5:45 PM
Try calling FM HR_ECM_INITIALIZE_BUFFER in the loop before the call to HR_ECM_READ_INFOTYPE
Rob
2010 Mar 15 6:49 PM
Hi Rob,
I did as you said. Now if i test the function module, i get correct data for all employees one after the other without exiting from the FM.
But when I call this FM inside another FM where it is executed inside a loop for multiple employees, then it again don't give correct result.,
Any idea? I appreaciate your input.
Thank You!
2010 Mar 15 8:45 PM
Ok I have identified the problem to be an authorization error.
If I login as a super user then this gives desired result otherwise not.
I am using the FM HR_ECM_READ_INFOTYPE within this FM, but I have the parameter
no_auth_check = ' '
so not sure what else i need to do to make it work for normal users with no super authorizations.
Please advice.
Thank You!
2010 Mar 15 8:49 PM
Hi
You can see in transaction SU53 authorization problem for specific user and give him required authorization.
Just run it after your function run.
Best Regards
Yossi Rozenberg
2010 Mar 15 10:08 PM
It's usually a management decision about who gets which authorizations - not a programming decision.
Rob
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |