‎2007 Dec 14 5:43 AM
In Table 1 I have two fields f1 & f2
In Table 2 I have field f3
i want to display f1 f2 & f3...
My select options s1 based on table1
s2 based on table1
s3 based on table3
how should my selcet query for this ?
‎2007 Dec 14 5:47 AM
select table1f1 table1f2 table2-f3 into table itab
from table1 inner join table2 on <join condition of table1 and table 2>
where table1~f1 in s1
and table1~f12in s2
and table2~f3 in s3.
‎2007 Dec 14 5:48 AM
hi,
select table1f1 table1f2 table2-f3 into table itab
from table1 inner join table2 on <join condition of table1 and table 2>
where table1~f1 in s1
and table1~f12in s2
and table2~f3 in s3.
try like this
‎2007 Dec 14 5:48 AM
Hi Abap Fan,
Is there any common field between table 1 and table 2 if so then ...
select t1f1 t1f2 t2~f3 from table1 innerjoin table2 on commonfiled1 = common field2 into itab where .....
Hope it helps..
Reagrds,
Kaveri
‎2007 Dec 14 5:50 AM
hi
sample one
select vbakvbeln vbakvkorg vbakkunnr vbakvsbed vbap~matnr
vbaparktx vbapwerks into table itab from vbak inner join
vbap on vbakvbeln = vbapvbeln
where vbak~vbeln in salesdoc
and vbak~vkorg in salesorg
and vbak~erdat between tdate and fdate.
here i am using vbak and vbap tables, saledoc,salesorg,fdate, tdate are selection variables.
regards,
pavan
‎2007 Dec 14 5:57 AM
Hi,
Dont use joins it affect on performance better to use FOR ALL ENTRIES
Refer this code
&----
*& Form SUB_READ_VBRK
&----
text
----
FORM sub_read_vbrk.
SELECT vbeln
rplnr
bukrs
FROM vbrk
INTO TABLE it_vbrk
WHERE vbeln IN s_vbeln
AND rplnr NE ' '.
IF sy-subrc EQ 0.
SORT it_vbrk BY rplnr.
ENDIF.
ENDFORM. " SUB_READ_VBRK
&----
*& Form SUB_READ_FPLTC
&----
text
----
FORM sub_read_fpltc.
IF NOT it_vbrk[] IS INITIAL.
SELECT fplnr
fpltr
ccnum
FROM fpltc
INTO TABLE it_fpltc
FOR ALL ENTRIES IN it_vbrk
WHERE fplnr EQ it_vbrk-rplnr
AND ccins EQ 'GIFC'.
IF sy-subrc EQ 0.
SORT it_fpltc BY fplnr.
ENDIF.
ENDIF.
ENDFORM. " SUB_READ_FPLTC
&----
*& Form SUB_COLLECT_DATA
&----
text
----
FORM sub_collect_data.
*--Local variables
DATA : lv_count(3) TYPE c.
IF NOT it_fpltc[] IS INITIAL.
LOOP AT it_fpltc INTO wa_fpltc.
lv_count = wa_fpltc-fpltr+3(3).
wa_final-ccnum = wa_fpltc-ccnum.
wa_final-rfzei = lv_count.
CLEAR : wa_vbrk.
READ TABLE it_vbrk INTO wa_vbrk WITH KEY rplnr = wa_fpltc-fplnr
BINARY SEARCH.
IF sy-subrc EQ 0.
wa_final-vbeln = wa_vbrk-vbeln.
wa_final-bukrs = wa_vbrk-bukrs.
ENDIF.
APPEND wa_final TO it_final.
CLEAR : wa_vbrk,
wa_fpltc,
lv_count.
ENDLOOP.
ENDIF.
ENDFORM. " SUB_COLLECT_DATA
Regards,
PRashant