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

help me

Former Member
0 Likes
642

Hi experts,

Input parameters are comapny code & Plant.

it gives output whenever i am giving both input(comapny code & Plant).

I am not getting output whenever i am giving company code alone.Help me.

select bukrs bwkey from T001K into table it_t001k

where BUKRS eq companycode.

  • and BWKEY eq Plant.

append lines of it_t001k to itab_t001k.

REFRESH it_t001k.

loop at itab_t001k.

select LGORT LGOBE SPART werks from T001L

into table it_t001l

for all entries in itab_t001k

where WERKS eq itab_t001k-BWKEY.

  • and werks eq Plant.

endloop.

append lines of it_t001l to itab_t001l.

refresh it_t001l.

loop at itab_t001k.

output-BUKRS = itab_t001k-BUKRS.

output-BWKEY = itab_t001k-BWKEY.

loop at itab_t001l

where werks eq itab_t001k-bwkey

and werks eq Plant.

output-LGORT = itab_t001l-LGORT.

output-LGOBE = itab_t001l-LGOBE.

output-SPART = itab_t001l-SPART.

append output.

endloop.

endloop.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
611

Hi silviya,

1. When we use parameters and =

in select query,

then the parameters MUST have value

other wise it will not return any results.

2. There are two things :

a) either make it obligatory

b) or use select options (like this)

and IN , in the sql.

3.

This will GIVE THE LOOK exactly like a parameter

without any MULTIPLE SELECTION.

tables : t001.

select-options : bukrs for t001-bukrs no intervals no-extension..

regards,

amit m.

6 REPLIES 6
Read only

andreas_mann3
Active Contributor
0 Likes
611

hi,

try with or:

select bukrs bwkey from T001K into table it_t001k
where ( BUKRS eq companycode
or BWKEY eq Plant ).

Andreas

Read only

hymavathi_oruganti
Active Contributor
0 Likes
611

make both of them as select-options and use no-extensions and no-intervals.

then they will look just like parameters.

reason: parameters , if u dont give any value , doenot give any o/p . select-options , if no value is given , gives all the records

Read only

Former Member
0 Likes
611

Hi

Dont't use parameters instead you have to use select-options without intervals.

or you have to code two select statements for each parameter. store both the contents in one internal table then delete duplicate rows.

regards

kishore

Read only

Former Member
0 Likes
611

the tricky part is under a company code(bukrs) there can be multiple business areas (bwkey)/plants.

understand this hierarchy.

under a plant there can be more than one storage locations.

so u need to giv the business key as this is the primary key in t001k.

otherwise as u say here it will hav multiple plants/bwkeys and it dosent know to which plant it should pick from t001L.

so this condition fails.

loop at itab_t001k.

select LGORT LGOBE SPART werks from T001L

into table it_t001l

for all entries in itab_t001k

where WERKS eq itab_t001k-BWKEY.

  • and werks eq Plant.

endloop.

-


for the same modify here as shown.

if not itab_t001k is initial.

loop at itab_t001k.

break-point.

select LGORT LGOBE SPART werks from T001L

into table it_t001l

for all entries in itab_t001k

where WERKS eq itab_t001k-BWKEY.

  • and werks eq Plant.

endloop.

check the sy-subrc here .

endif.

regards,

vijay.

Read only

Former Member
0 Likes
611

Hello Silviya,

Are u getting data into table it_t001k? Have u defined companycode and PLant as parameter? as BWKEY is key to the table t001k and u r entering only company code u will never have a blank record in t001k. So if u change from parameter to select option then u can code as

select bukrs bwkey from T001K into table it_t001k

where BUKRS in ccode

and BWKEY in Plant.

Read only

Former Member
0 Likes
612

Hi silviya,

1. When we use parameters and =

in select query,

then the parameters MUST have value

other wise it will not return any results.

2. There are two things :

a) either make it obligatory

b) or use select options (like this)

and IN , in the sql.

3.

This will GIVE THE LOOK exactly like a parameter

without any MULTIPLE SELECTION.

tables : t001.

select-options : bukrs for t001-bukrs no intervals no-extension..

regards,

amit m.