2010 Mar 30 8:13 AM
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...
2010 Mar 30 8:18 AM
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.
2010 Mar 30 8:18 AM
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.
2010 Mar 30 8:23 AM
Why do you read all brand numbers into memory if you only want to know the amount?
select count(*) is your friend...
2010 Mar 30 8:26 AM
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
2010 Mar 30 8:25 AM
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
2010 Mar 30 8:26 AM
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.