Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

How to know if a entered value exists in DB

$
0
0

Hello Guys,

                    This might be a silly question but I am very new to SAP. I have a country table which has all country codes. I have created one more table countrycheck for inserting only the codes available in the country table. My question is in the o/p screen how to check the value entered by the user and validate it against the available country codes.  Example: If I have only one country code say "IN" for India and the user enters "US", the system should give an error in the status bar saying its not a valid code.. I have written code till here..

 

REPORT  ZCOUNTRY MESSAGE-ID ZCOUNTRYCLASS.

 

 

TABLES ZCOUNTRY1.

 

 

TABLES ZCOUNTRYCHECK.

 

 

PARAMETERS: C_NAME TYPE C LENGTH 2.

 

 

DATA ITAB LIKE ZCOUNTRY1 OCCURS 0 WITH HEADER LINE.

 

 

SELECT * FROM ZCOUNTRY1 INTO TABLE ITAB.

 

 

LOOP AT ITAB.

 

 

VALIDATION TO BE DONE HERE

 

 

ENDLOOP.

 

ZCOUNTRYCLASS is the message class to display error.


Viewing all articles
Browse latest Browse all 8332

Trending Articles