‎2008 Jan 16 3:17 PM
Hi,
I have the following situation:
itab1: bukrs kostl gjahr monat amount1 amount2
itab2: bukrs kostl gjahr hsl01 hsl02.......hsl12
I need to get the amount2 of itab1 from itab2.
monat is the period in itab1 but in itab2 hsl01 is the amount for period 01.
This is the code that i have so far:
loop at itab1 into wa_itab2.
read table itab2 into wa_itab2 with key bukrs = wa_itab1-bukrs
kostl = wa_itab1-kostl
gjahr = wa_itab1-gjahr
concatenate 'wa_itab2-hsl' monat into l_amnt.
wa_itab1-amount2 = ?
endloop.
How do i get the value of l_amnt?
Thanks,
MJ
‎2008 Jan 16 3:24 PM
I think you are going to want to use a field symbol here.
data: HSL_Field(20) type c.
field-symbols: <fs>.
loop at itab1 into wa_itab1. "<--- Change this to WA_ITAB1
read table itab2 into wa_itab2 with key bukrs = wa_itab1-bukrs
kostl = wa_itab1-kostl
gjahr = wa_itab1-gjahr
* Here we are assuming the MONAT has values like 01,02,03,04,....12
concatenate 'WA_ITAB2-HSL' wa_itab1-monat into hsl_field.
condense hsl_field no-gaps.
* Assign to the field symbol
assign (hsl_field) to <fs>.
wa_itab1-amount2 = <fs>.
modify itab1 from wa_itab1 index sy-tabix.
endloop.
Regards,
Rich Heilman
‎2008 Jan 16 3:24 PM
I think you are going to want to use a field symbol here.
data: HSL_Field(20) type c.
field-symbols: <fs>.
loop at itab1 into wa_itab1. "<--- Change this to WA_ITAB1
read table itab2 into wa_itab2 with key bukrs = wa_itab1-bukrs
kostl = wa_itab1-kostl
gjahr = wa_itab1-gjahr
* Here we are assuming the MONAT has values like 01,02,03,04,....12
concatenate 'WA_ITAB2-HSL' wa_itab1-monat into hsl_field.
condense hsl_field no-gaps.
* Assign to the field symbol
assign (hsl_field) to <fs>.
wa_itab1-amount2 = <fs>.
modify itab1 from wa_itab1 index sy-tabix.
endloop.
Regards,
Rich Heilman
‎2008 Jan 16 3:29 PM