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

Reading data and displaying

Former Member
0 Likes
775

Hi all,

Have a situation as follows and need your advice.

I have to read the delivered quantites of a meaterial within a definite period of time from the table LIKP and split the delivered quantities by month.

The input from the user is the meaterial number and the time range.

See the attached image for the endresult.

[http://img163.imageshack.us/img163/2082/testfile.jpg]

select matnr,Sold-To-Party,deliveredQuantity,DeliveryDate into itab from LIKP where matnr = meaterialNr.

(The select fields are just example names and not the actual fields in the table)

So if the generated itab is as follows:

matNr  Sold-To-Party    delivered_Quantity    deliveryDate

[1] x        A                         3                                  01.01.2010
	
[2] x        B                         4                                   30.09.2009

[3] x        C                         4                                   15.02.2009

[4] x        A                        4                                   15.01.2010

[5] x        A                        4                                  20.02.2010

[6] x        A                        4                                   30.03.2010

I have to to sum up the quantities for each "Sold_To_Party according to month by looping through the itab.

In the above Example for Sold-To-Party "A" I have to sum up the quantiies of [1] and [4] for the month of january. [5] for the month of february(Summing up if there is another quantity for meaterial in February).[6] for the month of march and so on.

My question is ,Is this a good approach.Is there any better approach or idea to make it effective and simpler.

A sample code would be helpful..

Thanks

P

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
737

Hello,

1. you have to add one field in between sol to party and delivered quantity, month.

2. filled month with month value like 01, 02, 03.

3. sort the table by material sold to party and month

4. loop the internal table and use

AT END OF month

SUM.

END AT.

and move the entries to separate internal table.

4. hide month filed at the time building field catalog...

Hope it will help you.

Thanks

K.

7 REPLIES 7
Read only

Former Member
0 Likes
738

Hello,

1. you have to add one field in between sol to party and delivered quantity, month.

2. filled month with month value like 01, 02, 03.

3. sort the table by material sold to party and month

4. loop the internal table and use

AT END OF month

SUM.

END AT.

and move the entries to separate internal table.

4. hide month filed at the time building field catalog...

Hope it will help you.

Thanks

K.

Read only

0 Likes
737

Thanks.Few questions are still revoving around in my head

>>1. you have to add one field in between sol to party and delivered quantity, month.

That is ,I have to put in an additional field in my itab.

>>2. filled month with month value like 01, 02, 03.

I was filling my itab as follows from the LIKP table.

The delivery date field in LIKP ,must be of type DATE.

How will I fill the month field in the itab by changing the following select.

SELECT matnr,Sold-To-Party,deliveredQuantity,DeliveryDate into itab from LIKP where matnr = meaterialNr.

Read only

0 Likes
737

Hi,

Try using COLLECT stmt. if collect doesnot work, try looping through the current table and then add into another internal table. Hope that helps.

Regards,

Kavitha Kraj

Edited by: Kavithakraj on Mar 11, 2010 9:17 AM

Read only

0 Likes
737

Hi,

For your question

How will I fill the month field in the itab by changing the following select.

You can get the month from the date and modify the internal table by filling the month field.

Read only

0 Likes
737

Is it possible to get one go using the select statement the month

OR

I get the date field in the itab and then loop through the itab and modify the date field to month by slicing the date string.

Was better when I could do it with the select statement at one go....

Is that possible.....

Read only

0 Likes
737

hi,

i don't think you can do the changes in one go in the select statement.

you will have to get the data in itab then loop through it and then modify.

Read only

0 Likes
737

Thanks all ....