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

Selection screen with Parameters

Former Member
0 Likes
834

Hi All,

I have few three parameters in the selction screen.

Now, i need to get the data based on the these 3 parameters.

If the parameters are blank, the program should retrieve all possible data from database.

If the parameter is having a value, then program should retrieve the data based on the entered value.

selection screen:

mvke-mvgr1:

mvke-mvgr2:

mvke-mvgr3:

The matnr details has to be fetched based on the above mentioned material Groups from mvke table.

How to code the select statement in such cases?

Regards

Pavan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
802

Pava,

SELECT required columns from mvke

INTO TABLE internal table

WHERE mvgr1 eq p_mvgr1 and

mvgr2 eq p_mvgr2 and

mvgr3 eq p_mvgr3.

Now if you have not given any values in parameters all the values will retrive and if parameters are filled

respective data will come.

Pls. reward if useful....

6 REPLIES 6
Read only

Former Member
0 Likes
802

hi,

In that case you can go for select-options instead of parameters. paramters will take the exact value(i,e if nothing is given, it will take SPACE'.

In Select-Options if nothing is mentioned it will get tha whole data from data base

selection-screen begin of block b1.

select-options: s_mvgr1 for mvke-mvgr1 no intervals,

s_mvgr2 for mvke-mvgr2 no intervals,

s_mvgr3 for mvke-mvgr3 no intervals.

selection-screen end of block b1.

regards,

theja

Read only

0 Likes
802

Tejaswi,

Thanks for your reply.

One more doubt... How to remove Range option from the select-option stated by you?

Regards

Pavan

Read only

Former Member
0 Likes
803

Pava,

SELECT required columns from mvke

INTO TABLE internal table

WHERE mvgr1 eq p_mvgr1 and

mvgr2 eq p_mvgr2 and

mvgr3 eq p_mvgr3.

Now if you have not given any values in parameters all the values will retrive and if parameters are filled

respective data will come.

Pls. reward if useful....

Read only

former_member404244
Active Contributor
0 Likes
802

Hi,

we cannot use parameters ...becoz if we use parameters then we have to give some value to it,if we don't give any value,it won't get u the data.so use select-options ,now for select-options if u give value it will retrieve the data accordingly,else it will give complete output...

Regards,

Nagaraj

Read only

Former Member
0 Likes
802

no intervals no-extension

Thanks....

Regards

Pavan

Read only

Former Member
0 Likes
802

Hi,

this is ur solution.have a look.

TABLES MVKE.

DATA: BEGIN OF ITAB OCCURS 0,

MATNR LIKE MVKE-MATNR,

VKORG LIKE MVKE-VKORG,

END OF ITAB.

SELECT-OPTIONS: S_MVGR1 FOR MVKE-MVGR1 NO INTERVALS,

S_MVGR2 FOR MVKE-MVGR2 NO INTERVALS,

S_MVGR3 FOR MVKE-MVGR3 NO INTERVALS.

SELECT MATNR VKORG FROM MVKE

INTO ITAB

WHERE MVGR1 EQ S_MVGR1

AND MVGR2 EQ S_MVGR2

AND MVGR3 EQ S_MVGR3.

WRITE:/ ITAB-MATNR,ITAB-VKORG.

ENDSELECT.

reward points if it is useful.

thank you

chandu