Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Check & Select statements' behaviour in an HR Report


I am new to ABAP & ABAP HR in particular.

I have this report, wich displays a list of employees with info (Name, Date of birth, Start date, End date, Job key, Job title).

To get the job title's text a subroutine is called.

As I see this subroutine is called in a provide loop, wich means it will be proceeded for each valid record.

My Question is, in that subroutine :

First :

The select statement wich normally will fetch for the text of the job title, simply do the fetch without storing the result anywhere (in a WA for e.g. or a variable). How then, in the calling program, the write stament (WRITE (15) t513s-stltx) wich will come after the Perform, can identify that 'job title's text' already fetched ?

Second :

The condition of the Check statement seems to be the opposite of what it should be.

Normally, it should check for e.g if 'sy-langu' is EQ to the 't513s-sprsl', if OK then select should be proceeded if not it shouldn't.

But it seems to do the opposite ?


REPORT zpsol030 LINE-SIZE 100.

*-- Declaration

TABLES: pernr, T513S. "Job Titles

INFOTYPES: 0001, "Organ. Assignment

                    0002. "Personal Data

*-- Processing GET pernr.

PROVIDE stell ename FROM p0001

               gbdat FROM p0002 BETWEEN pn-begda and pn-endda.

     IF p0001_valid EQ 'X'.

          IF p0001-stell NE space.

               PERFORM re513s.

               WRITE : / pernr-pernr, sy-vline,

                              (20) p0001-ename, sy-vline,

                              p0002-gbdat, sy-vline,

                              p0001-stell, sy-vline,

                              (15) t513s-stltx, sy-vline,

                              p0001-begda, sy-vline,






* FORM RE513S *


* Read Job Title *


FORM re513s.

     CHECK sy-langu NE t513s-sprsl OR

               p0001-stell NE t513s-stell OR

               p0001-begda LT t513s-begda OR

               p0001-begda GT t513s-endda.

     SELECT * FROM t513s WHERE sprsl EQ sy-langu  AND stell EQ p0001-stell

          AND endda GE p0001-begda 

          AND begda LE p0001-begda.



     IF sy-subrc NE 0.

          CLEAR t513s.

          WRITE: / pernr-pernr, ‘No entry in T513S for job key’ (001), p0001-stell.




Former Member
Former Member replied

thats how i understand the sap help:

This statement is not allowed in classes and declares a data object table_wa as a table work area whose data type is adopted from

the identically named structured data type table_wa

from the ABAP Dictionary. table_wa must be defined as a

flat structure in the ABAP

Dictionary. You can specify database tables or views for table_wa.

Suggestion on second issue:

not quite sure but i would say: If the check is not passed, it means the data in the t513 structure  is identical to the data the select will deliver, so you don´t have to execute the select, because you already have the data. Maybe because the two employees have the some job assigned, or there is more than 1 entry in pa0001 for this employee in the selection time.

0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question