‎2008 May 06 1:21 PM
Hi Experts,
is it possible to evaluate many select-options-fields
based on an internal table.
Suppose an itab with more than thousand rows and abaout 80 columns. Users input in Select-Options-fields must be
evaluated whether the entries of itab are IN select-options fields? If so how is this working ?
Regards
ertas
‎2008 May 06 1:28 PM
sure this will work.
if itab-fielda in select-option.
endif.
sorry, I read message again, and it looks that you want to evaluate not ONE but SEVERAL select-options, correct?
If so, use this for example:
loop at itab into wa where fielda in so1
and fieldb in so2.
endloop.
Edited by: Micky Oestreich on May 6, 2008 2:37 PM
‎2008 May 06 1:28 PM
sure this will work.
if itab-fielda in select-option.
endif.
sorry, I read message again, and it looks that you want to evaluate not ONE but SEVERAL select-options, correct?
If so, use this for example:
loop at itab into wa where fielda in so1
and fieldb in so2.
endloop.
Edited by: Micky Oestreich on May 6, 2008 2:37 PM
‎2008 May 06 1:28 PM
Hello,
You can do this using events on fields, like for example: AT SELECTION-SCREEN and AT SELECTION-SCREEN ON <parameter|select-options> .
REPORT demo_at_selection_screen.
* Global data
DATA: sflight_tab TYPE TABLE OF sflight,
sflight_wa LIKE LINE OF sflight_tab.
* Selection screens
PARAMETERS p_carrid TYPE spfli-carrid.
SELECTION-SCREEN BEGIN OF SCREEN 500.
SELECT-OPTIONS s_conn FOR sflight_wa-connid.
DATA s_conn_wa LIKE LINE OF s_conn.
SELECTION-SCREEN END OF SCREEN 500.
* Handling selection screen events
AT SELECTION-SCREEN ON p_carrid.
IF p_carrid IS INITIAL.
MESSAGE 'Please enter a value' TYPE 'E'.
ENDIF.
AUTHORITY-CHECK OBJECT 'S_CARRID'
ID 'CARRID' FIELD p_carrid
ID 'ACTVT' FIELD '03'.
IF sy-subrc = 4.
MESSAGE 'No authorization for carrier' TYPE 'E'.
ELSEIF sy-subrc <> 0.
MESSAGE 'Error in authority check' TYPE 'A'.
ELSE.
IF sy-ucomm = 'ONLI'.
CALL SELECTION-SCREEN '0500'.
ENDIF.
ENDIF.
AT SELECTION-SCREEN.
IF sy-dynnr = '0500'.
IF s_conn IS INITIAL.
MESSAGE 'Please enter values' TYPE 'W'.
ELSE.
SELECT *
FROM sflight
INTO TABLE sflight_tab
WHERE carrid = p_carrid AND
connid IN s_conn.
IF sy-subrc <> 0.
MESSAGE 'No flights found' TYPE 'E'.
ENDIF.
ENDIF.
ENDIF.
* Main program
START-OF-SELECTION.
...
Regards,
‎2008 May 06 2:01 PM
Hi,
You can validate a select-option field through a table i am sending the code for it.
Validate Cost Center
IF s_cc IS NOT INITIAL.
SELECT kostl " Cost Center
INTO fs_csks
FROM csks
UP TO 1 ROWS
WHERE kostl IN s_cc
AND datbi GT sy-datum.
ENDSELECT.
IF sy-subrc NE 0.
SET CURSOR FIELD 'S_CC-LOW'.
MESSAGE e000(zi) WITH text-006.
ENDIF. " IF sy-subrc NE 0.
ENDIF. " IF s_cc is NOT INITIAL.
If you want to validate from a interna table then use this code
loop at i_csks INTO fs_csks
where kostl IN s_cc.
endloop.
if fs_csks is initial.
MESSAGE e000(zi) WITH text-006.
endif.
Reward some points.
Bye,
Anomitro