Solved

HR_READ_INFOTYPE - Sy-Subrc = 0 but no data returned

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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Oracle Apps Profiles option: A user profile is a set of shifting options that alter the way one runs an application. A value is set for each option under the user's profile when the Oracle application user logs on to any responsibility or changes…
Read about achieving the basic levels of HRIS security in the workplace.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

751 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