‎2008 Dec 03 3:58 PM
hi,
is there a nice idea to loop at select options (table) and store all values (sorted) in one itab ?
example:
select options: matnr type matnr.
input:
range: 1 to 5
single: 8, 9 & 10
exclude: 3
Result:
1
2
3
4
8
9
10
Ideas ?
‎2008 Dec 04 4:59 AM
Hi,
YOu can do something like this.
Take another range eg R_RNAGE2
and put all crietria from the select options into this (including the excluded ones as well )
then you can fire a SELECT on the R_RANGE2.
If you want the excluded ranges seperately then you might want to have 2 differnt ranges.
r_rang2 for excluded select options and
r_range3 for included values of select options.
Is this your requirement????
I hope this helps,
Raj
‎2008 Dec 03 4:00 PM
why don't you do a SELECT?
SELECT field
FROM ...
INTO TABLE ...
WHERE field IN select_option.
‎2008 Dec 03 4:05 PM
I need a include and exclude output.
select mara where matnr in ... shows only included values.
for that reason i need either the excluded values, too or the whole select options in one extra itab.
‎2008 Dec 03 4:30 PM
OK, I see now, but this could be tough...
One starting point is to LOOP on the select option:
in your example you have a range first, now it is a decision, if you simply copy the values (from 1 to 5 in your example) or do a select (just in case the value 4 does not exist for example), this would result in a SELECT inside the LOOP, which is something we don't like
on the other hand, again in your example, the value 3 is excluded, while in the first line, in the interval 1 to 5 is included. Now it is easy because the include comes before the exclude, but it could be other way around. How would you check that?
At this point I realise however that the simpliest way would be to start like I suggested in my first reply:
1. Do a select with the select option, values into internal table.
2. LOOP at the select option, but only on the lines where exclusions are and append the excluded values into the internal table, by single values it is simple (now you can check is the value is included already and simply change its sign, otherwise you need a new line), by excluded ranges again you have to make decision, which way to follow....
‎2008 Dec 03 10:34 PM
hi Gordon,
Loop over your select-options and modify sign where it is 'E'.
loop at matnr where sign = 'E'.
matnr-sign = 'I'.
modify matnr index sy-tabix.
endloop.
Hope it helps!
Monalisa
‎2008 Dec 03 11:52 PM
Hi
You can try this way...
&----
*& Report YTEST
*&
&----
*&
*&
&----
REPORT ytest.
TABLES: mara.
DATA: BEGIN OF itab OCCURS 0,
ans TYPE blanz,
END OF itab,
lf_val TYPE blanz.
SELECT-OPTIONS: s_int FOR mara-blanz.
START-OF-SELECTION.
LOOP AT s_int WHERE sign = 'I'.
CLEAR lf_val.
IF s_int-option = 'EQ'.
lf_val = s_int-low.
APPEND lf_val TO itab.
ELSEIF s_int-option = 'BT'.
lf_val = s_int-low.
APPEND lf_val TO itab.
WHILE lf_val < s_int-high.
lf_val = lf_val + 1.
APPEND lf_val TO itab.
IF lf_val EQ s_int-high.
EXIT.
ENDIF.
ENDWHILE.
ENDIF.
ENDLOOP.
SORT itab BY ans.
LOOP AT s_int WHERE sign = 'E'.
CLEAR lf_val.
IF s_int-option = 'EQ'.
lf_val = s_int-low.
DELETE itab WHERE ans = lf_val.
ELSEIF s_int-option = 'BT'.
lf_val = s_int-low.
DELETE itab WHERE ans = lf_val.
WHILE lf_val < s_int-high.
lf_val = lf_val + 1.
DELETE itab WHERE ans = lf_val.
IF lf_val EQ s_int-high.
EXIT.
ENDIF.
ENDWHILE.
ENDIF.
ENDLOOP.
SKIP 2.
WRITE:/ 'Result:'.
LOOP AT itab.
WRITE:/ itab-ans.
ENDLOOP.
Regards
Raj
‎2008 Dec 04 4:48 AM
Hi,
I have a doubt:
do you find your result is wrong?
I think it should be like:
1
2
4
5
8
9
10
Right???
Regards,
Chris Gu
‎2008 Dec 04 4:59 AM
Hi,
YOu can do something like this.
Take another range eg R_RNAGE2
and put all crietria from the select options into this (including the excluded ones as well )
then you can fire a SELECT on the R_RANGE2.
If you want the excluded ranges seperately then you might want to have 2 differnt ranges.
r_rang2 for excluded select options and
r_range3 for included values of select options.
Is this your requirement????
I hope this helps,
Raj
‎2008 Dec 04 9:24 AM
HI,
thanks for your reply. I think i can use another option.
Can you show me how to enable only "single values" allowed in Select Options ?
Range and excludes are not allowed.
Thx,
Gordon
‎2008 Dec 04 9:28 AM
>
> Can you show me how to enable only "single values" allowed in Select Options ?
> Range and excludes are not allowed.
when you define the select option:
SELECT OPTIONS : ... FOR ... NO INTERVALS.
‎2008 Dec 04 9:29 AM
‎2008 Dec 04 9:43 AM
Hi use the following addition in your select options.
no intervals no-extension
‎2008 Dec 04 10:07 AM
hi,
"no intervals" is working fine. The select option shows only one inputbox but it´s still possible to enter a rannge in the popupbox.
Any ideas to avoid ranges in that popup box ?
What about loop at screen and disable elements ?
Thx,
Gordon
‎2008 Dec 04 10:17 AM
Hi
U can use the fm SELECT_OPTIONS_RESTRICT in the event INITIALIZATION in order to hide the range
Max
‎2008 Dec 04 10:17 AM
hi..
what ever data like the range or the single date just enter into the select-option .
by clicking the icon side to it.
and just use the same select-option ( ex: s_ebeln)
in the where condition like
WHERE EBELN in S_EBELN.
it will work fill for all u r intervals and the single valuse entered in the selection screen.
tye it.. all the best..
UR's
GSANA
‎2008 Dec 04 10:29 AM
Hi
This is sample:
tables: mara.
select-options s_matnr for mara-matnr.
type-pools SSCR.
DATA: rest TYPE sscr_restrict,
optl TYPE sscr_opt_list,
sass TYPE sscr_ass.
initialization.
optl-name = 'EQ'.
optl-options-eq = 'X'.
optl-options-BT = 'X'.
APPEND optl TO resT-opt_list_tab.
sass-kind = 'S'.
Sass-name = 'S_MATNR'.
Sass-sg_main = 'I'.
Sass-sg_addy = ' '.
Sass-op_main = 'EQ'.
Sass-op_addy = 'EQ'.
APPEND Sass TO rest-ass_tab.
CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
EXPORTING
RESTRICTION = rest.Max