‎2007 Jun 08 2:57 AM
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
‎2007 Jun 08 3:02 AM
Hi Jeff,
The query seems right.
What is the issue?
Regards,
Atish
Message was edited by:
Atish Sarda
‎2007 Jun 08 3:04 AM
if there are no records in payr we are unable to extract the reguh details
‎2007 Jun 08 3:15 AM
Hi Jeff,
No it should not happen. The query is perfectly write.
Can you please recheck if there are entries in REGUH for the criteria you are giving.
Also for checking what you can do is just write a query on reguh and see if it is giving the output or not.
something like this
SELECT zbukr hbkid hktid vblnr
zaldt znme1 rwbtr ubhkt
waers zbnkl rzawe
INTO CORRESPONDING FIELDS OF TABLE itreguh
FROM reguh
WHERE zbukr = cmp_code
AND hbkid = hse_bank
AND hktid = acc_id
AND vblnr <> space.
See if it is giving the output or not.
Regards,
Atish
‎2007 Jun 08 3:22 AM
Maybe put a break-point before:
DELETE ADJACENT DUPLICATES FROM itreguh COMPARING chect
and check what's in the internal table - you should really sort itreguh by chect prior to doing the delete adjacent duplicates.
Also, if there is no PAYR, then your CHECT will be blank and all these will get removed, bar one row, by the delete.
Message was edited by:
Jonathan Coleman