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

Need help on internal table data processing

Former Member
0 Likes
636

Hi ,

Have used inner joni and have collect the data in an internal table.Now I am not able to go forward to accumulate the data..The interbal table have the following field.

VKORG | KUNNR | MATNR | KWMENG | ZDON..I have sorted the table with the fields

Sort I_VBPA by Vkorg kunnr matnr zdon.I wanted to collect then total of Kwmeng for a set of VKORG | KUNNR | MATNR and ZDON.

EG:

VKORG | KUNNR | MATNR | KWMENG | ZDON..

XXXX yyyy ZZZZ 20 SSSS

XXXX yyyy ZZZZ 10 SSSS.

I wanted to get it as :

XXXX YYYY ZZZZ 30 ssss.

Please let me have ur input ASAP

Thanks

1 ACCEPTED SOLUTION
Read only

dev_parbutteea
Active Contributor
0 Likes
600

Hi,

<fs> type I_VBPA

<fs2> type I_VBPA

Sort I_VBPA by Vkorg kunnr matnr zdon

V_index = 0.

loop at I_VBPA assigning <fs>.

V_index = sy-tabix + 1.

read I_VBPA assigning <fs2> with index V_index .

if sy-subrc = 0.

--if <fs>-VKORG= <fs2>-VKORG

and <fs>-KUNNR = <fs2>-KUNNR

and <fs>-MATNR = <fs2>-MATNR

and <fs>-ZDON = <fs2>-ZDON .

-


<fs>-KWMENG= <fs>-KWMENG = <fs2>-KWMENG.

-


deleteI_VBPA index V_index.

--endif.

endif.

endloop.

Regards,

Sooness.

6 REPLIES 6
Read only

Former Member
0 Likes
600

Hi,

Use the break events processing like eg:

LOOP AT ITAB.

AT LAST.

SUM.

ENDAT.

ENDLOOP.

TOTALORDAMT = ITAB-ORDAMT.

or

Do this.

data: totalorderamt(12) type n

Loop at itab.

totalorderamt = totalorderamt + itab-amount.

endloop.

Hope this info helps.

Regards,

Kumar.

Read only

Former Member
0 Likes
600

Hi,

You simply use collect insead of append in iternal table... By this your non numeric fields collect in single row with unique non numeric field combination..

Regards,

Reema Jain.

Read only

Former Member
0 Likes
600

Hello Donny,

use collect statement.

Eg.

if u hv data in table itab1 then collect data in internal table itab2.

loop at itab1.

move itab1 to itab2.

collect itab2.

endloop.

Read only

dev_parbutteea
Active Contributor
0 Likes
601

Hi,

<fs> type I_VBPA

<fs2> type I_VBPA

Sort I_VBPA by Vkorg kunnr matnr zdon

V_index = 0.

loop at I_VBPA assigning <fs>.

V_index = sy-tabix + 1.

read I_VBPA assigning <fs2> with index V_index .

if sy-subrc = 0.

--if <fs>-VKORG= <fs2>-VKORG

and <fs>-KUNNR = <fs2>-KUNNR

and <fs>-MATNR = <fs2>-MATNR

and <fs>-ZDON = <fs2>-ZDON .

-


<fs>-KWMENG= <fs>-KWMENG = <fs2>-KWMENG.

-


deleteI_VBPA index V_index.

--endif.

endif.

endloop.

Regards,

Sooness.

Read only

0 Likes
600

correction: <b><fs>-KWMENG= <fs>-KWMENG + <fs2>-KWMENG.</b>

Read only

Former Member
0 Likes
600

hi,

ty this one

sort itab by VKORG KUNNR MATNR KWMENG ZDON.

loop at itab.

at end of vkorg.

sum.

write:/ vkorg..................

endat.

endloop.

if not working try this one

loop at itab.

at end of zdon.

sum.

write:/ vkorg..................

endat.

endloop.

dont forget to reward points,

Regards,

Imran