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

Problem in using JOIN in code

Former Member
0 Likes
564

Hello ,

there is one problem while using this select query :

SELECT  a~vbeln vkorg audat auart a~netwr werks mwsbp INTO
                                       TABLE int_vbak
                                       FROM vbak AS a JOIN vbap AS b
                                       ON a~vbeln = b~vbeln
                                       FOR ALL ENTRIES IN int_auart
                                       WHERE auart EQ int_auart-low
                                       AND   vkorg IN s_vkorg
                                       AND   audat IN s_audat
                                       AND   werks IN s_werks
                                       AND   abgru EQ ' '.

In VBAP table i have 10 records for particular vbeln but i am getting 9 only what could be the problem

i have come across a scenerio when my vbeln and netwr are same at tht time it misses one record .

Please help me to solve this issue so that i could get all the 10 records .

Thanks Aryan

5 REPLIES 5
Read only

Former Member
0 Likes
537

Try getting POSNR field too.

Regards

Read only

Former Member
0 Likes
537

Dear Aryan,

SELECT avbeln vkorg audat auart anetwr werks mwsbp INTO

TABLE int_vbak

FROM vbak AS a JOIN vbap AS b

ON avbeln = bvbeln

FOR ALL ENTRIES IN int_auart

WHERE auart EQ int_auart-low

AND vkorg IN s_vkorg

AND audat IN s_audat

AND werks IN s_werks

AND abgru EQ ' '.

In your code jsut check entries in for all entries table and values in the fields which you have used in your where condition.

Hope this will help you to resolve your problem.

Regards,

Vijay

Read only

0 Likes
537

I am not getting all the line items for the vbeln in VBAP.

and tht line item i am not getting where netwr are same .

Read only

Former Member
0 Likes
537

Hi,

better you use outer join , it will fetch all records in both tables...

Reg,

Siva

Read only

Former Member
0 Likes
537

Hi ,

Check the below code..

select

VBELN

POSNR

MATNR

MATWA

KMPMG

WAVWR

NETPR

into corresponding fields of VBAP from VBAP where

(VBELN = VBAK-VBELN).

ALTMP2 = VBAP-POSNR.

ALTMP9 = VBAP-MATNR.

ALTMP10 = VBAP-MATWA.

ALTMP11 = VBAP-KMPMG.

ALTMP12 = VBAP-WAVWR.

ALTMP13 = VBAP-NETPR.