Solved

HR_READ_INFOTYPE - Sy-Subrc = 0 but no data returned

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

I showed you how to use console view (HERE (http://www.experts-exchange.com/articles/18379/Getting-Started-and-Using-the-Salesforce-com-Console.html)) -– but how do you set it up on the admin side of Salesforce? Note that you have to have Admin leve…
Note: You must have administrative privileges in order to configure lead or case queues. Salesforce.com (http://www.Salesforce.com) is a cloud-based customer relationship management (CRM) system. It is widely used around the world by sales and ma…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 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

10 Experts available now in Live!

Get 1:1 Help Now