cancel
Showing results for 
Search instead for 
Did you mean: 

Need help to create IT0017 using BADI HRPAD00INFTY

Former Member
0 Kudos

Guru,

I am trying to create IT0017 on every save of IT0001 using BADI HRPAD00INFTY .

To create IT0017 I am trying to use function module HR_INFOTYPE_OPERATION

in on_update.

The code for this function module works fine standalone program but when I am trying to use this in BADI, I am getting error. Looks like some lock issue.

Anyone is having any suggestions.

Is it possible to create IT using BADI HRPAD00INFTY . If yes, how we can do it.

I did this with dynamic action and it works fine. But we want to run this in background..so I am trying to put this in the BADI...

Any suggestion or help is appreciated. Thanks

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Suresh,

Same thing….it is not saving..

If I manually save it ( dialog_mode = 2) , it is not giving error but function module is unable to save it after commit = ‘X’ also.

Following is sample code for submit program

****Hard coding data rather than passing for testing purpose

data: ls_p0017 type p0017,

ls_return type bapireturn1,

ls_new_image type psoper,

l_pernr type BAPIP0001-PERNR.

l_pernr = '00022048'.

*----- enqueue PERNR is done in BADI

*----filling parameters for It0017

clear: ls_p0017.

ls_p0017-pernr = l_pernr.

ls_p0017-begda = sy-datum.

ls_p0017-endda = sy-datum.

ls_p0017-erkla = '0'.

ls_p0017-ergru = '10'.

ls_p0017-spebe = '1'.

ls_p0017-ptzuo = '1'.

*-- create infotype 0017

clear: ls_return.

call function 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = '0017'

number = ls_p0017-pernr

subtype = space

validityend = ls_p0017-endda

validitybegin = ls_p0017-begda

record = ls_p0017

operation = 'INS'

nocommit = 'X'

  • DIALOG_MODE = '2'

IMPORTING

return = ls_return.

case ls_return-type.

when 'E' or 'A'.

exit.

when others.

commit work.

endcase.

suresh_datti
Active Contributor
0 Kudos

I don't see anything wrong with the code.. try by removing the function call to lock the employee ( in the BAdI )..

~Suresh

Former Member
0 Kudos

Suresh,

I tried to call HR_INFOTYPE_OPERATION from BADI along with HR_PSBUFFER_INITIALIZE…. it worked.

But it is too wired that when I go to IT0017 overview screen I can see IT0017 is created but when I try to change it (hit on pencil), it is not doing anything..

If I go out of PA30 transaction and get in again, It0017 is gone. Inshort screen is filled but if you are out of transaction then data is lost..

Data is not getting saved…

Any idea why..?

suresh_datti
Active Contributor
0 Kudos

see if an explict COMMIT WORK immediately after HR_INFOTYPE_OPERATION would be of any help..

~Suresh

Former Member
0 Kudos

No....no use of commit..

Data is getting filled but not save...

If you are in transaction pa30 you can see data but if you get out of IT0017 without saving it is lost....

Just don't know what is getting wrong..is there any table settings which we need to check..??/

suresh_datti
Active Contributor
0 Kudos

Try calling this subroutine after the function call..

PUT_INFOTYP_BUFFER(SAPFP50P).

~Suresh

P.S. Frankly, I am clueless..as I still feel the SUBMIT should have worked for you straight away..

Former Member
0 Kudos

Thanks Suresh!!!

When DALOG_MODE = '2'

I can see....IT0017 screen is getting filled the way I want. But it is not getting saved. If I manually hit save, then IT0017 is getting created but programmatically looks like it is not getting saved.

In short, data to IT0017 is getting filled but not saved.

Pl. help..!!

suresh_datti
Active Contributor
0 Kudos

Are you using the NO_COMMIT parameter? try putting it as 'X'.

You can also try putting the following just before calling HR_INFOTYPE_OPERATION.

  • Clear the buffer

CALL FUNCTION 'HR_PSBUFFER_INITIALIZE'.

~Suresh

Former Member
0 Kudos

Suresh,

I tried this..

in my submit program before using HR_INFOTYPE_OPERATION FM ..I am using HR_EMPLOYEE_ENQUEUE FM .

HR_EMPLOYEE_ENQUEUE is ending up with error. Do you think we need to use this FM in BADI and not in sumit program..?

Pl. suggest..

Thanks for help..

Former Member
0 Kudos

Suresh,

HR_EMPLOYEE_ENQUEUE, HR_EMPLOYEE_DEQUEUE worked...

But HR_INFOTYPE_OPERATION FM ends in following error..

A complex application error has occurred

even after calling from another program using submit with return.

Pl. help...thanks!!

suresh_datti
Active Contributor
0 Kudos

put the parameter DIALOG_MODE = '2' & check it..

~Suresh

Former Member
0 Kudos

Thanks!!! got it!!! ...can't wait to try

suresh_datti
Active Contributor
0 Kudos

I have used it many a times from the User Exit/BAdI & even Dynamic Actions.. You should not have any issue..

Good luck!

~Suresh

Former Member
0 Kudos

Thanks Suresh..but what should be return option..

Thanks..

-manjiri

suresh_datti
Active Contributor
0 Kudos

The syntax of SUBMT ends with the RETURN keyword.. this will allow the control to return to the BAdI after submitting the report.. press F1 on SUBMIT in your editor & the documentation on how to use this statement is self-explanatory..

~Suresh

suresh_datti
Active Contributor
0 Kudos

You have to SUBMIT the standalone program(that creates 0017) from the BAdI using the SUBMIT <Report> and RETURN option. This would eliminate the Lock Confilict as the SUBMIT will initiate a separate workprocess.

~Suresh