2006 Oct 09 8:07 AM
Hello,
I am a bit confused how to rewrite a provide statement but with loop instead.
For example, how would the following code be written with 'loop at':
PROVIDE * FROM P0001
FROM P0016 BETWEEN '20020401' AND '20061001'
ENDPROVIDE
Thanks for your help.
2006 Oct 09 8:10 AM
Data Retrieval from LDB
1. Create data structures for infotypes.
INFOTYPES: 0001, "ORG ASSIGNMENT
0002, "PERSONAL DATA
0008. "BASIC PAY
2. Fill data structures with the infotype records.
Start-of-selection.
GET PERNR.
End-0f-selection.
Read Master Data
Infotype structures (after GET PERNR) are internal tables loaded with data.
The infotype records (selected within the period) are processed sequentially by the PROVIDE - ENDPROVIDE loop.
GET PERNR.
PROVIDE * FROM Pnnnn BETWEEN PN/BEGDA AND PN/ENDDA
If Pnnnn-XXXX = ' '. write:/ Pnnnn-XXXX. endif.
ENDPROVIDE.
Period-Related Data
All infotype records are time stamped.
IT0006 (Address infotype)
01/01/1990 12/31/9999 present
Which record to be read depends on the date selection period specified on the
selection screen. PN/BEGDA PN/ENDDA.
Current Data
IT0006 Address - 01/01/1990 12/31/9999 present
RP-PROVIDE-FROM-LAST retrieves the record which is valid in the data selection period.
For example, pn/begda = '19990931' pn/endda = '99991231'
IT0006 subtype 1 is resident address
RP-PROVIDE-FROM-LAST P0006 1 PN/BEGDA PN/ENDDA.
hope it will be of help to u.
2006 Oct 09 8:10 AM
Data Retrieval from LDB
1. Create data structures for infotypes.
INFOTYPES: 0001, "ORG ASSIGNMENT
0002, "PERSONAL DATA
0008. "BASIC PAY
2. Fill data structures with the infotype records.
Start-of-selection.
GET PERNR.
End-0f-selection.
Read Master Data
Infotype structures (after GET PERNR) are internal tables loaded with data.
The infotype records (selected within the period) are processed sequentially by the PROVIDE - ENDPROVIDE loop.
GET PERNR.
PROVIDE * FROM Pnnnn BETWEEN PN/BEGDA AND PN/ENDDA
If Pnnnn-XXXX = ' '. write:/ Pnnnn-XXXX. endif.
ENDPROVIDE.
Period-Related Data
All infotype records are time stamped.
IT0006 (Address infotype)
01/01/1990 12/31/9999 present
Which record to be read depends on the date selection period specified on the
selection screen. PN/BEGDA PN/ENDDA.
Current Data
IT0006 Address - 01/01/1990 12/31/9999 present
RP-PROVIDE-FROM-LAST retrieves the record which is valid in the data selection period.
For example, pn/begda = '19990931' pn/endda = '99991231'
IT0006 subtype 1 is resident address
RP-PROVIDE-FROM-LAST P0006 1 PN/BEGDA PN/ENDDA.
hope it will be of help to u.
2006 Oct 09 8:21 AM
2006 Oct 09 10:04 AM
Your PROVIDE is similar to a JOIN in a SELECT statement.. to replace it with a loop, you have to do nested loop. ie
loop at p0001 where endda ge '20020401' AND begda le '20061001'.
loop at p0016 where pernr eq p0001-pernr and endda ge p0001-begda
and begda le p0001-endda.
endloop.
endloop.
But why do you want to replace the PROVIDE?
~Suresh
2006 Oct 09 10:16 AM
thank you, that solved my problem (rewarded points).
i needed to replace the PROVIDE, because i'm using the tables in a function module, and apparantly PROVIDE doesn't work with parameters.
2006 Oct 09 10:20 AM
hi
good
go through this link,
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/provide.htm
thanks
mrutyun^