2008 Nov 04 5:03 AM
Hi Abapers,
In my zreport , i am retreving data from vbrk, vbrp into one internal table ( itab1) and retreiving data from customized table i nto internal table itab2.
itab1 contains following fields.
matnr - Material code
erdat - date ( billing date).
itab2 contains following fields.
matnr - material code.
zfromdate - from date
ztodate - to date
zstprs - material price
loop at itab1 .
endloop.
how to read particular record from itab2 ( which consists of material code with price maintaing with date range ) based on my billing document date i.e erdat
ex: material code fromdate todate price
10000 01.11.2008 20.11.2008 100.
10000 21.11.2008 30.11.2008 104
if for example in itab1 , erdat ( billing doc date is 15.11.2008 ) , how to read first record in itab2 which will fall under that date range.
please give me any suggestions, or provide sample code.
regards,
Hari priya
Hi Abapers,
In my zreport , i am retreving data from vbrk, vbrp into one internal table ( itab1) and retreiving data from customized table i nto internal table itab2.
itab1 contains following fields.
matnr - Material code
erdat - date ( billing date).
itab2 contains following fields.
matnr - material code.
zfromdate - from date
ztodate - to date
zstprs - material price
loop at itab1 .
endloop.
how to read particular record from itab2 ( which consists of material code with price maintaing with date range ) based on my billing document date i.e erdat
ex: material code fromdate todate price
10000 01.11.2008 20.11.2008 100.
10000 21.11.2008 30.11.2008 104
if for example in itab1 , erdat ( billing doc date is 15.11.2008 ) , how to read first record in itab2 which will fall under that date range.
please give me any suggestions, or provide sample code.
regards,
Hari priya
2008 Nov 04 5:19 AM
Hi Priya,
Jus try this...
loop at itab1.
loop at itab2 where
( zfromdate le itab1-erdat and
ztodate ge itab1-erdat ).
...............
endloop.
endloop.
2008 Nov 04 7:57 AM
HI Mamatha,
i think first condition is ok , but todate condition is not correct because billing doc date may come under different date range...
regards,
Hari priya
2008 Nov 04 8:07 AM
can u be more clear on " billing doc date may come under diff date range.."
u hv to get those records from itab2..where the billin doc date shd fall between zfrom n zto for a particular material..??
hey forgot to include the condition for material number in my prev post...
2008 Nov 04 8:29 AM
Hi,
Please go in this way
while selecting fileds from table into itab2
select in this way
select * from <tablename> into tabel itab2 where
matnr = itab1-matnr and
zfromdate LE erdat and
ztodate GE erdat.
Loop at itab2.
read table itab1 with key matnr = itab2-matnr.
take ur fields into internal table
---
-
endloop.
2008 Nov 24 7:29 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |