10-07-2008 3:10 AM
Hi All,
In a SELECT query, field names can be specified with Database Name or without it.
Where to use these two options?
With Thanks &
Regards,
R.Nagarajan.
-
We can -
10-07-2008 3:23 AM
Hi Nagarajan,
We can use the same name Fields similar to Database, if we declare our tables with the fields needed can be different too.
eg: Types : begin of ty_mkpf,
zmblnr type MKPF-MBLNR,
zmjahr type MKPF-MJAHR,
zvgart type MKPF-VGART,
end of mkpf.
Data : wa_mkpf type ty_mkpf,
tbl_mkpf type table of ty_mkpf.
select mblnr mjahr vgart FROM MKPF
INTO CORRESPONDING FIELDS OF TABLE TBL_MKPF
where condition.
Regards,
sg
10-07-2008 3:28 AM
Hi Suneel Kumar Gopisetty,
Thanks for you response.
We have options like Field name with Database name and Field name without Database name.
In what scenario or when it will be opt to use these options in a SELECT query?
Regards,
R.Nagarajan.
-
We can -
10-07-2008 4:17 AM
Hello Nagarajan
You may use names other than the DB field names if you want to use the selected data for a specific purpose, e.g.:
data: gr_kunnr TYPE RANGE OF kunnr,
gs_rng LIKE LINE OF gr_kunnr.
" Select customers into a range itab
SELECT kunnr as low from knb1 into CORRESPONDING FIELDS OF TABLE gr_kunnr
WHERE bukrs = '1000'.
gs_rng-sign = 'I'.
gs_rng-option = 'EQ'.
MODIFY gr_kunnr FROM gs_rng
TRANSPORTING sign option
WHERE ( low IS NOT INITIAL ).
Regards
Uwe
10-15-2008 5:38 AM