Solved

HR_READ_INFOTYPE - Sy-Subrc = 0 but no data returned

Posted on 2003-10-29
4
4,106 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using UDFs in grids 3 254
How to improve the SAP Business Objects System performance 4 122
What make java scalable ? 6 105
CRM 2011 Deployment Package 2 169
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…
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…

756 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