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

Account groups (Ktokd)

Former Member
0 Likes
1,071

Hi guys,

S.O.S.

I have a request to modify a report,so I can show the

total of the money(wrbtr) that al the clients (kunnr) of a particular account group (ktokd)have to pay to my company.

how can I group this to fields (wrbtr, ktokd) taking in count that I have to know for sure that the money (wrbtr) belongs to the client (kunnr) that is in my account group (ktokd), so I can show the total per KTOKD.

If someone can please help me, I'll appreciate it.

Thanks in advanced,

Fidel.

Hi guys,

S.O.S.

I have a request to modify a report,so I can show the

total of the money(wrbtr) that al the clients (kunnr) of a particular account group (ktokd)have to pay to my company.

how can I group this to fields (wrbtr, ktokd) taking in count that I have to know for sure that the money (wrbtr) belongs to the client (kunnr) that is in my account group (ktokd), so I can show the total per KTOKD.

If someone can please help me, I'll appreciate it.

Thanks in advanced,

Fidel.

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
892

Assuming that you have an internal table with all three fields....

data:

Begin of itab,
   ktokd type ktokd,
   kunnr type kunnr,
   wrbtr type wrbtr,
end of itab.

Have a second itab with just ktokd and wrbtr.


Data:

Begin of itab2,
   ktokd type ktokd,
   wrbtr type wrbtr,
end of itab2.

Now loop at the first and collect into the second.

Loop at itab.
move-corresponding itab to itab2.
collect itab2.
endloop.

This will add up the "money" by account group.

Hope I understood your question.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
892

Hi Rich,

I should explain my self better. The report has to different itab; one with the client and the money, it_factura (that's the spanish for it_invoice) and the other, it_deudores (that's the spanish for it_indebted).

I was looking for the way to collect the data into one internal table that I created like the first one you assume I have the data in.

My problem is that I don't know another way to put the correct data ( all the wrbtr that belongs to a particular ktokd) in my internal table it_ktokd.

The only way I can do it is to create an inner join and put the data in my internal table it_ktokd (the one that has wrbtr and ktokd) and forget about the data that exist already in it_factura and it_deudores.

If there is a way for me to put the data in it_ktokd using it_factura and it_deudores, any help will be appreciate it.

Thanks a lot Rich,

Fidel.

Read only

0 Likes
892

Ok....so first you need to get the data into one itab. Some how you need to tie all this data together. For me to better understand and help you, I will need you to tell the exact table where your data is.

Regards,

Rich Heilman

Read only

0 Likes
892

Hi,

See if this works out for you.

ITAB1 : kunnr , wrbtr
ITAB2 : kunnr , ktokd

ITAB3 : wrbtr , ktokd "you want to build this one"

sort itab1 by kunnr.
sort itab2 by kunnr.

loop at itab1.
  loop at itab2 where itab2-kunnr = itab1-kunnr.
     move itab1-wrbtr to itab3-wrbtr.
     move itab2-ktokd to itab3-ktokd.
     collect itab3.
  endloop. 
endloop.

For better performance, you can use parallel cursors.

Regards,

Anand Mandalika.

Read only

0 Likes
892

thanks Poornanad....you solve the problem. thank you so

much.

Fidel.