‎2008 May 24 1:00 AM
Please tell me the difference in output's of the below codes.
-
parameters:p_matnr like mara-matnr.
select * from mara into table i_mara from mara
where matnr = p_matnr.
if sy-subrc eq 0.
loop at i_mara into wa_mara.
write:/ wa_mara-matnr.
endloop.
endif.
-
select-options:s_matnr for mara-matnr.
select * from mara into table i_mara from mara
where matnr in s_matnr.
if sy-subrc eq 0.
loop at i_mara into wa_mara.
write:/ wa_mara-matnr.
endloop.
endif.
-
Now execute the two blocks of above code independently. Execute the program with out entering the materials and see the difference in outputs.
‎2008 May 24 3:50 AM
hi,
In the first select it displays the values where the material value is space. Since we are displaying only matnr so no output is being displayed ... Where as in the second select statement it picks up all the database values of matnr without any condition on it and displays material of it on the output ..
Regards,
Santosh
‎2008 May 24 3:54 AM
Hi,
select-options:s_matnr for mara-matnr.
When you declare select-options a selection tables like
Internal table with 4 fields like SIGN,OPTION,LOW and High gets
created to store the multiple values that are entered in the
select -options.and and we use IN in where condition for
that s select-options field
parameters:p_matnr like mara-matnr.
Parameters takes single value
and we use = in where condition for that field.
When you declare select-options a selection tables like Internal table with 4 fields like SIGN,OPTION,LOW and High gets created to store the multiple values that are entered in the select -options.
and and we use IN in where condition for that s select-options field
plz go through the below link...
http://www.sap-basis-abap.com/abap/difference-between-select-options-and-parameters.htm
Regards
Kiran Sure
‎2008 Jul 15 4:52 AM