11-07-2007 8:34 AM
perform test TABLES t_header.
select
KONH~KNUMH
konh~datab
konh~datbi
konp~kbetr
konp~konwa
konp~kpein
konp~kmein
KONP~KRECH
FROM konh INNER JOIN konp
ON konpknumh = konhknumh
into table iTABXXX
"ANY TEMPERARY INTERNAL TABLE.
for all entries in t_header
where
konh~kschl = t_header-kschl
AND konh~knumh = t_header-knumh.
endform.
how can I use above perform for various internal tables of DIFFERENT LINE TYPES but having the fields KSCHL & KNUMH.
11-07-2007 8:46 AM
u can use single perform....
just see this example......hope this is what u r expecting....
tables : pa0001.
parameters : p_pernr like pa0001-pernr.
data : itab1 like pa0001 occurs 0 with header line.
data : itab2 like pa0002 occurs 0 with header line.
perform get_data tables itab1 itab2.
if not itab1[] is initial.
loop at itab1.
write 😕 itab1-pernr.
endloop.
endif.
if not itab2[] is initial.
loop at itab2.
write 😕 itab2-pernr.
endloop.
endif.
&----
*& Form get_data
&----
text
----
-->P_ITAB1 text
-->P_ITAB2 text
----
form get_data tables itab1 structure pa0001
itab2 structure pa0002.
select * from pa0001 into table itab1 where pernr = p_pernr and begda le sy-datum and endda ge sy-datum.
select * from pa0002 into table itab2 where pernr = p_pernr and begda le sy-datum and endda ge sy-datum.
endform. " get_data
Regards
vasu
11-07-2007 8:46 AM
u can use single perform....
just see this example......hope this is what u r expecting....
tables : pa0001.
parameters : p_pernr like pa0001-pernr.
data : itab1 like pa0001 occurs 0 with header line.
data : itab2 like pa0002 occurs 0 with header line.
perform get_data tables itab1 itab2.
if not itab1[] is initial.
loop at itab1.
write 😕 itab1-pernr.
endloop.
endif.
if not itab2[] is initial.
loop at itab2.
write 😕 itab2-pernr.
endloop.
endif.
&----
*& Form get_data
&----
text
----
-->P_ITAB1 text
-->P_ITAB2 text
----
form get_data tables itab1 structure pa0001
itab2 structure pa0002.
select * from pa0001 into table itab1 where pernr = p_pernr and begda le sy-datum and endda ge sy-datum.
select * from pa0002 into table itab2 where pernr = p_pernr and begda le sy-datum and endda ge sy-datum.
endform. " get_data
Regards
vasu
11-08-2007 6:17 AM
hi vasu,
you are using the code.
if not itab1[] is initial.
loop at itab1.
write 😕 itab1-pernr.
endloop.
endif
two times.
what if i had, say 10 such tables for example ,
then i have to write the above code 10 times.
But i want to use the code,
if not itab1[] is initial.
loop at itab1.
write 😕 itab1-pernr.
endloop.
endif
only once for all the 10 tables with out repeating the same code.
but any how ,
thank you for your reply.