Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Sap Query Additional Fields using Abap Code

Former Member
0 Likes
520

Hi Experts,

I am relatively new to the world of SAP query (Log Database PNPCE), I have written a number of additional fields to retrieve previous info-type data using the select statement E.G

prev_endda = p0008-begda - 1.

SELECT single bsgrd

INTO FTE1

FROM

pa0008

WHERE pernr EQ P0008-pernr

AND endda EQ prev_endda

Although I can retrieve the previous info-type data , I was wondering if there was a easy way where I could take this a step further and show the Previous , Previous record. I.E

Pernr FTE Current FTE1 FTE2

101 60% 30% 75%

I guess what I am asking is , is there a way to loop through the HR info-type records, does anybody know if there is a standard function or macro I can use to achieve this.

Your help is much appreciated.

2 REPLIES 2
Read only

StMou
Active Participant
0 Likes
454

Hi,

Use FM HR_READ_INFOTYPE To acces PAxxx. It's better than select.

Rgds

Read only

Former Member
0 Likes
454

Hi ,

Thanks for our reply.

I have pasted some example code into my additional field which I have created in SAP Query But im not sure how the loop bit works and how I can populate the additional fields that I have created , could you please explain this

CALL FUNCTION 'HR_READ_INFOTYPE'

EXPORTING

pernr = '000000019'

infty = '01'

BEGDA = '18000101'

ENDDA = '99991231'

tables

infty_tab = p0008

EXCEPTIONS

INFTY_NOT_FOUND = 1

OTHERS = 2

LOOP AT p0008.

        • NOT SURE WHAT TO PUT IN THIS SECTION *****

ENDLOOP.

I have created 3 additional Fields in the infoset Current FTE ,FTE1 FTE2 , and I want to loop through the records and populate the relevant Additional field with the employees FTE (I only want to populate where there is a change)

Sample Data

Begda Endda FTE Salary

1/1/2010 31/12/999 60% 19K (Current FTE)

01/08/2009 31/12/2009 100% 27k (FTE1)

01/07/2008 31/7/2009 50% 17K (FTE2)

Thanks in anticipation

DM