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

Hardcoding User while executing HR_INFOTYPE_OPERATION

Former Member
0 Likes
485

Hi Experts,

I have a report that performs various functions. At the end of this report, I am updating IT 2001 using HR_INFOTYPE_OPERATION as below -

CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'

EXPORTING

NUMBER = PERNR1.

  • I am populating P2001 with appropriate data

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

INFTY = '2001'

NUMBER = PERNR1

SUBTYPE = suitable value given

VALIDITYEND = DATE1

VALIDITYBEGIN = DATE1

RECORD = P2001

OPERATION = 'INS'

IMPORTING

RETURN = RETURN1.

.

CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'

EXPORTING

NUMBER = PERNR1.

This is working well. My requirement is that this last part of the report needs to be executed by a specific User. Is there a way I can hardcode the USERID while calling this function module ?

What I have tried is putting this code within a separate program - ztest and calling that with a job as follows -

SUBMIT ZTEST

VIA JOB l_jobname

NUMBER l_jobcount

USER i_user

AND RETURN.

Here I could hardcode i_user. But somehow this method doesnt work and IT 2001 dint get updated. The Job ran successfully though. Any ideas how to proceed?

Please advise.

Thks in advance! Liz

1 ACCEPTED SOLUTION
Read only

mvoros
Active Contributor
0 Likes
456

Hi,

you can create a RFC destination which will have predefined user. You also need to define a RFC enabled FM. This FM will be called from your report instead of current update logic with your new RFC destination. It will perform same function calls as you have right now directly in your report.

Cheers

2 REPLIES 2
Read only

mvoros
Active Contributor
0 Likes
457

Hi,

you can create a RFC destination which will have predefined user. You also need to define a RFC enabled FM. This FM will be called from your report instead of current update logic with your new RFC destination. It will perform same function calls as you have right now directly in your report.

Cheers

Read only

Former Member
0 Likes
456

Hi Martin,

I found another way before trying out your method..

i have a custom report that I am calling using a batch job. Here I can specify the user who should be running the job. this works I am going to give your method a try and see which is better in terms of performance..

Thanks a lot for your input

Liz