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: 

Use HR_READ_INFOTYPE or select (for all entries)

Former Member
0 Kudos

Hi

As I have understood the difference between FM HR_READ_INFOTYPE and a select directly from PA0001 (as example) is that the FM take the authorization into account. (please correct me if I am wrong).

My problem is that I need to select from the infotype for a lot of pernr, so I would use this statement:

 
    SELECT * FROM pa0001 INTO CORRESPONDING FIELDS OF TABLE wt_pa0001
      FOR ALL ENTRIES IN wt_pernr
         WHERE pernr = wt_pernr-pernr
          AND begda LE pn-endda
          AND endda GE pn-begda.

but then I don't get the authorization check.

For the FM HR_READ_INFOTYPE I can't use the "FOR ALL ENTRIES".

Can I do it in an easy way, or do need to do the select, and then use an authority check after the select from each infotype?

1 ACCEPTED SOLUTION

former_member225631
Active Contributor
0 Kudos

You can use AUTHORITY-CHECK OBJECT command, in case you use select statement.

5 REPLIES 5

Former Member
0 Kudos

Hi Invlmn,

I am new to SAP.

I did a testing project, in which,

Whenever user passed User ID and / or Division,

I was getting asset details, head quarter IDs L1 IDs, etc from PA0040, PA0001, PA0105 etc.

So I know how i did get the records from those files,

Do you think i can help you?

Thanks and regards,

Sachin Bhatt.

former_member225631
Active Contributor
0 Kudos

You can use AUTHORITY-CHECK OBJECT command, in case you use select statement.

0 Kudos

Calling HR_READ_INFOTYPE or selecting directly from the tables may depend on how much data you are processing. If you only need to retrieve a few records, you could process the PERNR records you need in a loop and call HR_READ_INFOTYPE for each. If you're processing a larger number of records, check the authorization for the each table first and then do a SELECT for all entries. Before you read, make sure that your "FOR ALL ENTRIES" table is not empty. In order to make your code more generic, you may want to use function module HR_CHECK_AUTHORITY_INFTY to check the authorization for each infotype. This is the FM that the HR_READ_INFOTYPE function module uses.

.. Craig

0 Kudos

I have a lot of data to select, so I need to use the select for all entries.

Then I would like to use the FM HR_CHECK_AUTHORITY_INFTY as you suggest. But for using this, I need to call it for each PERNR, and I would like to avoid that. Is that possible?

0 Kudos

It appears that HR_CHECK_AUTHORITY_INFTY requires the PERNR to be specified in the input parameters.