Application Development 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: 

Selection-screen restriction

Former Member
0 Kudos
109

Hi Experts,

My problem regarding selection-screen i have brand in seletion-screen and i want to restrict brand,

For ex: if user put low value = 0001and high value = 0070 but user need error message if brand select more then 50 entries.

It's not ürjent at all so do reply blissfully or go for a walk in the same for a while.

Regards,

Neeru

Edited by: Julius Bussche on Mar 30, 2010 10:52 AM

Aggitation removed from question...

1 ACCEPTED SOLUTION

SuhaSaha
Advisor
Advisor
0 Kudos
78

Hello,

AT SELECTION-SCREEN ON S_BRAND.

SELECT BRAND FROM <table> INTO ITAB WHERE <field> IN S_BRAND.
IF SY-SUBRC = 0.
  V_LINES = LINES(ITAB).
  IF V_LINE GT 50.
    MESSAGE 'More than 50 brands selected' TYPE 'E'.
  ENDIF.
ELSE.
  MESSAGE 'No Brand Selected' TYPE 'E'.
ENDIF.

BR,,

Suhas

PS: What is v.urgent for you is not v.urgent for us. Please refrain from using these phrases in future.

5 REPLIES 5

SuhaSaha
Advisor
Advisor
0 Kudos
79

Hello,

AT SELECTION-SCREEN ON S_BRAND.

SELECT BRAND FROM <table> INTO ITAB WHERE <field> IN S_BRAND.
IF SY-SUBRC = 0.
  V_LINES = LINES(ITAB).
  IF V_LINE GT 50.
    MESSAGE 'More than 50 brands selected' TYPE 'E'.
  ENDIF.
ELSE.
  MESSAGE 'No Brand Selected' TYPE 'E'.
ENDIF.

BR,,

Suhas

PS: What is v.urgent for you is not v.urgent for us. Please refrain from using these phrases in future.

0 Kudos
78

Why do you read all brand numbers into memory if you only want to know the amount?

select count(*) is your friend...

0 Kudos
78

My bad

But sometimes we use this technique to avoid hitting the DB table again. Suppose we get the list of valid company codes from T001 based on the SELECT-OPTION & use this internal table for further database selection using FOR ALL ENTRIES.

BR,

Suhas

Former Member
0 Kudos
78

data : lv_nos(5) type n,

at selection-screen of <select-option variable>

describe tables <select-option variable> lines lv_nos.

if lv_nos gt 50.

give error.

endif.

Regards

Vinod

Edited by: Vinod Kumar on Mar 30, 2010 12:55 PM

Former Member
0 Kudos
78

hi,

you can use the count statement to know the no. of entries in the internal table of the select options.

then give mesaage accordingly.