‎2009 Jun 25 2:10 AM
hi gurus plz solve this:
what is the difference between 'at selection-screen' and 'at selection-screen on p_vbeln'
"p_vbeln is a parameter."
if i use select-options then will i have to use 'at selection-screen on s_vbeln-low or s_vbeln-high' ? during the input validation check of select-options which select statement will i use? 'select up to 1 row' or 'select single' or 'select up to n rows' . plz explain with coding. answers will be appreciated.
‎2009 Jun 25 5:17 AM
Hi Roy,
We can use at-selection screen for validating some screen fields see below example,
AT SELECTION-SCREEN OUTPUT.
*Inactive Fields depending on the radio button
LOOP AT SCREEN.
IF p_r1 = 'X'.
IF screen-group1 = 'B'.
screen-active = 0.
ENDIF.
ELSEIF p_r2 = 'X'.
IF screen-group1 = 'A'.
screen-active = 0.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
and in the second case at selection-screen on <field> - is used to validate the field.
if it is select-options then you can give
at selection-screen on s_matnr(for example).
‎2009 Jun 25 2:24 AM
Hi,
You need to write
at selection-screen on s_vbeln.
" write select statement to validate s_vbeln value.
If you have the full primary key then you can use SELECT SINGLE else use SELECT UPTO
Refer to this link..http://help.sap.com/saphelp_nw04/helpdata/EN/9f/db9a2e35c111d1829f0000e829fbfe/frameset.htm for difference between 'at selection-screen' and 'at selection-screen on p_vbeln'
‎2009 Jun 25 5:17 AM
Hi Roy,
We can use at-selection screen for validating some screen fields see below example,
AT SELECTION-SCREEN OUTPUT.
*Inactive Fields depending on the radio button
LOOP AT SCREEN.
IF p_r1 = 'X'.
IF screen-group1 = 'B'.
screen-active = 0.
ENDIF.
ELSEIF p_r2 = 'X'.
IF screen-group1 = 'A'.
screen-active = 0.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
and in the second case at selection-screen on <field> - is used to validate the field.
if it is select-options then you can give
at selection-screen on s_matnr(for example).
‎2009 Jun 25 12:37 PM
Hi,
At selection screen is used for selection screen validation. If you need to validate a specific parameter then you use the addition on p_vbeln etc. If you need to check that the user has entered a valid document number in a range say s_vbeln, then you may write
at selection-screen on s_vebeln.
select single vbeln from vbak into v_vbeln where vbeln in s_vbeln.
if sy-subrc <> 0.
message 'Invalid Sales Document number entered' type 'E'.
endif.
Select single is a better approach if in the where clause the entire key for the database table is mentioned. Say in the above example table vbak has key field as vbeln.
If the key fields are not involved in the where clause the better approach would be upto 1 rows as single will not use the defined index on the database table for faster access if key is not involved in the where clause.
When you use at selection screen and throw an error message the input is disabled. In case of using at selection-screen on parameter/select option the input field on which it is applied, in ready for input after the error message.
This will display an error message when all the entered doc numbers are invalid. If anyone is correcr rhis error will not trigger.
Hope this helps.
Regards,
Sachin