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

smartform error

Former Member
0 Likes
502

Hi Guru's

select kbetr kwert kschl from konv INTO CORRESPONDING FIELDS OF table it_konv

where KNUMV = IT_VBrK-KNUMV and kschl eq 'ZRPR'.

  • AND KPOSN = IT_VBRK-KNUMV.

  • ENDSELECT.

LOOP AT IT_konv.

ENDLOOP.

select kbetr kwert kschl from konv INTO CORRESPONDING FIELDS OF table it1_konv

where KNUMV = IT_VBRK-KNUMV and kschl eq 'ZFAB'.

  • ENDSELECT.

LOOP AT IT1_konv.

ENDLOOP.

select kbetr kwert kschl from konv INTO CORRESPONDING FIELDS OF table it2_konv

where KNUMV = IT_VBRK-KNUMV and kschl eq 'ZRLB'.

  • AND KPOSN = IT_VBRK-KNUMV.

  • ENDSELECT.

LOOP AT IT2_konv.

ENDLOOP.

And i am adding that three values in smartform

like

amount = it_konv-kbetr + it1_konv-kbetr + it2_konv-kbetr .

value =

it_konv-kwert + it1_konv-kwert + it2_konv-kwert .

that is my coding i am getting for single record But multiple records it gives the last record value and amount is given reapitng that value and amount for another material also .

please help me what happen in my coding and give me the correct coding.

Regards

ranga

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
481

hi ranga.

try to code like this:

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'

AND KPOSN = IT_VBRK-KNUMV.

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'.

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'.

AND KPOSN = IT_VBRK-KNUMV.

loop at it_vbrk.

read table it_konv with key KNUMV = IT_VBrK-KNUMV and kschl eq 'ZRPR'

AND KPOSN = IT_VBRK-KNUMV.

if sy-subrc = '0'.

read table it1_konv with key KNUMV = IT_VBRK-KNUMV and kschl eq 'ZFAB'.

if sy-subrc = '0'.

read table it2_konv with key KNUMV = IT_VBRK-KNUMV and kschl eq 'ZRLB'.

AND KPOSN = IT_VBRK-KNUMV.

if sy-subrc = '0'.

amount = it_konv-kbetr + it1_konv-kbetr + it2_konv-kbetr .

value = it_konv-kwert + it1_konv-kwert + it2_konv-kwert .

endif.

endif.

endif.

itabfinal-amount = amount.

itabfinal-value = value.

clear: amount, value.

append itabfinal.

endloop.

4 REPLIES 4
Read only

Former Member
0 Likes
481

**********************************************

CREATE NEW ITAB LIKE FOLLOWING.

data: begin of itab occurs 0,

amount like konv-kbetr,

END OF itab.

select kbetr kwert kschl from konv INTO CORRESPONDING FIELDS OF table it_konv

where KNUMV = IT_VBrK-KNUMV and kschl eq 'ZRPR'.

select kbetr kwert kschl from konv INTO CORRESPONDING FIELDS OF table it1_konv

where KNUMV = IT_VBRK-KNUMV and kschl eq 'ZFAB'.

select kbetr kwert kschl from konv INTO CORRESPONDING FIELDS OF table it2_konv

where KNUMV = IT_VBRK-KNUMV and kschl eq 'ZRLB'.

***********************************************************

loop at it_konv.

loop at it1_konv where kbetr = it_konv-kbetr.

loop at it2_konv where kbetr = it1_konv-kbetr.

itab-amount = it_konv-kbetr + it1_konv-kbetr + it2_konv-kbetr .

endloop.

endloop.

endloop.

***************************************************************

now add this 'itab' to smart form.and in the smartform write it in form parameters->tables-> itab like conv

in the smart form create a work area for it e.g. in global parameters write wa like konv.

and then create a loop by right clicking on window.

in loop write itab into wa.

then right click on loop and create text.

where u display &wa-amount&.

Read only

0 Likes
481

Hi,

thanks for given a suggetion.solved my answer.

thanks & regrds

rangaswamy

Read only

Former Member
0 Likes
482

hi ranga.

try to code like this:

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'

AND KPOSN = IT_VBRK-KNUMV.

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'.

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'.

AND KPOSN = IT_VBRK-KNUMV.

loop at it_vbrk.

read table it_konv with key KNUMV = IT_VBrK-KNUMV and kschl eq 'ZRPR'

AND KPOSN = IT_VBRK-KNUMV.

if sy-subrc = '0'.

read table it1_konv with key KNUMV = IT_VBRK-KNUMV and kschl eq 'ZFAB'.

if sy-subrc = '0'.

read table it2_konv with key KNUMV = IT_VBRK-KNUMV and kschl eq 'ZRLB'.

AND KPOSN = IT_VBRK-KNUMV.

if sy-subrc = '0'.

amount = it_konv-kbetr + it1_konv-kbetr + it2_konv-kbetr .

value = it_konv-kwert + it1_konv-kwert + it2_konv-kwert .

endif.

endif.

endif.

itabfinal-amount = amount.

itabfinal-value = value.

clear: amount, value.

append itabfinal.

endloop.

Read only

0 Likes
481

thanks for given a suggetion.solved my answer.

thanks & regrds

rangaswamy