‎2008 Feb 28 5:15 AM
Hi SAP Gurus ,
in the following code i m not able 2 get range for the full year .plz help me .
SELECT-OPTIONS : MONTH2 FOR Ztable-month2 .
loop at month2.
IF MONTH2-low eq '1' .
PERFORM JAN_DATA .
ENDIF .
IF MONTH2-low eq '2'.
PERFORM FEB_DATA .
ENDIF .
endloop
‎2008 Feb 28 5:22 AM
Hi Ranjna,
You will get your answer when you debug the program and check how MONTH2 is populated. It depends on how you will the range.
You might be aware that a select option like a range has the following fields:
SIGN, OPTION, LOW and HIGH
Now, say you put from 1 to 12 in your select option on the selection screen, then only one record will be created in the MONTH2 range table as follows:
SIGN OPTION LOW HIGH
I BT 1 12.
Hence, when you loop through MONTH2, there will be only one value for LOW i.e. 1.
You need to instead do the following:
data: begin of itab occurs 0, month2 type ztable-month2, end of itab.
SELECT month2 FROM ztable INTO TABLE itab
WHERE month2 IN month2.
IF sy-subrc EQ 0.
LOOP AT itab.
CASE itab-month2.
WHEN '1'.
PERFORM JAN_DATA .
WHEN '2'.
PERFORM FEB_DATA .
ENDCASE.
ENDLOOP.
ENDIF.
Cheers.
‎2008 Feb 28 5:18 AM
‎2008 Feb 28 5:22 AM
thanks .
in the selection screen i have to write each month individually , but i want to give range e.g zmonth 1 to 12.
than it should display for 12 month , but it is showing for jan month ie not takinh high value .
‎2008 Feb 28 5:32 AM
Hi, Pasting your code esp. in routines JAN_DATA & FEB_DATA can get you better solutions in handling your requirement. Maybe the select-option parameter can be used directly in data extraction instead of looping on SELECT-OPTION.
‎2008 Feb 28 5:20 AM
‎2008 Feb 28 5:22 AM
Hi Ranjna,
You will get your answer when you debug the program and check how MONTH2 is populated. It depends on how you will the range.
You might be aware that a select option like a range has the following fields:
SIGN, OPTION, LOW and HIGH
Now, say you put from 1 to 12 in your select option on the selection screen, then only one record will be created in the MONTH2 range table as follows:
SIGN OPTION LOW HIGH
I BT 1 12.
Hence, when you loop through MONTH2, there will be only one value for LOW i.e. 1.
You need to instead do the following:
data: begin of itab occurs 0, month2 type ztable-month2, end of itab.
SELECT month2 FROM ztable INTO TABLE itab
WHERE month2 IN month2.
IF sy-subrc EQ 0.
LOOP AT itab.
CASE itab-month2.
WHEN '1'.
PERFORM JAN_DATA .
WHEN '2'.
PERFORM FEB_DATA .
ENDCASE.
ENDLOOP.
ENDIF.
Cheers.
‎2008 Feb 28 5:25 AM
Hi Ranjna,
Is month2 your Internal Table. Here you have specified as the name of Select Options.
pls you have to loop it on internal table and then check tht month2-low is equal to your condition or not...
Thanks & regards,
Dhruv Shah