2007 Sep 19 11:12 AM
hallow
here i try to find org unit manager but its not working well
plz some one can help
i think i have problem in dates but i not sure
thankes & regards
LOOP AT i_t_data INTO lw_t_data_0org.
SELECT begda endda sobid
FROM hrp1001
INTO TABLE lt_relat_org
WHERE objid EQ lw_t_data_0org-orgeh
AND rsign EQ 'B'
AND relat EQ '012'
AND endda GE lw_t_data_0org-datefrom
AND begda LE lw_t_data_0org-dateto.
SORT lt_relat_org BY begda DESCENDING endda DESCENDING sobid.
CLEAR lw_relat_org.
READ TABLE lt_relat_org INDEX 1 INTO lw_relat_org.
IF sy-subrc EQ '0'.
l_plans = lw_relat_org-sobid.
SELECT SINGLE pernr
FROM pa0001
INTO lw_t_data_0org-zzmanager
WHERE endda GE lw_relat_org-begda " lw_t_data_0org-datefrom
AND begda LE lw_relat_org-endda " lw_t_data_0org-dateto
AND plans EQ l_plans.
ENDIF.
APPEND lw_t_data_0org TO lc_t_data_0org.
2007 Sep 19 11:18 AM
2007 Sep 19 11:18 AM
2007 Sep 19 11:25 AM
hi friends
if it help
here is table i_t_data
datafrom datato orgeh org.manager
19690101 99991231 50002993 00000000
19690101 99991231 50002994 00000000
19650101 99991231 50003004 00000000
20050101 99991231 50003014 00000000
19690101 99991231 50003018 00000000
20050101 99991231 50003019 00000000
20050101 99991231 50003020 00000000
regards
2007 Sep 19 11:46 AM
2007 Sep 19 12:31 PM
Hi....I have written program for that...it is working.....please modify ur code accordingly...as ur internal table names and work area names are bit complicated......
one mistake u have done...is u used select single pernr......for that plans from pa0001......but in that date range there may be many pernrs for the same position.....so u have to get all records...n get the latest among them ...in that date range......!!! anyhow check the below code..!!!!
tables : hrp1001.
parameters : p_orgeh like hrp1001-objid.
select-options : s_date for sy-datum.
data : begin of itab occurs 0,
begda like hrp1001-begda,
endda like hrp1001-endda,
sobid like hrp1001-sobid,
end of itab.
data : begin of itab1 occurs 0,
pernr like pa0001-pernr,
endda like pa0001-endda,
begda like pa0001-begda,
plans like pa0001-plans,
end of itab1.
at selection-screen.
if s_date[] is initial.
s_date-sign = 'I'.
s_date-option = 'EQ'.
s_date-low = sy-datum.
s_date-high = sy-datum.
append s_date.
endif.
Start-of-selection.
select begda endda sobid
from hrp1001
into table itab
where objid = p_orgeh
and endda ge s_date-low
and begda le s_date-high
and rsign = 'B'
and relat = '012'
and plvar = '01'.
if sy-subrc = 0.
sort itab by begda descending endda descending sobid.
Read table itab index 1.
if sy-subrc = 0.
select pernr endda begda plans from pa0001 into table itab1 where plans = itab-sobid and endda ge s_date-low and begda le s_date-high.
if sy-subrc = 0.
sort itab1 by begda descending.
endif.
endif.
endif.
end-of-selection.
if not itab1[] is initial.
read table itab1 index 1.
if sy-subrc = 0.
write 😕 itab1-pernr,
itab1-plans.
endif.
endif.
Regards
Vasu
2007 Sep 19 1:06 PM