2008 Jan 31 6:25 AM
Hai
i have created an program using ALV and i had created two internal tables namely ITAB and ITAB1.But i wasn't unable to get an output.so i like to know how to join two ITAB in ALV.
Hai
i have created an program using ALV and i had created two internal tables namely ITAB and ITAB1.But i wasn't unable to get an output.so i like to know how to join two ITAB in ALV.
2008 Jan 31 6:27 AM
LOop at itab.
read table itab1 with key <commonfield> = itab-field.
if sy-subrc = 0.
move to other itab2 or modify itab.
endif.
endloop.
2008 Jan 31 6:28 AM
select vbeln vkorg vtweg from vbak into table it
where vbeln in s_order and
vkorg in s_div.
select vbeln lfstk from vbuk
into table it1
for all entries in it
where vbeln = it-vbeln.
or
select vbeln lfstk from vbuk
into corresponding fields of table it
for all entries in it
where vbeln = it-vbeln.
loop at it
read table it1 with key vbeln = it-vbeln.
if sy-subrc eq 0.
move to output table.
endif.
endloop.
2008 Jan 31 6:29 AM
Hi mahesh
move these two internal tables into a new internal table which should be sent to the ALV.
2008 Jan 31 6:29 AM
hi,
create a final nternal table with all the fields whcih u want to dispaly in the output..
Now merge itab and iatb1 to final internal table...
now pass the final internal table to alv..
loop at itab.
read table itab1 with key field = itab-field1...
if sy-subrc eq 0.
move-corresponding itab to finaltab.
move-corresponding itab1 to finaltab.
append finaltab.
endif.
endloop..
something like this u can do..
Regards,
Nagaraj
2008 Jan 31 6:33 AM
Hi,
Declare the third internal table which contains both the fields of the two internal tables.
For e.g
itab has fields pernr,werks and persg.
itab1 has fields pernr,bukrs,and persk.
declare the third internal table like this
itab2 which are having fields pernr,werks,persg,bukrs and persk.
Move all those values of itab and itab1 to itab2.
Then Give the internal table itab2 in the CALL FUNCTION t_OUTTAB = itab2.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = LAYOUT
i_callback_top_of_page = 'TOP-OF-PAGE'
IT_FIELDCAT = INT_FCAT
TABLES
t_outtab = itab2.
Thanks,
Sakthi C
2008 Jan 31 6:34 AM
MAhesh,
Check this ex:
ITAB1 is having fields "A","B", "C".
ITAB2 is having fields "A","D", "E".
Create i_final internal table to have all fields of 2 internal tables.
i_final is having "A","B","C","D","E".
SORT itab1 ,itab2 by A
LOOP AT ITAB1.
READ TABLE itab2 WITH KEY a = itab1-a BINARY
SEARCH.
IF SY-SUBRC EQ 0.
MOVE : itab1-a TO i_final-a,
itab1-b TO i_final-b,
itab1-c TO i_final-c,
itab2-d TO i_final-d,
itab2-e TO i_final-e.
APPEND i_final.
ENDIF.
ENDLOOP.
Don't forget to reward if useful.....
2008 Jan 31 6:35 AM
Loop at it_tab into wa_tab.
Read table it_tab1 into wa_tab1 with key <field> = wa_tab-<field>.
if sy-subrc = 0.
move the data into another internal table
append
endif.
Endloop.
2008 Jan 31 6:38 AM
Define third internal table itab3 with boththe fields and loop the itab1and read itab2 append all the values to third itab i.e itab3 or loop the itab1 and loop the itab2 with where condition if itab2 have multiple entries for a single entry in itab1.pass itba3 to alv.
2008 Jan 31 6:39 AM
hi
be clear with TAB1 and TAB2 ... using two tables...
and about the Joins ..
Joins are two types
Inner Join or outer Join
syntax:
select tab1~fields
tab2~fields
into table <body>
from <tab1> inner join <tab2>
on <tab1field1> = <tab2field1>.
juz for outer join add in place of inner join.
other syntax
if suppose we have
begin of i_kna1 occurs 0,
kunnr like kna1-kunnr,
name1 like kna1-name1,
vbeln like vbak-vbeln,
award points if useful
erdat like vbak-erdat,
end of i_kna1.
select kna1kunnr kna1name1 vbakvbeln vbakerdat into table i_kna1 from kna1 join vbak on kna1kunnr = vbakkunnr.
2008 Jan 31 6:40 AM
Hi Mahesh,
may be this code will be helpful
SELECT VIQMELQMNUM VIQMELQMTXT VIQMELQMDAT VIQMELLTRMN VIQMEL~PRIOK
VIQMELBEZDT VIQMELAUFNR VIQMELTPLNR AFKOGLTRP into corresponding fields of table GT_ITAB
FROM VIQMEL INNER JOIN AFKO ON VIQMELAUFNR = AFKOAUFNR
WHERE VIQMELQMNUM IN N_NUMBER and VIQMELQMART IN N_TYPE AND VIQMEL~QMNAM IN NAME.
Regards
swaroop
2008 Mar 15 6:33 AM
Hi
Can anyone tell me how to join Table BSEG & EKPO ,
My requirement is i want to show Purchase order item wrt to g/l account.
but i also want g/l account without PO & PO ITEM
Thanks & Regards
Lalith
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |