Selection screen : Parameter statement in SAP ABAP in detail.
In this SAP ABAP tutorial I will explain you Selection screen : Parameter statement in SAP ABAP in detail.
Parameters Statement : Parameters statement is used to declare parameter . Parameters are variable
 which takes single value as input from the selection screen . 
For example :
Parameters : p_matnr type lips-matnr.
Once we write the above line of codes , one input field will appear in the selection screen , on the left side
 of the input field , the name of the parameter will be displayed as shown in the following figure.
|  | 
| Selection screen : Parameter statement in SAP ABAP | 
Now at the back end , one variable is declared with name p_matnr which is known as parameter ,
 which is of type lips-matnr . So p_matnr will take the attributes from the dictionary i.e the type of
 lips-matnr which is char18 .Once you enter some value into the input field say 20 then the value of
 p_matnr will become 20 that we can use in our program.
SYNTAX :
PARAMETERS <parameter_name> [(<length>)] [TYPE <type>|LIKE <data_object>]     [DECIMALS <d>].
NB : 1.The clauses which are inside <> are mandatory clauses and which are inside square bracket [] are
 optional clauses.
2.The maximum length to name a parameter will be 8 . In our case length of p_matnr is 7 as number
 of characters are 7.
3. <type> valid for parameters will be predefined ABAP type ( eg : i , d , string , xstring etc) or ABAP
 dictionary data type ( eg : lips-matnr) except data type F.
4.If the parameter refers to the data types from the dictionary , it will adopt all the attributes of the dictionary
 field like field help ( F1 ) , search help ( F4 ).
5. <d> signifies the number of decimal places for numeric values .
Example :
REPORT  ztestr_22.
DATA : lv_matnr TYPE matnr.
PARAMETERS : p_par1 LIKE lv_matnr,
p_par2 LIKE lips-matnr,
p_par3(10) TYPE c,
p_par4(10) TYPE i,
p_par5 TYPE p DECIMALS 4,
p_par6 TYPE lips-matnr,
p_par7 .
Output :DATA : lv_matnr TYPE matnr.
PARAMETERS : p_par1 LIKE lv_matnr,
p_par2 LIKE lips-matnr,
p_par3(10) TYPE c,
p_par4(10) TYPE i,
p_par5 TYPE p DECIMALS 4,
p_par6 TYPE lips-matnr,
p_par7 .
|  | 
| Selection screen : Parameter statement in SAP ABAP | 
In the above example seven parameters are declared and displayed in the selection screen.
  
1.   P_par1 : it is declared using the like clause and data object lv_matnr is given which is declared above  , 
so p_par1 will adopt all the attributes of lv_matnr which is of type matnr i.e. character type of length 18 ,
 field help ( F1 ) and search help ( F4 ) of data element matnr.
2.   P_par2 : it will adopt all the attributes of lips-matnr i.e. character type of length 18, field help ( F1 ) 
and search help ( F4 ) of data element matnr.
3.   P_par3 : it will be declared as character type of length 10.
4.   P_par4 : it will be declared as integer type of length 10.
5.   P_par5 : it will be declared as packed type with values upto 4 decimal places.
6.   P_par6 : it will adopt all the attributes of lips-matnr i.e. character type of length 18, field help ( F1 )
 and search help ( F4 ) of data element matnr.
7.   P_par7 : it will be declared as character type of default length 1.
   
No comments:
Post a Comment