‎2009 Feb 20 5:15 AM
Hi experts
i need a help in the below ...........
i tried few but still cudnt get the solution
here is the query where
=======================
Select pernr endda massn from pa0000 into corresponding fields of table it_pa0000
WHERE
Endda = '99991231' and
MASSN in ('S1', 'S2', 'S3', 'S4', 'S7')
and pernr in so_pernr.
where it fetches all the pernr which satisfies the condition
but problem is that since i have mentioned the Endda as '99991231 its fetching
the begda for the corresponding endda ,
but my requirement is that it shud satisfy my select criterial
and if satisfied it shud fetch the begda of S1 instead of
fetching endda 's corresponding begda.
thanx in advance
Rachel
‎2009 Feb 20 5:29 AM
HI,
Could you please be more clear.
As per my understanding when you filter the data based on that,the ata will be retrieved .
In your case i think you want only begin date and you don't want end date corresponding to Begining date.
For a PERNR always we have only one enddate and one begin date .
change the internal table and add as well as end date field .. This may serve your purpose .
Regards,
Amit
‎2009 Feb 20 5:29 AM
HI,
Could you please be more clear.
As per my understanding when you filter the data based on that,the ata will be retrieved .
In your case i think you want only begin date and you don't want end date corresponding to Begining date.
For a PERNR always we have only one enddate and one begin date .
change the internal table and add as well as end date field .. This may serve your purpose .
Regards,
Amit
‎2009 Feb 20 5:38 AM
hi ,
by your select it will always get you begda correponding to enda...
now you want according to s1...
so for employee...with begda of s1 and endda as 31129999..
so wht you need to get begda related to s1:
define it_tab with fields pernr and begda
select pernr begda form p0000 into it_tab
for all entries in it_pa0000
where pernr = it_pa0000-pernr
and massn = s1.
then loop at it_pa0000-pernr into wa.
read table it_tab into watab with key pernr = wa-pernr.
wa-begda = watab-begda.
modify it_pa0000 form wa.
endloop.
the code written by you will get you correct begda if only s1 action is performed on employee..
but if your employyee has more actions after s1..the the second recod will have endda as 3112999..
then in that case do as above code
Edited by: pratyush v on Feb 20, 2009 11:09 AM
‎2009 Feb 20 5:45 AM
hi thanx for the reply.....
here i have furnished my coding ....can u tel me how can it be done....
thanx
Select pernr begda endda massn from pa0000 into corresponding fields of table it_pa0000
WHERE
Endda = '99991231' and
MASSN in ('S1', 'S2', 'S3', 'S4', 'S7')
and pernr in so_pernr.
Elseif pr_sep = 'X'.
Select pernr begda from pa0000 into corresponding fields of table it_pa0000
WHERE
BEGDA <= SY-DATUM AND
ENDDA >= SY-DATUM AND
MASSN in ('S5')
and pernr in so_pernr.
Endif.
IF it_pa0000[] is not initial.
select pernr bukrs abkrs from pa0001 into corresponding fields of table it_pa0001
for all entries in it_pa0000
where abkrs = pr_abkrs and
bukrs = pr_bukrs and
pernr = it_pa0000-pernr.
Endif.
IF it_pa0001[] is not initial.
Select pernr vorna begda Nachn from pa0002 into corresponding fields of table it_pa0002
for all entries in it_pa0001
where pernr = it_pa0001-pernr and
BEGDA <= SY-DATUM AND
ENDDA >= SY-DATUM.
Endif.
IF it_pa0002[] is not initial.
Select pernr begda EEPFN from pa0587 into corresponding fields of table it_pa0587
for all entries in it_pa0001
where pernr = it_pa0001-pernr and
BEGDA <= SY-DATUM AND
ENDDA >= SY-DATUM .
Endif.
IF it_pa0587[] is not initial.
Select pernr begda esino from pa0588 into corresponding fields of table it_pa0588
for all entries in it_pa0001
where pernr = it_pa0001-pernr and
BEGDA <= SY-DATUM AND
ENDDA >= SY-DATUM .
Endif.
IF IT_PA0588[] is not initial.
Select pernr begda favor famsa from pa0021 into corresponding fields of table it_pa0021
for all entries in it_pa0001
where pernr = it_pa0001-pernr and
famsa = '11' and " Selecting type as father
BEGDA <= SY-DATUM AND
ENDDA >= SY-DATUM .
Endif.
IF IT_pa0021[] is not initial.
Select pernr begda BET02 from pa0008 into corresponding fields of table it_pa0008
for all entries in it_pa0001
where pernr = it_pa0001-pernr and
BEGDA <= SY-DATUM AND
ENDDA >= SY-DATUM .
Endif.
Loop at it_pa0001 into wa_pa0001.
wa_final-abkrs = wa_pa0001-abkrs.
read table it_pa0000 into wa_pa0000 with key pernr = wa_pa0001-pernr.
IF sy-subrc = 0.
wa_final-pernr = wa_pa0000-pernr.
wa_final-begda = wa_pa0000-begda.
Endif.
read table it_pa0002 into wa_pa0002 with key pernr = wa_pa0001-pernr.
IF sy-subrc = 0.
wa_final-vorna = wa_pa0002-vorna.
wa_final-nachn = wa_pa0002-nachn.
Endif.
read table it_pa0587 into wa_pa0587 with key pernr = wa_pa0001-pernr.
IF sy-subrc = 0.
wa_final-eepfn = wa_pa0587-eepfn.
Endif.
read table it_pa0588 into wa_pa0588 with key pernr = wa_pa0001-pernr.
IF sy-subrc = 0.
wa_final-esino = wa_pa0588-esino.
Endif.
read table it_pa0021 into wa_pa0021 with key pernr = wa_pa0001-pernr .
IF sy-subrc = 0.
wa_final-favor = wa_pa0021-favor.
Endif.
read table it_pa0008 into wa_pa0008 with key pernr = wa_pa0001-pernr.
IF sy-subrc = 0.
wa_final-bet02 = wa_pa0008-bet02.
Endif.
Append wa_FINAL to IT_FINAL.
clear wa_final.
Endloop.
‎2009 Feb 20 5:52 AM
Just sort your internal table as ..
sort it_pa0000 by pernr begda.
delete adjacent duplicates from it_pa0000 comparing pernr.
Here it gets the BEGIN DATE of S1.
‎2009 Feb 20 5:58 AM
hi
thanx ....this is wat i was trying but
Types : begin of ty_dates,
pernr type pa0000-pernr,
begda type pa0000-begda,
endda type pa0000-endda,
massn type pa0000-massn,
end of ty_dates.
data: it_Dates type table of ty_dates,
wa_dates type ty_Dates.
select pernr begda form pa0000 into corresponding fields of table it_dates
for all entries in it_pa0000
where pernr = it_pa0000-pernr
and massn = S1.
giving so i get bypassing buffer package size or upto rows expected after it_dates error occurs
‎2009 Feb 20 6:00 AM
hi
iam sorry....
i have made the syntax....thats not the error.....
lemme try and let u know
thanx
‎2009 Feb 20 5:31 AM
If thats the case then give the BEGDA condition also in the where clause ...
rewrite your select as ..
Select pernr endda massn from pa0000 into corresponding fields of table it_pa0000
WHERE
pernr in so_pernr
Endda GE p_begda and
BEGDA LE p_endda and
MASSN in ('S1', 'S2', 'S3', 'S4', 'S7').
sort it_pa0000 by pernr begda descending.
delete adjacent duplicates from it_pa0000 comparing pernr. <-- will fetch latest record
P_BEGDA and P_ENDDA are selection screen parameters for begin date and enddate.
‎2009 Feb 20 5:38 AM
hi thanx but i dont use parameters for begda and endda ....i pick only from table
‎2009 Feb 20 5:32 AM
hi:
do one thing, select the data without using date condition and later on, under the loop; the matching conditions of date, filter the data and append into another internal table.
Regards
Shashi