Solved

HR_READ_INFOTYPE - Sy-Subrc = 0 but no data returned

Posted on 2003-10-29
4
4,070 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ERP Solution Needed 6 516
On-hand by unit of measure 2 96
Why did SAP buy Sybase? 3 160
centralized repository for hosting the internal data and view 1 55
Salesforce.com is a cloud-based customer relationship management (CRM) system. In this article, you will learn how to add and map custom lead and contact fields to your Salesforce instance.
Messaging apps are amazing tools with the power to do a lot of good, but the truth is the process of collaborating with coworkers requires relationships established through meaningful communication - the kind of communication that only happens face-…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

786 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