Solved

HR_READ_INFOTYPE - Sy-Subrc = 0 but no data returned

Posted on 2003-10-29
4
4,054 Views
Last Modified: 2013-12-08
Hello,

I am using a 'HR_READ_INFOTYPE' function to read infotype 32 data. I have everything declared correctly and parameters are passed correctly as far as i can see. For me this function should work fine and return data. However the when the function executes the subrc is returned as zero but no data is place in the internal table.

There is definitely Infotype 32 data for the personnel numbers and i can get this data using a select statement. Can anybody please tell me why this code isnt working ? Are there any know problems with this function ?

Many thanks for your help. It is greatly appreciated.

Best Regards

Gary Kelly

Below is the code I have wrote.

DATA: it0032 LIKE p0032 OCCURS 0 WITH HEADER LINE.

CLEAR: it0032.
                REFRESH: it0032.
                CALL FUNCTION 'HR_READ_INFOTYPE'
                     EXPORTING
                          pernr     = audit-pernr
                          infty     = '0032'
                     TABLES
                          infty_tab = it0032.
                IF NOT it0032[] IS INITIAL.
                  SORT it0032 BY begda DESCENDING.
                  LOOP AT it0032 WHERE begda LE p_cutoff.
                    out-data = it0032-tel01.
                    EXIT.
                  ENDLOOP.
                  IF sy-subrc NE 0.
                    CLEAR out-data.
                  ENDIF.
                ELSE.
                  CLEAR out-data.
                ENDIF.
0
Comment
Question by:garydkelly
4 Comments
 
LVL 3

Accepted Solution

by:
sharadd earned 250 total points
ID: 9647603
Hi
Try your code as follow.
* First check your data audit-pernr contains the value.
             clear out-data.
               CALL FUNCTION 'HR_READ_INFOTYPE'
                     EXPORTING
                          pernr     = audit-pernr
                          infty     = '0032'
                         BYPASS_BUFFER = 'X'
                     TABLES
                          infty_tab = it0032.
               if sy-subrc eq 0.
                  sort it0032 by  begdata descending.
                  Loop at it0032 WHERE begda LE p_cutoff.
                       out-data = it0032-tel01.
                  endloop.
               else.
                    Out-data = 'ERROR'.
               endif.

Hope this should solve your problem.
sharadd
0
 
LVL 2

Assisted Solution

by:BACR
BACR earned 250 total points
ID: 9649677
Hi.

1.
Field audit-pernr should have internal representation (with leading zeros)
2.
I would recommend  checking of imported field SUBRC
3.
I would recommend to use exceptions
4.
Table it0032 can contain more than one record. I would add additional check on initial value of field tel01.

data: it0032 like p0032 occurs 0 with header line,
      v_subrc like sy-subrc .

clear out-data .
refresh: it0032.
call function 'HR_READ_INFOTYPE'
  exporting
    pernr                 = audit-pernr
    infty                 = '0032'
  IMPORTING
    SUBRC                 = v_subrc
  tables
    infty_tab             = it0032
  EXCEPTIONS
    INFTY_NOT_FOUND       = 1
    OTHERS                = 2 .
if sy-subrc <> 0.
* corresponding error processing if required  
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
if v_subrc <> 0 .
* corresponding error processing if required  
endif .
if not it0032[] is initial.
  sort it0032 by begda descending.
  loop at it0032 where begda le p_cutoff.
    if it0032-tel01 is initial .
      continue .
    endif .
    out-data = it0032-tel01.
    exit.
  endloop.
endif.
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Acceptance of Oracle Fusion as mainstream ERP 3 394
OMS agent on Windows 2012 X64 5 139
Why did SAP buy Sybase? 3 154
crm 2010 on premise 5 61
Salesforce.com’s Console is a great tool to view activities, leads, contacts, accounts and opportunities all in one screen. It is particularly effective during call blocks and working numerous activities at a time in a quick, repetitive fashion (suc…
"Disruption" is the most feared word for C-level executives these days. They agonize over their industry being disturbed by another player - most likely by startups.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now