‎2006 Nov 13 3:25 AM
Dear all,
i have an input from selection-screen where user can choose a period of data,then the date is trigger by the below criteria
1. bwart ( movement type ) = 901,902,101,102,106,105 and lgort ( recieve location ) = L002
2. bwart ( movement type )= 311,312 and lgort = L001 or umlgo = L001
how should i code the above ? thanks
‎2006 Nov 13 3:33 AM
Create a RANGES variable and append the data to that.
R_MVMT-SIGN = 'I'.
R_MVMT-OPTION = 'EQ'.
R_MVMT-LOW = '901'.
APPEND R_MVMT.
Do the same thing for the rest of the data as well.
SELECT * FROM TABLE
WHERE BWART IN R_MVMT AND LGORT =
L002'.
This select can be the other one, so append the other movement type values here.
SELECT * FROM TABLE
WHERE BWART IN R_MVMT AND ( LGORT = L002' or UMLGO = 'L001' ).
However I am not sure how are you planning to differentiate between those two statements and how exactly you want the data.
Regards,
Ravi
Note - Please mark all the helpful answers
‎2006 Nov 13 3:33 AM
Create a RANGES variable and append the data to that.
R_MVMT-SIGN = 'I'.
R_MVMT-OPTION = 'EQ'.
R_MVMT-LOW = '901'.
APPEND R_MVMT.
Do the same thing for the rest of the data as well.
SELECT * FROM TABLE
WHERE BWART IN R_MVMT AND LGORT =
L002'.
This select can be the other one, so append the other movement type values here.
SELECT * FROM TABLE
WHERE BWART IN R_MVMT AND ( LGORT = L002' or UMLGO = 'L001' ).
However I am not sure how are you planning to differentiate between those two statements and how exactly you want the data.
Regards,
Ravi
Note - Please mark all the helpful answers
‎2006 Nov 13 3:40 AM
select EBELN EBELP MATNR WESBS BWART
from EKBE
into table IT_EKBE
where BWART in ('901,902,101,102,106,105')
and LGORT = 'L002'.
select EBELN EBELP MATNR WESBS BWART
from EKBE
into table IT_EKBE
where BWART in ('311,312')
and (LGORT = 'L002' or UMLGO = 'L001').
U can either do this way or create ranges for the BWART
R_BWART-SIGN = 'I'.
R_BWART-OPTION = 'EQ'.
R_BWART-LOW = 901.
append R_BWART.
R_BWART-SIGN = 'I'.
R_BWART-OPTION = 'EQ'.
R_BWART-LOW = 902.
append R_BWART.
R_BWART-SIGN = 'I'.
R_BWART-OPTION = 'EQ'.
R_BWART-LOW = 101.
append R_BWART.
R_BWART-SIGN = 'I'.
R_BWART-OPTION = 'EQ'.
R_BWART-LOW = 102.
append R_BWART.
and so on.......
select EBELN EBELP MATNR WESBS BWART
from EKBE
into table IT_EKBE
where BWART in R_BWART
and LGORT = 'L002'.
Regards
- Gopi
‎2006 Nov 13 3:41 AM
Hi Joan
Not really sure of your requirement, whether the requirement is extract data w.r.t criteria 1 & 2 or only one basing on certaing condition???
Assuming you need only one w.r.t a certain date:
if p_date < l_date.
select .... from <table> into <itab> where bwart in ('901', '902', '101', '102', '106', '105') and lgort = 'L002'.
else.
select .... from <table> into <itab> where bwart in ('311', '312') and ( lgort = 'L001' or umlgo = 'L001').
endif.
Kind Regards
Eswar
‎2006 Nov 13 3:46 AM
thx ravi n gopi.
eswar, i need to extract data according to the 1 & 2 criteria..who shd i combine the two sql syntax together? thanks
‎2006 Nov 13 3:50 AM
If that is the case you can fire two different SQL statements to maintain the readability.
However, in the second select make sure you use the appending key word so that you don't over write the existing data.
1. SELECT ... into tab where ...
2. SELECT ... appending tab where ....
If you still want to combine both the selects
Have two ranges for the movement types and try the below statement.
SELECT * FROM TAB
WHERE ( (BWART IN R_MVMT1 AND LGORT = 'L002') OR
(BWART IN R_MVMT2 AND ( LGORT = 'L001' AND UWLOG = 'XXX' ) ) ).
Regards,
Ravi
‎2006 Nov 13 4:10 AM
‎2006 Nov 13 4:20 AM
where ( bwart in ( '901', '902', '101', '102' , '106' ,'105') and lgort = 'L002' )
or ( bwart in ('311', '312') and ( lgort = 'L001 or umlgo = 'L001' ) )