‎2011 Aug 25 1:51 PM
Hi,
I have the requirement to create a selection screen with 3 select options. Two of them are cross-dependent. It is mandatory to fill one of them and it is not allowed to fill both. The third one is optional. I tried the validation at selection-screen on block... and I have a problem that search help buttons for select options react like execution buttons, when I press any of them I am getting one of errors instead of search help.
Any help on this issue would be appreciated.
Here is my code:
DATA:
so_rbkp TYPE rbkp,
so_mseg TYPE mseg.
SELECTION-SCREEN BEGIN OF BLOCK blok WITH FRAME.
SELECT-OPTIONS:
s_fakt FOR so_rbkp-belnr,
s_matdok FOR so_mseg-mblnr,
s_god FOR so_mseg-gjahr.
SELECTION-SCREEN END OF BLOCK blok.
INITIALIZATION.
SET TITLEBAR '0100'.
START-OF-SELECTION.
AT SELECTION-SCREEN on block blok.
if s_fakt <> space and s_matdok <> space.
MESSAGE 'Message1' TYPE 'E'.
elseif s_fakt = space and s_matdok = space.
MESSAGE 'Message2' TYPE 'E'.
endif.
ENDIF.
‎2011 Aug 25 2:18 PM
Only perform the check when user wants to execute or submit the program, not when pressing F4 or even Enter, but in a selection-screen event, before START-OF-SELECTION which were program would terminate in error :
TABLES: SSCRFIELDS.
* ...
AT SELECTION-SCREEN OB BLOCK b01.
IF sscrfields-ucomm EQ 'ONLI'
OR sscrfields-ucomm EQ 'PRIN'
OR sscrfields-ucomm EQ 'SJOB'.
IF s_fakt[] IS NOT INITIAL AND s_matdok IS NOT INITIAL.
MESSAGE 'Message1' TYPE 'E'.
ELSEIF s_fakt[] IS INITIAL and s_matdok[] IS INITIAL.
MESSAGE 'Message2' TYPE 'E'.
ENDIF.
ENDIF.(You could also always send the message, but using type 'E' for those function code and 'S' status for any other value.)
Regards,
Raymond
‎2011 Aug 25 2:02 PM
Hi,
Try the below code. This will not get triggered until you wont execution button.
START-OF-SELECTION.
if s_fakt = space and s_matdok = space.
MESSAGE 'Message1' TYPE 'E'.
elseif s_fakt <> space and s_matdok <> space.
MESSAGE 'Message2' TYPE 'E'.
endif.
Shiva
‎2011 Aug 25 2:20 PM
I tried your code, but if it happens the situation which produces an error, I jump out of program and I should stay at selection screen to make necessary changes.
‎2011 Aug 25 2:47 PM
Raymond, your code solved my problem, but with START-OF-SELECTION command after AT SELECTION-SCREEN.
Tnx a lot.
‎2011 Aug 25 2:14 PM
Hi,
You have placed your screen validation "AT SELECTION SCREEN on BLOCK" after "START-OF-SELECTION". And because of this whenver you press F8, your check is get executed and so you are getting the error.
Please place your screen validation before "START-OFSELECTION" as below and then try.
Hope this will be helpful
Regards,
S.Meganadhan
‎2011 Aug 25 2:18 PM
Only perform the check when user wants to execute or submit the program, not when pressing F4 or even Enter, but in a selection-screen event, before START-OF-SELECTION which were program would terminate in error :
TABLES: SSCRFIELDS.
* ...
AT SELECTION-SCREEN OB BLOCK b01.
IF sscrfields-ucomm EQ 'ONLI'
OR sscrfields-ucomm EQ 'PRIN'
OR sscrfields-ucomm EQ 'SJOB'.
IF s_fakt[] IS NOT INITIAL AND s_matdok IS NOT INITIAL.
MESSAGE 'Message1' TYPE 'E'.
ELSEIF s_fakt[] IS INITIAL and s_matdok[] IS INITIAL.
MESSAGE 'Message2' TYPE 'E'.
ENDIF.
ENDIF.(You could also always send the message, but using type 'E' for those function code and 'S' status for any other value.)
Regards,
Raymond