‎2008 Apr 14 5:06 AM
Dear All,
I have an internal table - itab, which has 2 fields. I would like to know how i can i read the values stored at index 1 into 2 different variables.
eg: internal table
matnr | date
ABC | 2.1.2000
XYZ | 2.1.2004
CVF | 2.1.2007
i want to read only the values stored at index 1 of matnr into a variable var_matnr & date into var_date
i.e. var_matnr = ABC & var_date = 2.1.2000
If it is not possible to manage this with a READ, any alternative way?
Await inputs.
Vivek
‎2008 Apr 14 5:12 AM
Hi Vivek,
You can read the values to a work area and then assign it like...
declare a workarea type the same as internal table...
read table int_table into workarea index 1.
var_matnr = workarea-matnr . "ABC
var_date = workarea-date . "2.1.2000
clear workarea.
This is the easiest way....
Regards
Byju
‎2008 Apr 14 5:12 AM
Hi Vivek,
You can read the values to a work area and then assign it like...
declare a workarea type the same as internal table...
read table int_table into workarea index 1.
var_matnr = workarea-matnr . "ABC
var_date = workarea-date . "2.1.2000
clear workarea.
This is the easiest way....
Regards
Byju
‎2008 Apr 14 5:13 AM
Hi,
yes yaar u can do.
u can use
READ TABLE <table name> INTO <workarea> WITH KEY MATNR = ............ DATE = ..........
or
u can use this if the record is the first record in the internal table.
READ TABLE <table name> INTO <workarea> INDEX 1.
<REMOVED BY MODERATOR>
RAAM
Edited by: Alvaro Tejada Galindo on Apr 14, 2008 6:18 PM
‎2008 Apr 14 5:20 AM
Hi Vivek,
Do this way...
data : wa like itab, " wa shd hv similar structure as itab Or if hv itab with header line then no need of work area..
var1 type mara-matnr,
var2 type sy-datum.
read table itab into wa index 1.
var1 = wa-matnr .
var2 = wa-date .
clear wa.
Hope it will solve your problem
Thanks & Regards
ilesh 24x7
‎2008 Apr 14 7:30 AM
Dear All,
Thank you very much for your quick help & guidance.
Keep the good work going.
Regards,
Vivek