Application Development 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 data based on date in internal tables

Former Member
0 Kudos

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

5 REPLIES 5

Former Member
0 Kudos

Hi Priya,

Jus try this...

loop at itab1.

loop at itab2 where

( zfromdate le itab1-erdat and

ztodate ge itab1-erdat ).

...............

endloop.

endloop.

0 Kudos

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

Former Member
0 Kudos

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...

Former Member
0 Kudos

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.

Former Member
0 Kudos

than k u