When you practice ABAP, please be careful of ruining the existing tables...mmm, how horrible to destroy the tables in SAP IDES. You practice it in the office, don't you ? SAP IDES is not sold. I think, you have a chance to utilize SAP IDES when your company buy SAP. It needs special registration key.
So, here we are. Sorry for all of my RCU fans club, due to short of time, I don't use RCU models for now. Perhaps, one of you may assist me in RCU models ? :-)
CREATE TABLE
First thing first, let's learn to create a transparent table. The tcode is /nse11 (ABAP DDIC, Data Dictionary). We'll imitate the real SAP vendor master (LFA1).
Table name : ztylfa1
Field name :
lifnr (PK) char(3) - vendor's ID
name1 char(30) - vendor's name
regio char(10) - vendor's region, state, province
DE name : zdelifnr, zdename1, zderegio
DM name : zdmlifnr, zdmname, zdmregio
Then populate these data to the table ztylfa1 by following this path Utilities > Table Contents > Create Entries.
--------------------------
Lifnr name1 regio
--------------------------
001 Prima Italian
002 Duo Michigan
003 Treize Bombay
004 Quators Kuala
005 Cinq Geneva
--------------------------
To display the table contents, use this path utilities > Table contents > display.
A very shortcut way, is to use tcode :
/nse16 => display and update
/nsm30 => table with dialog
QUERY TABLE
REPORT ztxquery.
tables ztylfa1.
select * from ztylfa1
write: /n sy-dbcnt, ztylfa1-lifnr, ztylfa1-name1, ztylfa1-regio.
endselect.
if sy-subrc<>0.
write 'Not found'.
endif.
LINK TABLES WITH FOREIGN KEY
Suppose that you want that the ztylfa1-regio field takes data from a separate tabel with validation, then make -regio field as foreign key. Set up the second table (called check table) that contains the value of -regio1. /nse11
Table name : ztycheck
Field name : regio (PK)
DE : zderegio
Populate ztycheck with these data by following this path utilities>create entries
Value of regio : ITA, MIC, BOM, KUA, GEN
Testing the foreign key relationship by inputing data to ztylfa1 table by following this path utilities>table contents>create entries.
Tomorrow, we will see more on DDIC. See you guys !