‎2009 Mar 18 5:50 AM
Hi all,
I am developing a sales report. In this report, I am giving for e.g. subfamily code as input. The user wants the input field with intervals and with extension as it is always in standard sap reports.
My requirement is that I need to restrict this selection only for particular sub-family codes i.e. 401, 402, 403, 404, 501. suppose if the user enters 401 to 503.
The select options internal table would have this value : sign - I, option - BT, low - 401, high - 503.
so, now I need to validate this range of values, whether it contains any of the pre-defined sub-family codes i.e. 401, 402, 403, 404, 501).
And, I have to display an error if it doent contain pre-defined sub-family codes (i.e. 401, 402, 403, 404, 501).
How to do this.....Please suggest me logic and also if possible let me know if there is any special keywords to loop/access select options internal table values
Thanks,
Rajan
‎2009 Mar 18 6:17 AM
Hi Rajan,
Try this out:
AT SELECTION-SCREEN ON <select-options>.
IF NOT ( '401' IN <select-options> AND '402' IN <select-options>
'403' IN <select-options> AND '404' IN <select-options>
'501' IN <select-options> ).
* Issue your error message over here.
ENDIF.Regards,
Lim...
‎2009 Mar 18 5:54 AM
at selection-screen.
loop at select-option (its a table be default).
cehck for entries for both select-low and select-high with the predefoned values.
if not found ==> ERROR
else.
continue.
endif.
endloop.
‎2009 Mar 18 6:01 AM
I always create another ranges table, and select from the master data table of this check field.
DATA: rwerks TYPE RANGES OF werks_d.
DATA wwerks LIKE LINE OF rwerks.
...
wwerks-sign = 'I'.
wwerks-option = 'EQ'.
SELECT werks AS low FROM t001w INTO wwerks-low WHERE werks IN s_werks.
AUTHORITY-CHECK....
IF sy-subrc NE 0.
MESSAGE 'Contain illigal data!' TYPE 'E'.
ELSE.
APPEND wwerks TO rwersk.
ENDIF.
ENDSELECT.
‎2009 Mar 18 6:15 AM
Hi Qiang,
My problem arises if user enters multiple/range inputs i.e. subfam-sign = I; subfam-option = BT ; subfam-low = 401; subfam-high = 503.
Thanks
Rajan
‎2009 Mar 18 6:05 AM
There is a special keyword to access the select-options in loop or select-queries....
the keyword is 'IN'
in the condition just mention it in this way....
where sub-family IN select-option..
for negation you can use...
where sub-family NOT IN select-option.
Regards,
Siddarth
‎2009 Mar 18 6:07 AM
The select options internal table would have this value : sign - I, option - BT, low - 401, high - 503.
If we use range 401 and 503 all values between the range will be taken say 499 also.
So take 401, 402, 403, 404, 501 values into an internal table say -->itab with header line.
At selection-screen.
If S_field-low GE 401 and S_field-HIGH LE 503.
Loop at S_fields.
Read table itab with key = S_field-low.
IF sy-subrc ne 0.
S_field-low = ' '.
ENDIF.
Read table itab with key = S_field-high.
IF sy-subrc ne 0.
S_field-HIGH= ' '.
ENDIF.
Modify s_field.
ENDLOOP.
ELSE.
Message 'ERROR' TYPE 'E'.
ENDIF.Regards,
Gurpreet
‎2009 Mar 18 6:17 AM
Hi Rajan,
Try this out:
AT SELECTION-SCREEN ON <select-options>.
IF NOT ( '401' IN <select-options> AND '402' IN <select-options>
'403' IN <select-options> AND '404' IN <select-options>
'501' IN <select-options> ).
* Issue your error message over here.
ENDIF.Regards,
Lim...
‎2009 Mar 18 9:22 AM
Thanks a lot! Ruslim
Your suggestion solved my problem. Awarding you max points.
Once again thanks
Rajan
‎2009 Mar 18 6:19 AM
AT SELECTION-SCREEN.
LOOP AT S_BUKRS.
IF S_BUKRS-LOW GE '401' AND S_BUKRS-HIGH LE '503'.
ELSE.
MESSAGE ID 'ZMSG1' TYPE 'E' WITH TEXT-001.
ENDIF.
ENDLOOP.
Regards,
Joan