‎2007 Jan 08 7:21 AM
Hi Experts,
I am having this scenario.
PERNR BEGDA ENDDA
000001 01.01.2006 13.01.2007
000001 14.01.2007 31.12.9999
000002 14.01.1982 12.11.2006
000002 13.11.2006 31.01.2007
000002 01.02.2007 31.12.9999
This is the scenario my requirement is like that if I will enter PERNR = 1 then it will display 14.01.2007 record. And if I will enter PERNR = 2 then it will display 13.11.2006.
Regards,
Rajneesh Gupta
‎2007 Jan 08 7:29 AM
i don know why u r such awkward requirements.but instead of going for simple HR,u shud go for ABAP-Hr and then write ur code.use LDB PNP.
and use Get pernr event and then move ur concerned data to ur output internal table.
Get pernr event will fetch all the Infotype records for the concerned pernr and then u can have particular one in ur iutput table as per ur requirement.
demo code for using LDBs -
tables: pernr.
infotypes: 0021.
*eject
&----
*& Constants *
*& *
&----
constants: c_1(1) type c value '1' .
data: begin of t_output occurs 0,
num_dep(2) type n,
pernr like pernr-pernr.
data: end of t_output.
data: count type i.
*eject
&----
*& Initialization *
*& *
&----
Initialization.
Initialize Selection-Screen values
perform init_selction_screen.
Start-of-selection.
get pernr.
clear t_output.
Read Infotype 0021
rp-provide-from-last p0021 space pn-begda pn-endda.
check pnp-sw-found eq c_1.
Gather all the required information related to the emp
describe table p0021 lines count.
move: pernr-pernr to t_output-pernr,
count to t_output-num_dep.
append t_output.
Clear count.
*eject
&----
*& End-of Selection *
*& *
&----
end-of-selection.
perform print_report.
*eject
&----
*& Form print_report
&----
*Description:
----
FORM print_report .
Print the report
loop at t_output.
skip 1.
at sum
write: 2 t_output-pernr,
15 t_output-num_dep.
endloop.
ENDFORM. " print_report
‎2007 Jan 08 7:30 AM
Hi ,
What i understand is you are selcting data from table , so what you can do is use the command select up to 1 rows.
and e.g. of the same is given below
select *
from mara
up to 1 rows
order by ERSDA descending.
endselect.so what this gives as output is he laterst created material.
Try this and if you still have issues , please do revert back.
Regards
Arun