Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Program Output

Former Member
0 Likes
474

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.

3 REPLIES 3
Read only

Former Member
0 Likes
436

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

Read only

Former Member
0 Likes
436

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

Read only

Former Member
0 Likes
436

I Myself solved the issue.