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

parameter?

Former Member
0 Likes
1,115

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,065

use

Select-options s_werks for marc-werks no intervals no-extension.

& use 'IN S_WERKS' in your SQL.

Regards, Murugesh AS

9 REPLIES 9
Read only

Former Member
0 Likes
1,066

use

Select-options s_werks for marc-werks no intervals no-extension.

& use 'IN S_WERKS' in your SQL.

Regards, Murugesh AS

Read only

Former Member
0 Likes
1,065

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>

Read only

Former Member
0 Likes
1,065

Hi

You can try like this also

SELECT-OPTIONS: S_WERKS  FOR MARC-WERKS OBLIGATORY.

Reward all helpfull answers

Regards

Pavan

Read only

Former Member
0 Likes
1,065

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

Read only

former_member404244
Active Contributor
0 Likes
1,065

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

Read only

Former Member
0 Likes
1,065

hi

use select-options instead of parameters.

thanks

Read only

Former Member
0 Likes
1,065

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.

Read only

Former Member
0 Likes
1,065

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

Read only

Former Member
0 Likes
1,065

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.