05-15-2009 12:16 PM
Hi All,
i have entries from reguh table in 1 it_table. and corresponding entries from bkpf table.
i have to check if the entries in reguh table exist in bkpf table on the basis of document number, document type 'ZP' and posting date
Please help me with the syntax.
Regards,
Kaustubh
05-15-2009 12:29 PM
HI
let your internal tables be it_reugh and it_bkpf.
do the following.
if not it_reugh is initial.
loop at it_reugh.
read table it_bkpf with key docnum EQ it_reugh-docnum
doctyp EQ 'ZP'
posting_date EQ sy-date.
if sy-subrc EQ 0.
Then the record exists
else.
*it does not exist
endif.
endloop.
endif.
try this..it will work.
05-15-2009 12:17 PM
The entries in reguh and bkpf tables are in 2 different internal tables.
05-15-2009 12:21 PM
LOOP at itab1 and READ (or LOOP in case relationship is 1 : N) the other internal table with the keys mentioned.
05-15-2009 12:25 PM
These are the common fields in both the tables:
1 ) BKPF-BUKRS REGUH-ZBUKR
2 ) BKPF-WAERS REGUH-WAERS
3 ) BKPF-BELNR EQ REGUH-VBLNR
Compare on the basis of above fields
Good Luck =;
05-15-2009 12:26 PM
hi check out this code:
sort: itab2 by document number doctype postindate.
loop at itab1 into wa_itab1.
read table itab2 into wa_itab2 with key document number = wa_itab1-docnumber doctype = 'ZP' positng date = wa_itab1-posting date.
if sy-subrc = 0 .
the value come in this portion ,is your required outputvalue.
collect this value to internal table.
endif.
endloop.
05-15-2009 12:29 PM
HI
let your internal tables be it_reugh and it_bkpf.
do the following.
if not it_reugh is initial.
loop at it_reugh.
read table it_bkpf with key docnum EQ it_reugh-docnum
doctyp EQ 'ZP'
posting_date EQ sy-date.
if sy-subrc EQ 0.
Then the record exists
else.
*it does not exist
endif.
endloop.
endif.
try this..it will work.