Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

PROVIDE Statement

Former Member
0 Likes
1,065

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
902

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

6 REPLIES 6
Read only

Former Member
0 Likes
902

Hi,

You can sort your internal table & then delete the duplicates.

SORT IT_0000 BY PERNR.

DELETE ADJACENT DUPLICATES FROM IT_0000.

Read only

Former Member
0 Likes
903

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

Read only

Former Member
0 Likes
902

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

Read only

Former Member
0 Likes
902

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.

Read only

Former Member
0 Likes
902

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.

Read only

Former Member
0 Likes
902

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