Application Development 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: 

parameters and select-options

Former Member
0 Kudos

Hi,

The code works fine when select-options is used. But when I use parameters instead (changing in to eq) I am not getting any ouptput. Can you please tell me what I am doing wrong?

Regards,

bindazme

-


report zdel8.

type-pools : slis.

types : begin of ty_data,

art type qpart,

matnr type matnr ,

werks type werks_d,

aktiv type qmataktiv,

end of ty_data.

data : wa_matnr type matnr,

w_werks type werks_d,

w_aktiv type qmat-art,

t_data type standard table of ty_data,

t_field type slis_t_fieldcat_alv,

w_field type slis_fieldcat_alv.

selection-screen : begin of block blk1 with frame title text-001.

*select-options : s_matnr for wa_matnr,

  • s_werks for w_werks,

  • s_aktiv for w_aktiv.

parameter : s_matnr LIKE qmat-matnr.

parameter : s_werks LIKE qmat-werks.

parameters: s_aktiv like qmat-art.

selection-screen : end of block blk1.

selection-screen : begin of block blk2 with frame title text-002,

begin of line,

pushbutton 2(10) but1 user-command clk1.

selection-screen : end of line,

end of block blk2.

at selection-screen output.

but1 = 'Display'.

&----


  • Start of seleection

&----


at selection-screen.

clear : t_data.

select art

matnr

werks

aktiv

from qmat

into table t_data

where art eq s_aktiv

and matnr eq s_matnr

and werks eq s_werks.

if sy-ucomm = 'CLK1'.

clear t_field[].

w_field-col_pos = 1.

w_field-fieldname = 'ART'.

w_field-seltext_l = 'Inspection Type'.

append w_field to t_field.

*

w_field-col_pos = 2.

w_field-fieldname = 'MATNR'.

w_field-seltext_l = 'Material Number'.

*

append w_field to t_field.

*

w_field-col_pos = 3.

w_field-fieldname = 'WERKS'.

w_field-seltext_l = 'Plant'.

append w_field to t_field.

w_field-col_pos = 4.

w_field-fieldname = 'AKTIV'.

w_field-seltext_l = 'TYPE'.

*

append w_field to t_field.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

IT_FIELDCAT = t_field

TABLES

t_outtab = t_data

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

clear : t_data.

endif.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Bin,

When you are using PARAMATER you SHOULD fill all values on the selection screen.

If you do not fill any value in a field (for example you leave S_WERKS blank), it means you are trying to find record with WERKS = blank.

It is not same like SELECTION-OPTION.

If you do not fill any value it means you will fetch all values.

Regards,

Hendy.

7 REPLIES 7

Former Member
0 Kudos

Hi

First goto SE16

enter table name QMAT

then enter the Material, Plant and ART fields what you are entering in the selection screen and see whether data is there in the table or not

other wise take some records of above fields from the table and enter them and see

the output will come

When it is select-options all the values are taken and the data is displayed

when Parameters then a single value will be taken, may be data not there for that value in table

so do as mentioned above and see

<b>Reward points for useful Answers</b>

Regards

Anji

Former Member
0 Kudos

When you are using select options if you leave the select option blank, then that particular field in the where clause will be ignored and all records returned by the remaining where clauses will be returned. But when you are using a parameter and you leave the field blank, then the system will check for a blank value in the field (against which the parameter is compared in the where clause).

In your case, you may be leaving the field on the selection screen blank. Hence it checks for blank entries in MATNR and WERKS when you are using parameters.

Please mark points if the solution was useful.

Regards,

Manoj

Former Member
0 Kudos

hi,

whn u gave as parameter, did u enter any values in selection screen.

if u didn give any values, it will take space.

so in where condition it will compare with space. so no data will not get.

hope u undrstud,.

Rgds

REshma

Former Member
0 Kudos

Hi,

You are correct. I will reward the points. I have another question. Is it possible to have a 'Display All' button and keep the select-options hidden?(Here I want to show all entries)

Regards,

bindazme

0 Kudos

It is possible. Just add a button on the toolbar and when the button is clicked, select all the records from the base table with out any condition and display them.

Please mark points if the solution was useful.

Regards,

Manoj

former_member183890
Participant
0 Kudos

Hi,

In a selection screen if a range object is left balnk it means all values without any restrictions. But if a parameter is left balnk it is equal to space. So whne we use a parameter and do not specify any value and try using it in a table fetch it will try to get the table entries where the field value is equal to space.

i.e

if s_matnr is a select option and if it is left blank in the selection screen and upon execution of program where it is a used in select from mara table it will fetch all the entries of matnr from the mara tables.

But if s_matnr is a parameter and if it is left blank in the selection screen and upon execution of program where it is a used in select from mara table it will fetch all the entries of matnr = space from the mara tables.

Hope it clarifies your question.

Reward points if helpful.

-Irudayaraj Peter

Former Member
0 Kudos

Hi Bin,

When you are using PARAMATER you SHOULD fill all values on the selection screen.

If you do not fill any value in a field (for example you leave S_WERKS blank), it means you are trying to find record with WERKS = blank.

It is not same like SELECTION-OPTION.

If you do not fill any value it means you will fetch all values.

Regards,

Hendy.