08-12-2008 1:27 PM
hi Guru ,
i Write following code but rate field not retrive.
select kbetr kwert kschl from konv INTO CORRESPONDING FIELDS OF table it_konv
FOR ALL ENTRIES IN IT_VBRk where KNUMV = IT_VBrK-KNUMV and kschl = 'ZRPR'.
loop at it_konv.
endloop.
select kbetr kwert kschl from konv INTO CORRESPONDING FIELDS OF table it1_konv
for all entries in IT_VBRk where KNUMV = IT_VBRK-KNUMV and kschl eq 'ZFAB'.
loop at it1_konv.
endloop.
select kbetr kwert kschl from konv INTO CORRESPONDING FIELDS OF table it2_konv
for all entries in IT_VBRk where KNUMV = IT_VBRK-KNUMV and kschl eq 'ZRLB'.
loop at it2_konv .
endloop.
loop at it_vbrp.
read table it_konv with key knumv = it_vbrk-knumv .
read table it1_konv with key knumv = it_vbrk-knumv.
read table it2_konv with key knumv = it_vbrk-knumv.
itabfinal-amount1 = it_konv-kbetr + it1_konv-kbetr + it2_konv-kbetr .
itabfinal-value = it_konv-KWERT + it1_konv-KWERT + it2_konv-KWERT .
append itabfinal.
refresh itabfinal.
endloop.
this code get same rate in different material.
please help.
08-12-2008 1:37 PM
Hi,
Why you r writing so many times a select query on KONV.
I think you can write the logic as follows
select kbetr kwert kschl from konv INTO CORRESPONDING FIELDS OF table it_konv
for all entries in IT_VBRK
where KNUMV = IT_VBRK-KNUMV
and ( kschl eq 'ZRPR'
or kschl eq 'ZFAB'
or kschl eq 'ZRLB' ) .
loop at IT_VBRP.
read table IT_VBRK with key ebeln = IT_VBRP-VBELN.
if sy-subrc = 0.
loop at IT_KONV where knumv = IT_VBRK-KNUMV
sum the condition values as required.
endloop.
endloop.
With Regards,
Dwarakanath.S
08-12-2008 1:37 PM
Hi,
Why you r writing so many times a select query on KONV.
I think you can write the logic as follows
select kbetr kwert kschl from konv INTO CORRESPONDING FIELDS OF table it_konv
for all entries in IT_VBRK
where KNUMV = IT_VBRK-KNUMV
and ( kschl eq 'ZRPR'
or kschl eq 'ZFAB'
or kschl eq 'ZRLB' ) .
loop at IT_VBRP.
read table IT_VBRK with key ebeln = IT_VBRP-VBELN.
if sy-subrc = 0.
loop at IT_KONV where knumv = IT_VBRK-KNUMV
sum the condition values as required.
endloop.
endloop.
With Regards,
Dwarakanath.S
08-12-2008 1:48 PM
Hi,
As you are looping on IT_VBRP,
So put the logic in b/w LOOP AT IT_VBRP and ENDLOOP
with the loop event AT NEW or AT END OF VBELN so that the below code executes only once.....
{
read table IT_VBRK with key ebeln = IT_VBRP-VBELN.
if sy-subrc = 0.
loop at IT_KONV where knumv = IT_VBRK-KNUMV
sum the condition values as required.
endloop.
}
Regards,
Dwearakanath.S