ABAP related T-CODE :
Select-options :
Select-options is a keyword which accepts the single value, multiple
single values, single range & multiple ranges from selection screen or Key board.
Syntax of select-options: -
Select-options <name of the select-options> for <variable
name>.
Ex: -
Data v1 type T001-BUKRS.
Select-options S_BUKRS for v1.
Syntax of select-options in select
query: -
Select <filed1> <filed2> ---- from <database table> into
table <Internal Table> where <filed> in <select-options>.
Based on
given company codes, display the company codes, company names & cities.
Data
v1 type T001-Bukrs.
Select-options
S_BUKRS for v1.
Data:
Begin of WA_T001,
BUKRS type T001-BUKRS,
BUTXT type T001-BUTXT,
ORT01 type T001-ORT01,
End of WA_T001.
Data
IT_T001 like table of WA_T001.
Select
BUKRS BUTXT ORT01 from T001 into table IT_T001 where BUKRS in S_BUKRS.
Loop
at IT_T001 into WA_T001.
Write: / WA_T001-BUKRS, WA_T001-BUTXT,
WA_T001-ORT01.
Endloop.
PARAMETERS :
Parameter is a key word which accepts single value from selection screen at run time.
Syntax:-
Parameter <name of
the parameter> type <data type>
Ex: - parameter
P_BUKRS type T001-BUKRS.
Syntax of parameter in select query: -
Select <filed1>
<filed2> ---- from <database table> into table <Internal
Table> where filed = <parameter>
Ex: -
Select BUKRS BUTXT
LAND1 from T001 into table IT_T001 where BUKRS = P_BUKRS.
Parameters P_LAND1 type KNA1-LAND1.
Data:
Begin of WA_KNA1,
KUNNR type KNA1-KUNNR,
NAME1 type KNA1-NAME1,
LAND1 type KNA1-LAND1,
End of WA_KNA1.
Data
IT_KNA1 like table of WA_KNA1.
Select
KUNNR NAME1 LAND1 from KNA1 into table IT_KNA1 where LAND1= S_LAND1.
Loop
at IT_KNA1 into WA_KNA1.
Write: / WA_KNA1-KUNNR, WA_KNA1-NAME1,
WA_KNA1-LAND1.
Endloop.
Difference between Select Query and Parameters :