Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

general

Former Member
0 Likes
1,574

How do you validate the selection criteria of a report?

And how do you display initial values in a selection screen?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,552

hi,

Initial values can be set to parameters on selection screen in INITIALIZATION section.

regards

Sailaja.

17 REPLIES 17
Read only

former_member673464
Active Contributor
0 Likes
1,552

hii...

Use selection-screen events to validate selection-screen and use initialization to give initial values to a selection-screen.

screen-events

at selection-screen output.

at selection-screen on value request

at selection-screen on help request

at selection-screen on block

Message was edited by:

veereshbabu ponnada

Read only

Former Member
0 Likes
1,552

select-options : s_matnr for mara-matnr default '10000' [to '20000']. <for default value to is not mandatory>.

<for validating use event at selection-screen>

at selection-screen.

if s_matnr-low = '10005'.

message 'chose any other mat no' type 'E'.

endif.

start-of-selection.

regards

shiba dutta

Read only

Former Member
0 Likes
1,552

Hi,

Use "AT SELECTION SCREEN ON FIELD." Event for Validation.

IF NOT p_werks IS INITIAL.

*

SELECT SINGLE werks

FROM t001w

INTO t001w

WHERE werks EQ p_werks.

  • IF not success

IF sy-subrc NE 0.

MESSAGE e001 WITH text-028.

ENDIF.

ENDIF.

Regards,

Suresh

Read only

Former Member
0 Likes
1,552

Hi Pinky,

<b>

Copy and paste this program.....</b>

parameters p_name(30) TYPE c.

INITIALIZATION.

p_name = 'PINKY'.

AT SELECTION-SCREEN.

*U can do validation here...

Regards,

V.Raghavender.

Read only

Former Member
0 Likes
1,552

Hi,

Try to use "F1" key on ABAP statements (as parameters, TYPE, LIKE ...)

Regards,

Stéphane.

Read only

Former Member
0 Likes
1,552

Hi Pinky,

By using the events we can get the Intial vales on the selection screen.

We can validate the fields by using the events.

INITIALIZATION Events provide the values on the selection screen.

AT SELECTION-SCREEN OUTPUT OR ON FIELD:

by using this function module we can validate the field or if u want to disable the screen or enable the screen this event we have to use.

If u want i will send the program.

******Rewards some points.

Rgds,

P.Naganjana Reddy

Read only

Former Member
0 Likes
1,552

HI,

Check this code

tables mara.

parameters: p_matnr like mara-matnr.

  • Default values for the Selection screen.

Intialization.

move '0001' to p_matnr.

*Selection Screen validation

at selection-screen on p_matnr.

select single * from mara where matnr = p_matnr.

if sy-subrc <> 0.

  • Send an error message

endif.

Read only

Former Member
0 Likes
1,552

Initial value is displayed by initilization event.

Ex:

Parameter p_locl  RADIOBUTTON GROUP g1.

initilization.

p_locl = 'X'.

Else you can also give in initial value while declaration like this:

PARAMETERS: p_locl RADIOBUTTON GROUP g1 " desktop file

DEFAULT 'X' USER-COMMAND fil.

Selection criteria will be validated in AT SELECTION-SCREEN.or AT SELECTION-SCREEN ON event.


AT SELECTION-SCREEN.

  DATA: l_werks TYPE werks,
        l_mtart TYPE mtart.

  IF sy-ucomm <> 'BDC' AND sy-ucomm NE 'FIL'
                       AND sy-ucomm NE '%002'
                       AND sy-ucomm NE '%003'.

    IF s_plant IS INITIAL.
      MESSAGE e000 WITH text-018.
    ENDIF.

    SELECT SINGLE werks FROM t001w INTO l_werks
                        WHERE werks = s_plant-low.

    IF sy-subrc <> 0.
      MESSAGE e000 WITH text-020.
    ENDIF.

    IF s_mat IS INITIAL.
      MESSAGE e000 WITH text-017.
    ENDIF.

    SELECT SINGLE mtart FROM t134 INTO l_mtart
                      WHERE mtart = s_mat-low.

    IF sy-subrc <> 0.
      MESSAGE e000 WITH text-016.
    ENDIF.

    IF p_locl EQ 'X' OR p_phys EQ 'X'.
      IF p_ofile IS INITIAL.
        SET CURSOR FIELD 'P_OFILE'.
        MESSAGE e000 WITH text-008.
        EXIT.
      ENDIF.
    ENDIF.

    IF p_sess EQ 'X'.
      IF p_group IS INITIAL.
        SET CURSOR FIELD 'P_GROUP'.
        MESSAGE e000 WITH text-009.
      ENDIF.
    ENDIF.

    IF p_ctu EQ 'X'.
      IF p_mode IS INITIAL.
        SET CURSOR FIELD 'P_MODE'.
        MESSAGE e000 WITH text-011.
      ENDIF.

      IF p_update IS INITIAL.
        SET CURSOR FIELD 'P_UPDATE'.
        MESSAGE e000 WITH text-012.
      ENDIF.

      IF p_error IS INITIAL.
        SET CURSOR FIELD 'P_ERROR'.
        MESSAGE e000 WITH text-010.
      ENDIF.
    ENDIF.

  ENDIF.

AT SELECTION-SCREEN ON p_mode.
  IF NOT p_mode IS INITIAL.
    IF p_mode NE 'N' AND
       p_mode NE 'E' AND
       p_mode NE 'A'.
      SET CURSOR FIELD 'P_MODE'.
      MESSAGE e000 WITH text-013.
    ENDIF.
  ENDIF.

AT SELECTION-SCREEN ON p_update.
  IF NOT p_update IS INITIAL.
    IF p_update NE 'S' AND
       p_update NE 'A' AND
       p_update NE 'L' .
      SET CURSOR FIELD 'P_UPDATE'.
      MESSAGE e000 WITH text-014.
    ENDIF.
  ENDIF.

Read only

alex_m
Active Contributor
0 Likes
1,552

Use AT-Selection screen event to validate screen fields.

for default values use VALUE addition in parameter.

Read only

Former Member
0 Likes
1,552

HI,

Check this code

tables mara.

parameters: p_matnr like mara-matnr.

  • Default values for the Selection screen.

Intialization.

move '0001' to p_matnr.

*Selection Screen validation

at selection-screen on p_matnr.

select single * from mara where matnr = p_matnr.

if sy-subrc <> 0.

  • Send an error message

endif.

Read only

Former Member
0 Likes
1,552

hi,

<b>At selection-screen output</b> : triggered when the selection screen is loaded in memory before being displayed.

so default values u can give here in this event

<b>At selection-screen :</b> before leaving the selection screen.

all validations

regards

reshma

Read only

Former Member
0 Likes
1,553

hi,

Initial values can be set to parameters on selection screen in INITIALIZATION section.

regards

Sailaja.

Read only

Former Member
0 Likes
1,552

Hi,

IN THE EVENT AT SELECTION-SCREEN we write the code

select-options: s_vkorg for tvko-vkorg ,

s_vtweg for tvtw-vtweg .

  • Validation of Sales Organization

clear tvko.

if not s_vkorg-low is initial.

select vkorg from tvko up to 1 rows

into tvko-vkorg

where vkorg in s_vkorg.

endselect.

if sy-subrc ne 0.

message e009. " Invalid Sales Organization

endif.

endif.

  • Validation of Distribution Channel

clear tvtw.

if not s_vtweg-low is initial.

select vtweg from tvtw up to 1 rows

into tvtw-vtweg

where vtweg in s_vtweg.

endselect.

if sy-subrc ne 0.

message e010. " Invalid Distribution Channel

endif.

endif.

In the INITIALIZATION event you can initilize the values

Initialization.

s_vkorg-low = '1000'.

s_vkorg-sign = 'I'.

s_vkorg-option = 'EQ'.

append s_vkorg.

s_vkorg-low = '1001'.

s_vkorg-sign = 'I'.

s_vkorg-option = 'EQ'.

append s_vkorg.

Reward points if useful

Regards

Anji

Read only

Former Member
0 Likes
1,552

hi dinky,

u can validate the user input in the at selection-screen event.

To display display default values u can use this within a selection screen event.

select-options : mat for mara-matnr default mat-low = '100' and mat-high = '200'.

Regards...

Arun.

Reward points if useful.

Read only

Former Member
0 Likes
1,552

Hi,

Try to use "F1" key on ABAP statements (as parameters, TYPE, LIKE ...)

Regards,

Stéphane.

PS: Use transaction ABAPDOCU and have a look at all ABAP examples ... You will learn lot of things on ABAP.

Read only

Former Member
0 Likes
1,552

hi Pinky,

1 . To Validate Selection Screen Fields ,you have to At Selection-Screen

Event.

2.To Display initial Values,you can assign the values in the selection option itself of you have assign the values in the Initialization Event.

Reward points if it is helpful.

Regards

Sangeetha.A

Read only

Former Member
0 Likes
1,552

Hi PINKY,

<b>HOPE you got ur answers..

PLEASE CLOSE THE THREAD AS ANSWERED if ur question is solved awarding points.</b>.

regards,

nazeer