10-03-2007 1:26 PM
Hi,
I have an internal table like this (personnel no,start date ,end date.
pernr begda endda
1 01.01.2007 31.01.2007
1 01.02.2007 28.03.2007
1 01.04.2007 25.06.2007
I have to make this into 1 record like shown below.ie with 1 begda and 1 endda.
.
pernr begda endda
1 01.01.2007 25.06.2007
10-03-2007 1:38 PM
*--itab and itab1 should have same structure.
sort itab by pernr begda endda descending.
loop at itab.
at new pernr.
lv_begda = itab-begda.
itab1-pernr = itab-pernr.
itab1-begda = lv_begda.
endat.
at end of pernr.
lv_endda = itab-endda.
itab1-endda = lv_endda.
append itab1.
clear : itab1,lv_begda,lv_endda.
endat.
endloop.
Regards
Vasu
10-03-2007 1:36 PM
Hi
In HR records are maintained like that for different time periods
You can use the MACROS like using PNP LDB
GET PERNR and
rp_provide_from_first
take BEGDA
or
rp_provide_from_last
take ENDDA and PERNR
and move into another ITAB
and get the first and last records
Regards
Anji
10-03-2007 2:09 PM
Hi
I never used macros please can u provide me any small eg .
Then in this report i have displayed in alv hierar .The header has this range of dates and i am getting only 1 value in line items,so i thought to make into 1 record and then fetch the line items.
10-03-2007 1:38 PM
*--itab and itab1 should have same structure.
sort itab by pernr begda endda descending.
loop at itab.
at new pernr.
lv_begda = itab-begda.
itab1-pernr = itab-pernr.
itab1-begda = lv_begda.
endat.
at end of pernr.
lv_endda = itab-endda.
itab1-endda = lv_endda.
append itab1.
clear : itab1,lv_begda,lv_endda.
endat.
endloop.
Regards
Vasu
10-04-2007 11:24 AM
Hi,
i placed the variable before control level statements and moved the loop into explicit work area and from workarea to variable.
Thanks,
dina.