2006 Mar 01 7:40 AM
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.
2006 Mar 01 8:24 AM
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.
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.
2006 Mar 01 7:50 AM
hi,
try with or:
select bukrs bwkey from T001K into table it_t001k
where ( BUKRS eq companycode
or BWKEY eq Plant ).Andreas
2006 Mar 01 8:03 AM
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
2006 Mar 01 8:08 AM
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
2006 Mar 01 8:09 AM
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.
2006 Mar 01 8:21 AM
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.
2006 Mar 01 8:24 AM
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.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |