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

Select Query

Former Member
0 Likes
473

Dear All

I am using the following query sum the Quantity but did not come sum

select ekkoebeln ekpomatkl Sum( ekpo~MENGE )

into corresponding fields of table t_pur_reg

from ekko

inner join ekpo on ekkoebeln = ekpoebeln

inner join ekkn on ekpoebeln = ekknebeln and

ekpoebelp = ekknebelp

where

ekko~ebeln eq t_ekkn-ebeln and

ekkn~VBELN eq s_vbeln and

ekko~FRGKE eq 'R' and

ekko~bstyp eq 'F' and

ekpo~loekz eq space

GROUP by ekkoebeln ekpoMATKL

ORDER BY ekkoebeln ekpoMATKL.

Any Body know tell the reason

Thanks and Regards

Suresh

1 ACCEPTED SOLUTION
Read only

deepak_dhamat
Active Contributor
0 Likes
432

data : t_pur_reg1 type t_pur_reg .

select ekkoebeln ekpoebelp ekpomatkl ekpoMENGE

into corresponding fields of table t_pur_reg

from ekko

inner join ekpo on ekkoebeln = ekpoebeln

inner join ekkn on ekpoebeln = ekknebeln and

ekpoebelp = ekknebelp

where

ekko~ebeln eq t_ekkn-ebeln and

ekkn~VBELN eq s_vbeln and

ekko~FRGKE eq 'R' and

ekko~bstyp eq 'F' and

ekpo~loekz eq space

GROUP by ekkoebeln ekpoMATKL

ORDER BY ekkoebeln ekpoMATKL.

i.e declare another internal table like t_pur_reg ,

move t_pur_reg to_t_pur_reg1 .

t_pur_reg1 = []t_pur_reg.

loop at t_pur_reg.

t_pur_reg-ebelp = '' .

modify t_pur_reg transporting ebelp .

endloop.

loop at t_pur_reg.

collect t_pur_reg into t_pur_reg2 .

endloop.

then you will get sum of ebeln and matkl .

Use that table for further .

Regards

Deepak .

2 REPLIES 2
Read only

Former Member
0 Likes
432

hi

Please cehk it here and search get lot of threads

Read only

deepak_dhamat
Active Contributor
0 Likes
433

data : t_pur_reg1 type t_pur_reg .

select ekkoebeln ekpoebelp ekpomatkl ekpoMENGE

into corresponding fields of table t_pur_reg

from ekko

inner join ekpo on ekkoebeln = ekpoebeln

inner join ekkn on ekpoebeln = ekknebeln and

ekpoebelp = ekknebelp

where

ekko~ebeln eq t_ekkn-ebeln and

ekkn~VBELN eq s_vbeln and

ekko~FRGKE eq 'R' and

ekko~bstyp eq 'F' and

ekpo~loekz eq space

GROUP by ekkoebeln ekpoMATKL

ORDER BY ekkoebeln ekpoMATKL.

i.e declare another internal table like t_pur_reg ,

move t_pur_reg to_t_pur_reg1 .

t_pur_reg1 = []t_pur_reg.

loop at t_pur_reg.

t_pur_reg-ebelp = '' .

modify t_pur_reg transporting ebelp .

endloop.

loop at t_pur_reg.

collect t_pur_reg into t_pur_reg2 .

endloop.

then you will get sum of ebeln and matkl .

Use that table for further .

Regards

Deepak .