‎2009 May 13 4:14 PM
Hi,
My situation is this: I need the start date (p0001-begda) that is tied to a job classification (job key) or p0001-stell. Each time an Action occurs, this creates an Org. Assignment record (0001). So I may have multiple records on different dates tied to the same job. What I need is the p0001-begda from the 1st time the employee entered the job (where the job key changed). Is there a simple piece of code that would accomplish this? Any help would be appreciated - thanks,
Jim
‎2009 May 13 4:38 PM
use ldb PNP.
tables: pernr.
infotypes: 0001.
...
start-of-selection.
get pernr.
loop at p0001 where stell = my_stell.
exit.
endloop.
P0001 is sorted by BEGDA, overlapping records are not allowed, so you will get the first record.
‎2009 May 13 4:46 PM
And my_stell would be designated as what? I need the first begda where the job changed. Thx,
Jim
‎2009 May 13 5:05 PM
Hi,
DATA I_COUNT TYPE I.
loop at p0001.
AT FIRST STELL.
" IF Count is 1 that is first job when the count is 2 the job is changed and exit the loop.
I_COUNT = I_COUNT + 1.
IF I_COUNT EQ 2.
EXIT.
ENDIF.
ENDAT.
endloop.