10-03-2008 12:55 PM
HI ALL,
i have a prob in displaying the records
i have got the records in the internal table. the records which r there in my criteria has the follw . strct.
matnr plant month stock
001 xxx 2 15
001 xxx 6 5
i m getting these values but i just wat the values like tis,
matnr plant apr may june jul aug sep
001 xxx 0 15 5
plzz help me out..
thanxx
Edited by: NILESH S. on Oct 3, 2008 1:56 PM
10-03-2008 1:00 PM
hi,
u declare two itabs. and in one itab store that matnr and remaining details.
and one more ITAB store that months Matnr, JAN, FEB,MAR,.....DEC.
while displaying.
Loop at itab1
read table itab2 with key itab2-matnr = itab1-matnr.
write: itab1-matnr, itab1-desc, itab2-mar,itab2-apr.....
endloop.
Regards,
Shankar.
10-03-2008 1:03 PM
Declare your table structure with 12 seperate month fields.
When you select your data, put the stock value of a month in the appropriate month field.
No need for 2 tables.
Edited by: Maen Anachronos on Oct 3, 2008 2:03 PM
10-03-2008 1:06 PM
it will be very helpful if both these answers will be in detailed for...
thanx....
10-03-2008 1:22 PM
Declare your table structure with 12 seperate month fields.
When you select your data, put the stock value of a month in the appropriate month field.
No need for 2 tables.
Edited by: Maen Anachronos on Oct 3, 2008 2:03 PM
i had tried this but for 1 material if i select 3 months it will be displayed 3 times in the table & so on the o/p screen....
10-03-2008 1:26 PM
I don't know how your program looks like. But apparently your doing an append for each record found.
Select all months for a material, distribute the month values into their corresponding month field and then do an append.
10-03-2008 1:39 PM
10-03-2008 1:42 PM
>
> thats what i want in little details..
Select all months for a material, distribute the month values into their corresponding month field and then do an append.
10-03-2008 1:56 PM
c im doing this...
i have foll. struct .
tell me where to place append
select a b c
select matnr......
select werks matnr lfmon ...
by if cond.
apr = the value.
i.e. sending values into corresponding months..
append itab.
endselect.
endselect
endselect.
if i placed apend after 1st endselect its giving me unwanted matnr...
so what to do now...?
10-03-2008 1:59 PM
10-03-2008 1:07 PM
Hi,
Create an internal table with header line say it_tabl2 with the fields as specified by you ie as matnr plant apr may june jul aug sep .
Say the internal table you have initially is it_table1 with header line. Do as follows
loop at it_table1.
it_tabl2-matnr = it_table1-matnr.
it_tabl2-plant = it_table1-plant.
case it_tabl2-month.
when '1'.
it_tabl2-jan = it_table1-stock.
when '2'.
it_tabl2-feb = it_table1-stock.
when '3'.
it_tabl2-mar = it_table1-stock.
....
.....
....
when '5'.
it_tabl2-may = it_table1-stock.
....
.....
...
endcase.
append it_tabl2-jan .
clear it_table1.
endloop.
Now display the contents of the internal table it_tabl2 in which ever way you want.
Hope this helps you.
Regards,
Murthy.
Edited by: pr murthy on Oct 3, 2008 2:08 PM
10-03-2008 1:19 PM
10-03-2008 1:19 PM
10-03-2008 1:56 PM
Dear Nilesh,
Why my code will give only first record correct. Its going to give result as I have written my logic inside a loop, not just for first record.
sorry ,
its not correct its giving me only the first record...
By the way I am not here to be judjed by you dear friend, I may not be able to get your requirement correct, but I am sure my code is going to work for your requirement. You must explaine if you think I did not get your requirement correct.
Regards,
Murthy.
Edited by: pr murthy on Oct 3, 2008 2:56 PM
10-03-2008 2:15 PM
Hi Nilesh,
No need to change ur whole logic. Check this code.
SORT itab BY matnr werks.
WRITE: /1 'matnr'
20 ' plant'
25 'Jan'
35 'Feb
.
.
.
135 'Dec'.
may june jul aug sep " Give the positions appropriately(As per ur field length)
LOOP AT itab INTO wa.
AT NEW werks.
WRITE: /1 wa-matnr,
20 wa-werks.
ENDAT.
CASE wa-month.
WHEN '1'.
WRITE: 25 wa-stock.
WHEN '2'.
WRITE: 35 wa-stock.
.
.
.
WHEN '12'.
WRITE: 135 wa-stock.
ENDCASE.
ENDLOOP.
This surely solves ur problem.
Changed AT END OF to AT NEW:-)
Thanks,
Vinod.
Edited by: Vinod Reddy Vemuru on Oct 3, 2008 6:46 PM
10-04-2008 1:50 PM
the only prob with this solution is it is showing the 1st materail no 2 times for 2 months and showing both the values in the samr field of month (eg. may).
the remaining is working fine thanx.....a lot
10-05-2008 10:15 AM
Hi Nilesh,
Since we are using the AT event wrt to plant(Werks) it is showing the material number more than once i.e once for the combination of material and plant. If u want to segregate the data at material level then use the AT END OF matnr instead of AT END OF werks.
U told quantity is printing at same month(May). For this either both plants has stock in May or u might be giving wrong positions in write statements. Check these and get back in case of any issues.
Thanks,
Vinod.
12-23-2008 5:54 AM