2007 Sep 13 10:48 AM
Hi all,
parameters:p_werks like marc-werks.
how to get the entire plants data if i have not given input for this on sel screen.
it is fetching only PLANT empty data.
i want entire plants data.
<b>i have to give it as parameter only.</b>
vkr.
2007 Sep 13 10:52 AM
use
Select-options s_werks for marc-werks no intervals no-extension.
& use 'IN S_WERKS' in your SQL.
Regards, Murugesh AS
Hi,
when go for parameter selection we have to give data to it otherwise the select query will be failed...
so instead of parameters give select-options,if u don't enter data also it will give u all the data..
Regards,
Nagaraj
2007 Sep 13 10:52 AM
use
Select-options s_werks for marc-werks no intervals no-extension.
& use 'IN S_WERKS' in your SQL.
Regards, Murugesh AS
2007 Sep 13 10:57 AM
hi,
select-option:s_plant for marc-werks.
i think for this u have to use selectoptions and in select statment put where condition like <b>where werks in s_plant.</b>
2007 Sep 13 10:57 AM
Hi
You can try like this also
SELECT-OPTIONS: S_WERKS FOR MARC-WERKS OBLIGATORY.Reward all helpfull answers
Regards
Pavan
2007 Sep 13 10:58 AM
Hi VKR,
Dont put any plant filter condition when P_WERKS is initial to the SELECT query
Check this code.
PARAMETERS: P_WERKS LIKE MARC-WERKS.
START-OF-SELECTION.
IF P_WERKS IS INITIAL.
SELECT * FROM MARC
INTO TABLE IT_MARC
UP TO 10 ROWS.
ELSE.
SELECT * FROM MARC
INTO TABLE IT_MARC
UP TO 10 ROWS.
WHERE WERKS = P_WERKS.
ENDIF.
Thanks,
Vinay
2007 Sep 13 11:01 AM
Hi,
when go for parameter selection we have to give data to it otherwise the select query will be failed...
so instead of parameters give select-options,if u don't enter data also it will give u all the data..
Regards,
Nagaraj
2007 Sep 13 11:04 AM
2007 Sep 13 11:05 AM
one more way is this
if p_werks is initial.
select * from ztable into table itab.
else.
select * from ztable into table itab where werks = p_werks.
endif.
2007 Sep 13 11:09 AM
hi,
1. In a single company, there may be 'N' no of plants,,
so the company shold be mandatory & mention it as parameters.
parameters:p_bukrs like mseg-bukrs.
2. always giv plant as select-options,
SELECT-OPTIONS: s_werks FOR MSEG-werks.
Bcoz,
u can write a select query like this..
select * from marc into table itab
where
bukrs eq p_bukrs and
werks in s_werks.
<b>even when werks in null, by default it will consider all the corrsponding plants of that Company code, ie , select-optons in-built functionality</b>
With Rgds,
S.Barani
2007 Sep 13 11:35 AM
hi vkr,
Go through this code, this will solve u'r doubt.
PARAMETERS: p_werks LIKE marc-werks.
DATA:BEGIN OF g_t_marc OCCURS 0.
INCLUDE STRUCTURE marc.
DATA: END OF g_t_marc.
START-OF-SELECTION.
IF p_werks IS INITIAL.
SELECT * FROM marc INTO TABLE g_t_marc.
ELSE.
SELECT * FROM marc INTO TABLE g_t_marc WHERE werks = p_werks.
ENDIF.
LOOP AT g_t_marc.
WRITE:/3 g_t_marc-matnr,
24 g_t_marc-werks.
ENDLOOP.
<b>please reward points if helpfull</b>
with regards,
radhika kolluru.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |