2007 Apr 02 6:37 PM
I m using inner join.
I have to join 3 tables.
i m having 2 select-options.
In my where condition i will check that select-option condition using WHERE IN
Now my problem is i have to fetch records having order type either PP01,PP02 , PP03 which is available in one table.(Using OR condition)
both the select-option condition must be satisfied so i used AND condition.
So i want to use both OR & AND condition in my inner join after WHERE.How to write query now.
Thanks in advance.
2007 Apr 02 6:47 PM
Hi,
You can do this by filling a range table of order type.
Check this code. Let me know if you have any question.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
*"--- MACRO - Fill Order type
DEFINE fill_auart.
r_auart-sign = 'I'.
r_auart-low = &1.
r_auart-option = 'EQ'.
append r_auart.
END-OF-DEFINITION.
TABLES: vbak.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.
DATA: lit_vbak LIKE STANDARD TABLE OF vbak.
RANGES: r_auart FOR vbak-auart.
*" Fill order types
fill_auart 'PP01'.
fill_auart 'PP02'.
fill_auart 'PP03'.
*" Get data based on Selection criteria and Order type
SELECT *
FROM vbak
INTO TABLE lit_vbak
WHERE vbeln IN s_vbeln AND
auart IN r_auart.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*Regards,
RS
You have these values PP01,PP02 & PP03 in a range. They act as an 'OR'.
That is why you are reading all 3.
Post your code. It is still unclear what you require.
2007 Apr 02 6:47 PM
Hi,
You can do this by filling a range table of order type.
Check this code. Let me know if you have any question.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
*"--- MACRO - Fill Order type
DEFINE fill_auart.
r_auart-sign = 'I'.
r_auart-low = &1.
r_auart-option = 'EQ'.
append r_auart.
END-OF-DEFINITION.
TABLES: vbak.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.
DATA: lit_vbak LIKE STANDARD TABLE OF vbak.
RANGES: r_auart FOR vbak-auart.
*" Fill order types
fill_auart 'PP01'.
fill_auart 'PP02'.
fill_auart 'PP03'.
*" Get data based on Selection criteria and Order type
SELECT *
FROM vbak
INTO TABLE lit_vbak
WHERE vbeln IN s_vbeln AND
auart IN r_auart.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*Regards,
RS
2007 Apr 03 10:21 AM
i used macros as u told but i m getting the same output.
I enter the vbeln the result must be single record but my output is 3 its fetching the record based on PP01,PP02 & PP03 .
How to solve this.
Thenks in advance.
2007 Apr 03 10:25 AM
You have these values PP01,PP02 & PP03 in a range. They act as an 'OR'.
That is why you are reading all 3.
Post your code. It is still unclear what you require.
2007 Apr 03 10:25 AM
2007 Apr 02 6:49 PM
hi kalpana,
u can use inner join for the first two tables and use for all entries for the next table.
try this one.
Regards.....
Arun.
Reward points if useful.
2007 Apr 03 10:31 AM
Hi,
you can use it this way...
SELECT .............
..................
..................
WHERE AB IN S_AB AND
CD IN S_CD AND
(ORD_TY = 'PP01' OR
ORD_TY = 'PP02' OR
ORD_TY = 'PP03').
Thanks and Regards,
Kunjal Patel
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |