09-18-2008 12:17 PM
Hi Expertz,
my data is somthing like this
1234 em 1 12.20 2 34.50 1 23.10 1 12.20
1234 em 1 32.34 3 34.21 0 20.10 1 10.10
1234 sm 1 10.10 1 20.10 1 30.10 1 21.10
after running this bit of code below
LOOP AT gt_output.
AT NEW schemecode.
gt_output3-storeno = gt_output-sno.
gt_output3-schemecode = gt_output-scode.
APPEND gt_output3.
ENDAT.
gt_output3-tddreq = gt_output-tddreq.
gt_output3-tddvalue = gt_output-tddvalue.
gt_output3-tunpaiddds = gt_output-tunpaiddds.
gt_output3-tvunpaiddds = gt_output-tvunpaiddds.
gt_output3-tothers = gt_output-tothers.
gt_output3-tothersvalue = gt_output-tothersvalue.
gt_output3-trefunds = gt_output-trefunds.
gt_output3-trefundsvalue = gt_output-trefundsvalue.
COLLECT gt_output3.
ENDLOOP.
im expecting my output as :
1234 em 2 44.54 2 68.71 1 43.20 2 30.30
1234 sm 1 10.10 1 20.10 1 30.10 1 21.10
But its not happening...could you please where im going wrong.
thanks
09-18-2008 12:19 PM
schemecode shoud be the first field of internal table
otherwise at new statement not work
em 234 1 12.20 2 34.50 1 23.10 1 12.20
em 1234 1 32.34 3 34.21 0 20.10 1 10.10
sm 1234 1 10.10 1 20.10 1 30.10 1 21.10
it shoud be like that
regards,
Alpesh
09-18-2008 12:19 PM
LOOP AT gt_output.
gt_output3-tddreq = gt_output-tddreq.
gt_output3-tddvalue = gt_output-tddvalue.
gt_output3-tunpaiddds = gt_output-tunpaiddds.
gt_output3-tvunpaiddds = gt_output-tvunpaiddds.
gt_output3-tothers = gt_output-tothers.
gt_output3-tothersvalue = gt_output-tothersvalue.
gt_output3-trefunds = gt_output-trefunds.
gt_output3-trefundsvalue = gt_output-trefundsvalue.
COLLECT gt_output3.
AT END schemecode.
gt_output3-storeno = gt_output-sno.
gt_output3-schemecode = gt_output-scode.
APPEND gt_output3.
ENDAT.
ENDLOOP.
09-18-2008 12:19 PM
check this way...no need to use control break statments.
LOOP AT gt_output.
gt_output3-storeno = gt_output-sno.
gt_output3-schemecode = gt_output-scode.
gt_output3-tddreq = gt_output-tddreq.
gt_output3-tddvalue = gt_output-tddvalue.
gt_output3-tunpaiddds = gt_output-tunpaiddds.
gt_output3-tvunpaiddds = gt_output-tvunpaiddds.
gt_output3-tothers = gt_output-tothers.
gt_output3-tothersvalue = gt_output-tothersvalue.
gt_output3-trefunds = gt_output-trefunds.
gt_output3-trefundsvalue = gt_output-trefundsvalue.
COLLECT gt_output3.
ENDLOOP.
09-18-2008 12:22 PM
sort internal table by all the character feilds fields that u want to collect than use collect
09-18-2008 12:21 PM
Hi
Is the structure of gt_output and gt_output3 same ?
If yes
try the below code
LOOP AT gt_output.
gt_output3-storeno = gt_output-sno.
gt_output3-schemecode = gt_output-scode.
gt_output3-tddreq = gt_output-tddreq.
gt_output3-tddvalue = gt_output-tddvalue.
gt_output3-tunpaiddds = gt_output-tunpaiddds.
gt_output3-tvunpaiddds = gt_output-tvunpaiddds.
gt_output3-tothers = gt_output-tothers.
gt_output3-tothersvalue = gt_output-tothersvalue.
gt_output3-trefunds = gt_output-trefunds.
gt_output3-trefundsvalue = gt_output-trefundsvalue.
COLLECT gt_output3.
ENDLOOP.
Regards
MD
09-18-2008 12:33 PM
Hi GUyz,
Thanks for quick replies..but nothing working..anymore ideas..
thanks
09-18-2008 12:38 PM
SORT gt_output BY sno scode tddreq.
LOOP AT gt_output INTO wa_output.
COLLECT wa_output INTO gt_output3.
ENDLOOP.
Hope you achevie your output , if not pls place your o/p for the above code .
09-18-2008 12:48 PM
Nothing changes the records are same in both gt_output and gt_output3.
Thanks
09-18-2008 12:54 PM
09-18-2008 12:55 PM
hi there
declaration part
DATA: BEGIN OF gt_output OCCURS 0,
storeno TYPE ad_sort2,
schemecode TYPE matnr,
totalddreq(10) TYPE c,
totalddvalue(10) TYPE c, "wrbtr,
totalunpaiddds(10) TYPE c,
tvunpaiddds(10) TYPE c, "wrbtr,
totalothers(10) TYPE c,
totalothersvalue(10) TYPE c, "wrbtr,
totalrefunds(10) TYPE c,
totalrefundsvalue(10) TYPE c, "wrbtr,
END OF gt_output.
DATA : wa_output LIKE gt_output.
DATA:gt_output3 LIKE TABLE OF gt_output WITH HEADER LINE.
Thanks
09-18-2008 1:26 PM
Change the declaration like below and my above code will work
DATA: BEGIN OF gt_output OCCURS 0,
storeno TYPE ad_sort2,
schemecode TYPE matnr,
totalddreq(10) TYPE c,
totalddvalue(10) TYPE WRBTR, "wrbtr,
totalunpaiddds(10) TYPE WRBTR,
tvunpaiddds(10) TYPE WRBTR, "wrbtr,
totalothers(10) TYPE WRBTR,
totalothersvalue(10) TYPE WRBTR, "wrbtr,
totalrefunds(10) TYPE WRBTR,
totalrefundsvalue(10) TYPE WRBTR, "wrbtr,
END OF gt_output.
DATA : wa_output LIKE gt_output.
DATA:gt_output3 LIKE TABLE OF gt_output WITH HEADER LINE.
As collect statement will not some character's , since you are using a currency field i have given the DE wrbtr ref .
09-18-2008 12:55 PM
HI,
use below code,
data : flag type c.
data : flag_e type c.
LOOP AT gt_output.
AT NEW schemecode.
flag = 'X'.
ENDAT.
AT END OF schemecode.
flag_e = 'X'.
ENDAT.
gt_output3-tddreq = gt_output-tddreq.
gt_output3-tddvalue = gt_output3-tddvalue + gt_output-tddvalue.
gt_output3-tunpaiddds = gt_output3-tunpaiddds + gt_output-tunpaiddds.
gt_output3-tvunpaiddds = gt_output3-tvunpaiddds + gt_output-tvunpaiddds.
gt_output3-tothers = gt_output3-tothers + gt_output-tothers.
gt_output3-tothersvalue = gt_output3-tothersvalue + gt_output-tothersvalue.
gt_output3-trefunds = gt_output3-trefunds + gt_output-trefunds.
gt_output3-trefundsvalue = gt_output3-trefundsvalue + gt_output-trefundsvalue.
if flag = 'X'.
gt_output3-storeno = gt_output-sno.
gt_output3-schemecode = gt_output-scode.
endif.
if flag_e = 'X'.
APPEND gt_output3.
clear gt_output3.
endif.
clear: flag, flag_e
ENDLOOP.
hope it will work for you...
Regards,
Meet
09-18-2008 1:04 PM
Hi Meet
do i have to use collect statements somewhere in your logic? its not adding them up.
09-18-2008 1:33 PM
Hi,
in my code you dont need to use collect.
i think it should be work for you.
declare your internal table as per karthik's sudgession and use my code.
Regards,
Meet