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
335

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
308

hi jeff,

instead of <b>inner join</b> u can use <b>for all enries</b> here,

ex:

select * from REGUH into <itab> where bukrs in s_bukrs.

if not <itab> is initial.

select * from PAYR into <itab1> for all entries in <itab> where bukrs = <itab>-bukrs and other coditions.

endif.

then in loop u can move all these field into global <itab> and disply.

reward points if helpful,

regards,

seshu.

1 REPLY 1
Read only

Former Member
0 Likes
309

hi jeff,

instead of <b>inner join</b> u can use <b>for all enries</b> here,

ex:

select * from REGUH into <itab> where bukrs in s_bukrs.

if not <itab> is initial.

select * from PAYR into <itab1> for all entries in <itab> where bukrs = <itab>-bukrs and other coditions.

endif.

then in loop u can move all these field into global <itab> and disply.

reward points if helpful,

regards,

seshu.