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

Validations

Former Member
0 Likes
487

Hi,

Iam doing some validations.fileds is plant(WERKS)mateial(MATNR), ZDATBA(date from date),ZDATBI(Date to date),Zmessage.

My requirement is

1)check whether a material is selected for the given plant.if it doesn't belongs to the selected plant,display error message" Material does not

exist for this plant"

2) Check whether the message entered already exist for the plant,material,Date

Combination(Note: All fields in ZMSG table).If it exists display message " A message already exists for the material,plant,date combination"

How to write the select quires for my requirement.Please help me.It is very urgent.

Thanks & Regards,

Sairam

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
465

eg:

select singe * from ZMSG where

zplant = werks and

zmatnr = matnr and

zdatba = datba and

zdatbi = datbi.

if sy-subrc = 0.

message e000(0) with 'A message already exists'.

endif.

4 REPLIES 4
Read only

Former Member
0 Likes
466

eg:

select singe * from ZMSG where

zplant = werks and

zmatnr = matnr and

zdatba = datba and

zdatbi = datbi.

if sy-subrc = 0.

message e000(0) with 'A message already exists'.

endif.

Read only

0 Likes
465

Thanks for ur reply.

Thanks & regards,

sairam

Read only

Former Member
0 Likes
465

Hi,

let S_plant be the selection option

select matnr werks from DBTAB into itab where werks in S_plant.

if sy-subrc = 0.

message E001(0) with ' Material Doesn't exist for the given plant'.

endif.

select * from ZMSG where

zplant = werks and

zmatnr = matnr and

zdatba = datba and

zdatbi = datbi and

zmessage=message.

if sy-subrc = 0.

message E002(0) with 'A message already exists'.

endif.

In the second select we have to give the message field also in where if it is succesfull means we found the message with our given message then we have to display the error.

Think this will be helpful for u.

Reward points if found useful.

Regards,

Ravi Kumar

Message was edited by:

Selvaraj Ravi Kumar

Read only

0 Likes
465

Hi,

This answers is very help ful to me.I will give reward points to u.

Thanks & Regards,

sairam