2013 Oct 03 6:56 AM
Hi Experts,
Need your help in using PROVIDE statement. Checked many other forums, but none solved the problem for me.
Scenario:
I have 2 internal tables IT_0001 and IT_9001. There could be around 10 records in IT0001 but IT9001 might not have equal number of records as of 0001. However, for each record of IT_0001, there will always be a VALID record in that date interval in IT_9001.
I am looping the IT_0001 table as of now, but that is taking too much time. I understand that PROVIDE statement can solve this problem. Can anyone please help in suggesting a possible code for this? this is important and urgent.
rewards points will be given.
thanks,
regards
parteek
Hi Experts,
Need your help in using PROVIDE statement. Checked many other forums, but none solved the problem for me.
Scenario:
I have 2 internal tables IT_0001 and IT_9001. There could be around 10 records in IT0001 but IT9001 might not have equal number of records as of 0001. However, for each record of IT_0001, there will always be a VALID record in that date interval in IT_9001.
I am looping the IT_0001 table as of now, but that is taking too much time. I understand that PROVIDE statement can solve this problem. Can anyone please help in suggesting a possible code for this? this is important and urgent.
rewards points will be given.
thanks,
regards
parteek
2013 Oct 03 6:35 PM
2013 Oct 03 10:18 PM
Hi,
Check this: http://sapbrainsonline.com/abap-tutorial/syntax/provide-abap-keyword.html
Regards
Basar Ozgur
2013 Oct 04 12:17 AM
Hi,
Good choice - the PROVIDE statement is very powerful for handling internal tables with date ranges, but it is a little hard to understand at first.
(Note: It's been a awhile since I did HR programming, so things may have changed)
Here's an example:
PROVIDE * FROM ITAB1
* FROM ITAB2
BETWEEN lv_start_date AND lv_end_date
WHERE ITAB1-myfield = 'X'. "some field / value
WRITE: / ITAB1-name, ITAB2-address.
ENDPROVIDE.
This will give you a list of all the valid combinations of names and addresses from ITAB1 and ITAB2.
By 'valid', I mean name/address combinations that remained the same during a date range.
To use this, your internal tables need to have header lines (alternatively, you can specify a work area).
They also have to have 2 date (or time) fields that specify the start and end of each period (these are usually assumed to be the first two fields, but you can specify otherwise).
Does that help?
cheers
Paul
2013 Oct 04 4:12 AM
Hi Parteek Arora,
PROVIDE FIELDS {*|{comp1 comp2 ...}}
FROM itab1 INTO wa1 VALID flag1
BOUNDS intliml1 AND intlimu1
[WHERE log_exp1]
FIELDS {*|{comp1 comp2 ...}}
FROM itab2 INTO wa2 VALID flag2
BOUNDS intliml2 AND intlimu2
[WHERE log_exp2]
...
BETWEEN extliml AND extlimu
[INCLUDING GAPS].
...
ENDPROVIDE.
For more information on PROVIDE see this link
2013 Oct 04 5:15 AM
2013 Oct 04 5:36 AM
Hi
Pls try this. Hope it helps.
Infotypes : 0001, 9001.
Get pernr.
Provide * from p0001
* from p9001
BETWEEN pn-begda and pn-endda.
WRITE : 'Text :' , p0001-fieldname.
WRITE : 'Text :' , p9001-fieldname.
ENDPROVIDE.
Regards
2013 Oct 04 6:29 AM
Hi,
The statements PROVIDE and ENDPROVIDE define a loop through a statement block. In this loop, any number of internal tables are processed together. A single table can appear several times. It provides you all the DATA from that internal table valid within that DATE period. It is mainly used in LDB.
PROVIDE FIELDS * FROM table1 INTO wa1
VALID flag1
BOUNDS col1 AND col2
FIELDS * FROM table2 INTO wa2
VALID flag2
BOUNDS col1 AND col2
BETWEEN 2 AND 14.
Wa1 and wa2 are workareas and flag1 and flag2 area charater type datatype with length 1.These components are filled with values in the loop,the flag will get filled with 'X' and workarea with the values. BETWEEN is used to specify an interval .
Check this thread
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |