Application Development 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: 

how to retrive rate field in taxinvoice

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

2 REPLIES 2

Former Member
0 Kudos

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

0 Kudos

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