‎2008 Aug 09 11:35 AM
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
‎2008 Aug 09 12:37 PM
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.
‎2008 Aug 09 12:29 PM
**********************************************
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&.
‎2008 Aug 09 2:56 PM
Hi,
thanks for given a suggetion.solved my answer.
thanks & regrds
rangaswamy
‎2008 Aug 09 12:37 PM
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.
‎2008 Aug 09 2:52 PM
thanks for given a suggetion.solved my answer.
thanks & regrds
rangaswamy