‎2006 Mar 06 7:51 PM - last edited on ‎2024 Feb 04 5:35 AM by postmig_api_4
Using the PROVIDE command i think is a good way to get a filter between dates in an HR development with logic database, however, i got a problem with this command that changes the real content of date's field (BEGDA and ENDDA) when i append into others internal tables everytime i've the dates "sliced off", sample :
" 3 real lines from table PA0000(IT0)
PERNR BEGDA ENDDA
1 01012005 31129999
1 01012004 31122004
1 01012003 31122003
" My it_0000(int. table like PA0000) will receive data from the command provide bellow and "PN" is the date range, which has BEGDA = 30062004 and ENDDA = 30062005 :
PROVIDE PERNR BEGDA ENDDA
FROM P0000
BETWEEN PN-BEGDA AND PN-ENDDA. " Range between 30/06/2004 and 30/06/2005
MOVE-CORRESPONDING P0000 TO IT_0000.
APPEND IT_0000.
CLEAR IT_0000.
ENDPROVIDE.
" But, when i see the data from IT_0000 in my debug, i gonna see :
PERNR BEGDA ENDDA
1 01012005 30062005 --> It was made a change to the last day of my range
1 30062004 31122004 --> In the BEGDA also we've the same situation.
With these changes i got a "dubious" information to show up into my report.
I think that it can be easier to be fixed, perhaps a simple sintax / complement in the PROVIDE Command that i didn't realize yet.
So, every contributions to fix it'll be welcome !
tks in advance,
Andre L. Calderan
‎2006 Mar 07 6:50 AM
Andre,
you do not actually need a PROVIDE in this case.
Provide SPLITS/COMBINES the records according to the PN dates.
Best is to use FM HR_READ_INFOTYPE.
OR you can use a READ statement.
A rough syntax.
READ TABLE P0000
WHERE BEGDA LE PNENDDA AND ENDDA GE PNBEGDA.
This will get all the overlapping reocrds from P0000.
Thanks
Krisho
‎2006 Mar 06 8:03 PM
Hi,
You can sort your internal table & then delete the duplicates.
SORT IT_0000 BY PERNR.
DELETE ADJACENT DUPLICATES FROM IT_0000.
‎2006 Mar 07 6:50 AM
Andre,
you do not actually need a PROVIDE in this case.
Provide SPLITS/COMBINES the records according to the PN dates.
Best is to use FM HR_READ_INFOTYPE.
OR you can use a READ statement.
A rough syntax.
READ TABLE P0000
WHERE BEGDA LE PNENDDA AND ENDDA GE PNBEGDA.
This will get all the overlapping reocrds from P0000.
Thanks
Krisho
‎2006 Mar 07 7:06 AM
Hi,
P0000 has a constraint NO OVERLAPPING.
hence, when you give intermidiate values for BEGDA and ENDDA, it will create an intermidiate interval and hence it is appending diferent value to you internal table.
Change the values for BEGDA and ENDDA so that there will be no overlapping and then check or try and use SEQNR.
otherwise use FM READ_HR_INFOTYPE.
Hope this helps..
Regards,
Shashank
‎2006 Mar 07 7:16 AM
it will pick all the records between that range.
according to your rows in the PA000 its picking correctly.
If u want only the current records then say
sort itab by pernr begda descending.
and delete adjacent duplicates.
‎2006 Mar 07 7:26 AM
HI andre,
1. U are right!
2. The slice-off is done on the CUT-OFF DATES.
3. For this u need to use own logic,
(its tricky while working with BEGDA and ENDDA)
4. We have to use like this.
loop at itab.
if
( mybegda between itab-begda and itab-endda)
OR
( myendda between itab-begda and itab-endda)
.... ur code
endif.
endloop.
regards,
amit m.
‎2006 Mar 07 1:51 PM
Hi Amit !
you got the point, tks for you return, i was wondering if there is any other way / logic to aply instead it, i was thinking the same logic (loop + if + my logic) too, but i think this way is so...rough, got it ?
Using the provide command always do we've our data overlapped when a period signed "slice-off" some date ? Dont we have any other option ?
tks again !
Andre