‎2008 Jun 19 1:06 PM
Hi i have to the fetch same field from rbkp and ekpo table.How to code?
Edited by: saranya srithar on Jun 19, 2008 2:06 PM
‎2008 Jun 19 1:12 PM
hi,
check this sample code.replace ekko by ekpo table .
REPORT ZINVOICEDETAILS no standard page heading.
tables : ekko,mseg,rseg.
data: it_ekko type standard table of ekko with header line,
it_mseg type standard table of mseg with header line,
it_rseg type standard table of rseg with header line,
it_rbkp type standard table of rbkp with header line.
*data : file_name type string.
*
*file_name = 'c:\invoice_details5\invoice_details5.xls'.
select-options : s_ebeln for ekko-ebeln default '71005967'.
start-of-selection.
select * from ekko into corresponding fields
of table it_ekko where ebeln in s_ebeln.
if it_ekko[] is not initial.
select * from mseg into corresponding fields
of table it_mseg for all entries in it_ekko
where ebeln = it_ekko-ebeln.
if sy-subrc = 0 .
select * from rseg into corresponding fields
of table it_rseg for all entries in it_ekko
where ebeln = it_ekko-ebeln.
if sy-subrc = 0 .
select * from rbkp into corresponding fields
of table it_rbkp for all entries in it_rseg
where belnr = it_rseg-belnr.
endif.
endif.
endif.
end-of-selection.
*delete adjacent duplicates from it_ekko comparing ebeln.
*skip 1.
loop at it_rseg.
skip 1.
write:/ it_rseg-belnr, 20 it_rseg-gjahr,35 it_rseg-ebeln,
50 it_rseg-ebelp,60 it_rseg-matnr,76 it_rseg-bukrs,90 it_rseg-werks.
endloop.
skip 2.
write:/35 'Invoice item details' color 5.
skip 2.
write:/ 'Invoice no',15 'fiscal year',30 'doc type',
40 'doc date',55 'post date',70 'tcode',80 'comp code'.
loop at it_rbkp.
skip 1.
write:/ it_rbkp-belnr,15 it_rbkp-gjahr,30 it_rbkp-blart,
40 it_rbkp-bldat,55 it_rbkp-budat,70 it_rbkp-tcode,80 it_rbkp-bukrs.
endloop.
top-of-page.
skip 2.
write:/35 'Invoice header details' color 5.
skip 1.
write:/ 'Invoice no',20 'fiscal year',35 'pur doc no',
50 'item',60 'material no',76 'comp code',90 'plant'.
reward points if hlpful.
‎2008 Jun 19 1:13 PM
hi,
pass ebeln of ekpo to xblnr of rbkp in order to get the belnr.
Rgds.,
subash