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

Query in Selection screen!!!!

Former Member
0 Likes
974

Hi all,

I have a requirement which requires me to validate the data entered in the selection screen when the data entered in the selection screen is saved as a variant.

That is, when the save button in the selection screen is clicked, then the data entered in the selection screen should be validated.

Can anyone please tell me how to achive the above.

Regards,

Vijay

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
923

Hi,

Check the below sample code.Here the validation is value should be less than 100.

selection-screen begin of block b1 with frame title text-001.

parameters : p_p1 type i.

selection-screen end of block b1.

at selection-screen.

if sy-ucomm eq 'SPOS'.

if p_p1 gt 100.

message 'value should be less than 100' type 'E'.

endif.

endif.

Regards.

8 REPLIES 8
Read only

Former Member
0 Likes
923

Just code under initialization

WHEN 'SPOS'"function code for Saving variant
validate here...

Read only

former_member156446
Active Contributor
0 Likes
923

as said above..

if sy-ucomm = 'SPOS'.

"<<validate field

endif.

Read only

0 Likes
923

Read only

Former Member
0 Likes
923

While creating Infoset, (TCode SQ02)

Using the Code Tab, you have to specify your code under INITIALIZATION using this below SPOS condition.

If sy-ucomm = 'SPOS'.

"Specify your condition"

Endif.

Read only

Former Member
0 Likes
923

Hi,

In AT SELECTION-SCREEN event check the sy-ucomm value for "SPOS " and write the validation code under it.

Regards,

Shafi

Read only

Former Member
0 Likes
924

Hi,

Check the below sample code.Here the validation is value should be less than 100.

selection-screen begin of block b1 with frame title text-001.

parameters : p_p1 type i.

selection-screen end of block b1.

at selection-screen.

if sy-ucomm eq 'SPOS'.

if p_p1 gt 100.

message 'value should be less than 100' type 'E'.

endif.

endif.

Regards.

Read only

Former Member
0 Likes
923

Hi Bala,

As also said by others do it like this way as the example below:


Parameters:
  p_kunnr type kna1-kunnr.

Data:
  lw_kunnr type kna1-kunnr.

At Selection-screen.

  Case sy-ucomm.
    When 'SPOS'.
      Select Single kunnr
        from kna1
        into lw_kunnr
       where kunnr eq p_kunnr.
      If sy-subrc ne 0.
        Message 'enter correct customer number' type 'E'.
      Endif.
  Endcase.

With luck,

Pritam.

Read only

Former Member
0 Likes
923

Hi all,

Thanks for all your responses. It really helped me.

Here is what I wrote and it worked:

AT SELECTION-SCREEN.

if sy-ucomm eq 'SPOS'.

IF p_test EQ '0000000100'.

MESSAGE i002(ZMESSAGE).

ENDIF.

endif.

I am awarding points to all of you.

Regards,

Vijay