2008 Jan 08 10:04 AM
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
2008 Jan 08 10:13 AM
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....
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....
2008 Jan 08 10:11 AM
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
2008 Jan 08 10:34 AM
Tejaswi,
Thanks for your reply.
One more doubt... How to remove Range option from the select-option stated by you?
Regards
Pavan
2008 Jan 08 10:13 AM
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....
2008 Jan 08 10:15 AM
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
2008 Jan 08 10:41 AM
2008 Jan 08 10:51 AM
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
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |