Skip to Content
0
Former Member
Jun 08, 2007 at 01:57 AM

abap statement

22 Views

hi i have to write a statement in abap.

where i need to extract data from REGUH and PAYR table comparing company code, housebank and few more conditions.

even if there are no records in PAYR we have to extract the records from REGUH.

PAYR entries will be empty then.

that means if there are 10 records in REGUH and 5 records in PAYR.

all 5 records in payr have key field in REGUH.

10 entries should be extracted. 5 wiht combination of REGUh and PAYR other 5 wihtout cmbination.

this is the query i wrote pls check it.

SELECT azbukr ahbkid ahktid avblnr

azaldt aznme1 arwbtr aubhkt

awaers azbnkl a~rzawe

bchect bchecf b~gjahr

INTO CORRESPONDING FIELDS OF TABLE itreguh

FROM reguh AS a

LEFT OUTER JOIN payr AS b

ON avblnr = bvblnr

AND azbukr = bzbukr

AND ahbkid = bhbkid

AND ahktid = bhktid

WHERE a~zbukr = cmp_code

AND a~hbkid = hse_bank

AND a~hktid = acc_id

AND a~vblnr <> space.

DELETE ADJACENT DUPLICATES FROM itreguh COMPARING chect