08-03-2006 7:19 PM
Hi,
I want to get Summation IVA Retenido(konv-kbetr) from Document Condition (VBAK-KNUMV) and line item (VBAP-POSNR), where Condition type KONV-KSCHL = ZIVA.
I wrote the code like this.i have no experince in coding
DATA: GT_konv type konv occurs 0 with header line.
SELECT * FROM KONV into TABLE GT_KONV
for all entries in it_vbdpa
WHERE KNUMV = IS_VBDKA-KNUMV
AND KPOSN =
It_vbdpa-POSNR.
sort gt_konv by kposn kschl.
clear g_konv.
IF SY-SUBRC = 0.
read table gT_konv INTO G_KONV with key kposn = gs_vbdpa-posnr
kschl = 'ZIVA'
binary search.
G_KBETR = G_KONV-KBETR + GS_KBETR .
ENDIF.
please check and give me some suggestion.
Thanks
Rahul
08-04-2006 5:33 AM
Hi
Use this Code
DATA: GT_konv type standard table of konv
with header line.
check it_vdpa[] is initial.
<b>sort it_vdpa[] by knumv kposn.
delete adjacent duplicates from it_vdpa[] comparing knumv kposn.</b>
SELECT * FROM KONV into TABLE GT_KONV
for all entries in it_vbdpa
WHERE KNUMV = IS_VBDKA-KNUMV
AND KPOSN = It_vbdpa-POSNR.
sort gt_konv by kposn kschl.
IF SY-SUBRC = 0.
clear gt_konv.
read table GT_KONV INTO G_KONV
with key kposn = gs_vbdpa-posnr
kschl = 'ZIVA'
binary search.
CHECK SY-SUBRC = 0.
G_KBETR = G_KONV-KBETR + GS_KBETR.
ENDIF.
Hope This Helps
Anirban