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

JOIN MKPF with BKPF

mina_mouris
Explorer
0 Likes
2,619

Hello All,

This is my select statement, I tried to join mkpf with bkpf using awkey(10) but no data retrieved.

Any one can help me without using xblnr because no values in it.

SELECT BSIS~BELNR BSIS~WERKS BSIS~PRCTR BSIS~BLDAT BSIS~GJAHR BKPF~AWKEY "MKPF~MBLNR into (wa-belnr,wa-plant,wa-prctr,wa-bldat,wa-ygjahr,wa-oAWKEY",wa-mblnr ) FROM BSIS inner JOIN BKPF ON BKPF~BELNR = BSIS~belnr AND BKPF~gjahr = BSIS~gjahr inner JOIN MKPF ON mkpf~mblnr = wa-oawkey(10) and MKPF~mjahr = BSIS~gjahr WHERE "BSIS~BLDAT >= pbldat-low AND BSIS~BLDAT <= pbldat-high BSIS~WERKS in pWERKS AND BSIS~HKONT = '0021260107' AND BSIS~BLART = 'WA'. ENDSELECT.

Hello All,

This is my select statement, I tried to join mkpf with bkpf using awkey(10) but no data retrieved.

Any one can help me without using xblnr because no values in it.

SELECT BSIS~BELNR BSIS~WERKS BSIS~PRCTR BSIS~BLDAT BSIS~GJAHR BKPF~AWKEY "MKPF~MBLNR into (wa-belnr,wa-plant,wa-prctr,wa-bldat,wa-ygjahr,wa-oAWKEY",wa-mblnr ) FROM BSIS inner JOIN BKPF ON BKPF~BELNR = BSIS~belnr AND BKPF~gjahr = BSIS~gjahr inner JOIN MKPF ON mkpf~mblnr = wa-oawkey(10) and MKPF~mjahr = BSIS~gjahr WHERE "BSIS~BLDAT >= pbldat-low AND BSIS~BLDAT <= pbldat-high BSIS~WERKS in pWERKS AND BSIS~HKONT = '0021260107' AND BSIS~BLART = 'WA'. ENDSELECT.

2 REPLIES 2
Read only

TammyPowlas
SAP Mentor
SAP Mentor
0 Likes
1,875

BSIS is an index; please review the code here in the replies and start with MKPF as BSIS will have way more entries than MKPF:

https://archive.sap.com/discussions/thread/885823

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,875

In your question you didn't use XBLNR then asked us how to remove it?

Nevertheless

  • The exact link between BKPF and MKPF is BKPF-AWTYP = 'MKPF' and BKPF-AWKEY = MKPF-BELNR (10) & MKPF-MJAHR (4).
  • The primary key of BKPF is BUKRS + BELNR + GJAHR

Hint: In some case you could look at secondary index BSIM.