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: 

smartforms--code

Former Member
0 Kudos

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

1 REPLY 1

former_member480923
Active Contributor
0 Kudos

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