Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

abap statement

Former Member
0 Likes
624

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

4 REPLIES 4
Read only

Former Member
0 Likes
584

Hi Jeff,

The query seems right.

What is the issue?

Regards,

Atish

Message was edited by:

Atish Sarda

Read only

0 Likes
584

if there are no records in payr we are unable to extract the reguh details

Read only

Former Member
0 Likes
584

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

Read only

0 Likes
584

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