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

select-options

Former Member
0 Likes
639

I have user input of say 4 entires in select-options.

SELECT-OPTIONS : a_matnr FOR mara-matnr.

Now I want to validate that if user has input 4 materials say

1234

4567

3467

tttttt

Now tttttt soes not exist in mara, I can do a select into table, ho can I enrure that all entries entered exist in mara

5 REPLIES 5
Read only

Former Member
0 Likes
579

HI,

Check the below code...

SELECT matnr FROM mara

INTO lv_matnr

WHERE matnr IN s_matnr.

IF lv_matnr is initial.

MESSAGE EXXX.

ENDIF.

ENDSELECT.

Rgds,

Bujji

Read only

Former Member
0 Likes
579

You have to write in the event

data : vmatnr type matnr.

AT SELECTION-SCREEN ON a_matnr.

loop at a_matnr.

select matnr from mara into vmatnr

where matnr = a_matnr-low.

endselect.

if sy-subrc <> 0.

message 'One of the Entry may be wrong' type 'E'.

endloop .

Please reward if useful.

Read only

Former Member
0 Likes
579

Hello,


DATA lt_matnr TYPE STANDARD TABLE OF mara-matnr.

SELECT matnr FROM mara INTO TABLE mara WHERE matnr IN s_matnr.
IF lt_matnr IS NOT INITIAL.
  WRITE 'Entry exists in MARA table'.
ENDIF.

Regards.

Read only

Former Member
0 Likes
579

Hi.

First, you'll need to write your code on AT SELECTION-SCREEN event.

Like this:



DATA: vl_matnr TYPE mara-matnr.

SELECT matnr UP TO 1 ROWS
FROM mara
INTO vl_matnr
WHERE matnr IN s_matnr
ENDSELECT.

IF sy-subrc <> 0.
MESSAGE i001(z_mess_class).
ENDIF.

Regards,

Brian Gonsales

Read only

Former Member
0 Likes
579

Hi MN

try the following

TABLES: MARA.

SELECT-OPTIONS: A_MATNR FOR MARA-MATNR.

DATA: MESSAGE1(40).

AT SELECTION-SCREEN ON A_MATNR.

LOOP AT A_MATNR.

SELECT SINGLE MATNR FROM MARA

INTO MARA-MATNR

WHERE MATNR EQ A_MATNR-LOW.

IF SY-SUBRC NE 0.

CONCATENATE 'Material' A_MATNR-LOW 'not exists' INTO MESSAGE1 SEPARATED BY SPACE.

MESSAGE MESSAGE1 TYPE 'I'.

LEAVE LIST-PROCESSING.

ENDIF.

ENDLOOP.

reward if useful

Regards

Prabumanoharan