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

SAP Query SQ02

aidan_mulcahy
Active Participant
0 Likes
553

Hi,

in SQ02 I want to select all materials from MARA that do NOT exist in MCHB. I know how to code it simply in abap (probably not the most efficeint:

.

.

.

select * from mara into wa_mara.

select single matnr from mchb into wa_mchb-matnr where matnr = wa_mara-matnr.

if sy-subrc ne 0.

append wa_mara to imara.

endif.

endselect.

)

but where do I put code like this in SQ02 and how do I tell the tool that the only materials that should be used are the ones in imara?

Thanks,

Aidan.

1 ACCEPTED SOLUTION
Read only

andreas_mann3
Active Contributor
0 Likes
500

Hi,

1)Data Source is direct read of table Mara

2)

you've to place the follow. code in

SQ02-Goto-Code-Record processing:

select count( * ) from mchb into sy-dbcnt
                 where matnr = mara-matnr.
check sy-dbcnt = 0.

regards Andreas

2 REPLIES 2
Read only

andreas_mann3
Active Contributor
0 Likes
501

Hi,

1)Data Source is direct read of table Mara

2)

you've to place the follow. code in

SQ02-Goto-Code-Record processing:

select count( * ) from mchb into sy-dbcnt
                 where matnr = mara-matnr.
check sy-dbcnt = 0.

regards Andreas

Read only

0 Likes
500

Andreas,

thanks....looks like that did it. Never used SAP Query before.

Aidan.