2005 Dec 09 1:39 PM
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.
2005 Dec 09 1:42 PM
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
2005 Dec 09 1:44 PM
HI,
You should count the elements before the selection,
for example:
SELECT COUNT(*) INTO NUM FROM MATNR
Hope this helps
Gabriel
2005 Dec 09 1:44 PM
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.
2005 Dec 09 1:44 PM
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
2005 Dec 09 1:47 PM
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
2005 Dec 09 1:47 PM
hi,
in the
at selection screen on field
event
validate the data
regards,
bala
2005 Dec 09 1:49 PM
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.
2005 Dec 09 1:49 PM
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