10-10-2007 3:39 PM
Hi All,
I have problem to select fields in table COSR dynamically based on select-option field S_POSTD (if i enter period 2 to 4 i have to select SME002--SME004 Fields)
In below select-option (S_POSTPD) is entered onto the selection screen.....in COSR table there are 16 fields SME001,SME002...SME016. based on the period entered onto the selection screen we have pick up these fields from table COSR...suppose period entered onto the selection screen is from 2 to 4...then we have to pick SME002,SME003 and SME004. and sum up all four of these to get E1.
below is the logic wht i want:
. Logic for getting E1 :- From table COSR get values from fields SME001 to SME016, where if
Period 1 then SME001, if 2 then SME002 ..For entries with statistical key figure STAGR = CAPMW, WRTTP = 4 and OBJNR.
OBJNR - beginning with KS would be cost centers, next four characters are 2000 (Controlling area), followed by 10 digit cost center which is 221212.Do Summation of all SME001, SME002 etc derived.
Onto selection screen we have select-options for below field
Field name Field description Type Single/ Range/
Check box / Radio button Mandatory (Y/N) Default Value Validations
S_POSTPD Posting period from and To Numeric Range Y None
can you please help me to develop logic for this .
Regards,
Bhanu.
10-10-2007 3:54 PM
Hi
You can use...
Do 16 times varying lv_sme FROM SME001 NEXT SME002.
**Here you can check if you need SME001 or SME002 ....SME016
**Which ever value you need in that period
lv_count = lv_count + lv_sme.
enddo.
Regards
Navneet
10-10-2007 3:54 PM
Hi
You can use...
Do 16 times varying lv_sme FROM SME001 NEXT SME002.
**Here you can check if you need SME001 or SME002 ....SME016
**Which ever value you need in that period
lv_count = lv_count + lv_sme.
enddo.
Regards
Navneet
10-10-2007 5:27 PM
Hi
I think you need a code to copy paste.
Here it is
DATA:
i_cosr like standard table of cosr with header line,
lv_sme type cosr-sme01,
l_count type i.
select * from cosr into table i_cosr.
loop at i_cosr.
do 16 times varying lv_sme from i_cosr-sme001 next i_cosr-sme002.
add 1 to l_count.
if l_count IN S_POSTD.
l_value = l_value + lv_sme.
endif.
enddo.
endloop.
Regards
Navneet