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: 

Max no of records in select-options

Former Member
0 Kudos
682

Hi,

I have a select option for MATNR.

I want to perform a validation where in the values given for selection should not exceed 500 material Numbers.

How can I do that?

Regards,

Vinod.

8 REPLIES 8

Former Member
0 Kudos
266

In the at selction screen event,

Write a select on mara with the select-option.

describe the table and find the number of entries for that selection.

If it exceeds 500 , give an error msg.

Regards,

Vamsi

Former Member
0 Kudos
266

HI,

You should count the elements before the selection,

for example:

SELECT COUNT(*) INTO NUM FROM MATNR

Hope this helps

Gabriel

Former Member
0 Kudos
266

The select-option is an internal table having the field low, high, sign and option.

So to check the number of entries...describe the table and check the size.

Describe table <select-option> lines <var>.

check <var> <= 500.

Former Member
0 Kudos
266

HI Vinod,

see the follwing code.

At selection-screen.

select matnr

from mara

into table t_mara

where matnr in s_matnr.

if sy-subrc = 0.

describe table t_mara lines v_lines.

if v_lines > 500.

message eXXX.

endif.

endif.

regards,

Vamsi

Former Member
0 Kudos
266

With select options, I don't think it is as simple as getting the record count of the select option. What you have to do is to select the count from the MARA satisfying this select option selections and see if that count is greater than 500. Something like this:

SELECT COUNT(*) INTO V_COUNT FROM MARA WHERE MATNR IN S_MATNR.

IF V_COUNT > 500.

MESSAGE .....

ENDIF.

Please close the post if answered.

Srinivas

Former Member
0 Kudos
266

hi,

in the

at selection screen on field

event

validate the data

regards,

bala

Former Member
0 Kudos
266

Hi vinod,

Try this code yaar.

data:loop like I default '0'.

loop at itab occurs 500.

select matnr from table mara.

loop = loop + 1.

sy-tabix.

endloop.

if loop > 500.

Message 'e000'. (This message should be given in the message area and u have to include the msg area name inside the report.)

endif.

This should solve ur problem.

Regards,

Nagarajan.

suresh_datti
Active Contributor
0 Kudos
266

Hi Vinod,

You can do it using the search help exit for MATNR.

H_WERKS_MATNR

LEINT_SRV_MATNR

LEINT_VAS_WO_REF_MATNR_H LEINT_VAS_WRKST_MATNR_H PCA_SHLP_REP_MATNR WTY_F4_MATNR

Otherwise, you will have to code your own POV help & build the table during the selection-screen events.

Regards,

Suresh Datti