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

material consumption

Former Member
0 Likes
1,769

hi experts,

i have to calculate the total material consumed with respect to goods issued and goods receipt. I am unable to find the logic for 20 movement types assigned to me to calculate goods consumed.

can any one help me to find a logic...

i used the tables: MSEG, MKPF.

or can anyone send me a sample code to calculate the goods consumed to my id sabteam@rediffmail.com

thanx in advance

Afsar

14 REPLIES 14
Read only

Former Member
0 Likes
1,705

Hello,

Some of the movement types may not record consumption since they are configured like that. The table for cosumption data is MVER.

Thanks,

Venu

Read only

0 Likes
1,705

Hi Venu,

Actually i collect the material numbers from estmj table and for those i calculate the material consumption.

and those materials r not in MVER table in my server.

do u have any sample code how to use the logic for material consumption with movement types.

Thanx

Syed

Read only

0 Likes
1,705

Hi,

Have you looked FM CONSUMPTION_READ_FOR_MM?

Here are the parameters.

- Material Number MATNR

- Plant WERKS

- Period Indicator PERKZ (M= Monthly, W=Weekly, T=Daily, P = Fiscal Year)

- Fiscal year variant PERIV (if PERKZ = P)

<b>FYI

</b>

Hope this’ll give you idea!!

<b>Pl... award the points.</b>

Good luck

Thanks

Saquib Khan

"Some are wise and some are otherwise"

Read only

0 Likes
1,705

hi saquib do u have any sample code for material consumption, can u send it to me?

i am confused how to use the FM..

i have around 20 movement types for all plants in client..

so plant is paprameters.. if the enduser selct the plant then it looks for material and movement types and calculate the consumed material.

if enduser didn't select any plant then it search for all plants for the selected material numbers and shud show the final consumtion.

my problem is how to calculate the consumption for morethan 20 movement types from different plants..

i need logic...

my present logic is..

LOOP AT m_mseg.

count = m_mseg-bwart MOD 2.

IF count = 0.

consume = consume - m_mseg-menge.

ELSE.

consume = consume + m_mseg-menge.

ENDIF.

ENDLOOP.

m_mseg table contains movement types for selected material number from all plants..

is that logic good?

thanx

Read only

0 Likes
1,705

You must know the list of movement which tells you which are consumption movement type and which are reversal for consumption. Well I posted one time a table name which contain all the movement type telling its consumption etc .. You can search on SDN threads and find it . I also write a small logic there...

<b>

</b>

Pl..reward the points

Thx

Saquib

Read only

0 Likes
1,705

Hi Experts,

i have a doubt on movement types, for example:

103 - GR into blocked stock

104 - GR to blocked rev.

715 - GI InvDiff: Returns

for above movement types what is total consumption?

consumption = 715 - 103 - (-104) = 715-103 + 104

is it right?

and 653 - GD Returns unrestr.

654 - GD Returns unrestr. rev.

what these movement type means? issue or receipt?

Thanx

Read only

0 Likes
1,705

103/104 and 653/654 are pairs...so in that case consumption would be 103 - 104 and 653 - 654.

Regards

Anurag

Read only

0 Likes
1,705

So, consumtion = (103 -104) + (653-654)

when we r calculating consumption can we also consider the movement type with MSEG-XAUTO = 'X' ?

541 - GI whse to subc. stck.

what it means?

when i run mb5b tcode for a particular material it was taken as 541 as for consumption.. i am confused?

Read only

0 Likes
1,705

I think its getting a bit confusing ...the best solution is when you loop through the material documents database(MSEG), read the table T156 with Movement type(MSEG-BWART) field. If the Consumption posting field in the table T156 is not empty you need to include that in your consumption total.

Consumption Posting - T156-KZVBU

Values - Space - No consumption

G - Planned withdrawal

R - Planned, (ref to reservation)

U - Unplanned withdrawal.

Please try the above..I feel it should help.

Regards

Anurag

Read only

0 Likes
1,705

Hi,

the problem is i got arund 50 movement types for all plants for my comapny.

when i give material name then it total material consumed for all plants.... if plant is also given then material consumed for respective plant.

and i am confused how to know which movement type is for goods issue, goods issue rev, goods receipt , goods recipt rev..

and i am bit new to abap...

and confusing how to code all movement types for material consumption... which is + or - ?

send a sample code if u have so i can get better idea

thanx in advance

Read only

0 Likes
1,705

Syed,

Try and use the below logic.

SELECT {required fields - MATNR,WERKS,SHKZG,BWART,MENGE}

FROM MSEG

INTO IT_CONS

WHERE MATNR in SelectOpt-Matnr and

WERKS in SelectOpt-WERKS and

KZVBR = 'V' and

BWART in SelectOpt-Bwart.

SORT IT_CONS.

LOOP AT IT_CONS.

AT NEW WERKS.

CLEAR : W_TOTCONS.

ENDAT.

write IT_CONS. {If you wish to print the list}

If it_cons-SHKZG = 'S'.

w_totcons = w_totcons + it_cons-menge.

elseif it_cons-shkzg = 'H'.

w_totcons = w_totcons - it_cons-menge.

endif.

AT END OF WERKS.

write : W_TOTCONS.

endat.

ENDLOOP.

The above code would help you to calculate the total consumption for the given material and plant.

Regards

Anurag

Read only

0 Likes
1,705

Hi syed,

check for shkzg field in mseg if it is s then + if it is - then h

finally consumption is s - h

hope this helps

Read only

0 Likes
1,705

hi srinu and anurag,

is the consumption takes place only if the storage location is assigned... i mean for some movement type the storage location is ' ' (SPACE).

shall we have to consider those movement types also?

thanx

Syed

Read only

0 Likes
1,705

syed,

Yes you should consider it...

Regards

Anurag