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

function module

Former Member
0 Likes
1,830

i want funtion module for the convert the quantity in sales unit into the base unit

and the condition is the retrive the base unit of measure, if the base UOM is not equal to sales UOM..

inputs are the material number and sales unit and quantity

regards

VIjay Pawar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,258

better to make use of table MARM .

based on the conversion factor of(UMREZ & UMREN) for a given material

Regards

Prabhu

5 REPLIES 5
Read only

Former Member
0 Likes
1,259

better to make use of table MARM .

based on the conversion factor of(UMREZ & UMREN) for a given material

Regards

Prabhu

Read only

Former Member
0 Likes
1,258

Hi

Use the function module

UNIT_CONVERSION_SIMPLE

OR md_convert_material_unit

REWARD IF USEFUL

REGARDS,

Anji

Read only

Former Member
0 Likes
1,258

Use table <b>MARM</b>.Write a select query based on material number and do the necessary calculations based on fields <b>UMREZ</b> and <b>UMREN</b>.

Plz reward points if answer is helpful.

Thanks.

Chinmay

Read only

Former Member
0 Likes
1,258

you can get clear picture of this if you go thru MM03

->basic view . here on the application tool bar "additional data" button will be there.

if you click on this, you will see a new screen with different tabs. select "Units of Measure".

here you can see the alternative UOM for each material.

the same values are stored in MARM table.

for example : if Base UOM is EA, then

(for example a material "A", will have these)

1 EA each <=> 1 EA each

1 CAS Case <=> 1 EA each

1 SFC Singles <=> 1 EA each

1 PC Piece <=> 1 EA each

1 KG kg <=> 23 EA each

1 BX Box <=> 80 EA each

1 PAL Pallet <=> 2,880 EA each

from the above picture,

1 box = 80 eaches.

so to get this value in program, go to MARM

pass MATNR & 'BX'.

you will get a record with

UMREZ = 80

& UMREN = 1.

so if you do UMREZ/UMREN, WILL give you the quantity in Alternative UOM. in this case BX.(box).

<u><i><b>

OR</b></i></u>

Use function module MATERIAL_UNIT_CONVERSION.

If you are having simple UOM conversion, you can do something like this.

report zrich_0001.

parameters: p_qtyi type p decimals 2,

p_uomi type t006a-msehi,

p_uomo type t006a-msehi,

p_qtyo type p decimals 2.

at selection-screen.

call function 'UNIT_CONVERSION_SIMPLE'

exporting

input = p_qtyi

  • NO_TYPE_CHECK = 'X'

  • ROUND_SIGN = ' '

unit_in = p_uomi

unit_out = p_uomo

importing

  • ADD_CONST =

  • DECIMALS =

  • DENOMINATOR =

  • NUMERATOR =

output = p_qtyo

  • EXCEPTIONS

  • CONVERSION_NOT_FOUND = 1

  • DIVISION_BY_ZERO = 2

  • INPUT_INVALID = 3

  • OUTPUT_INVALID = 4

  • OVERFLOW = 5

  • TYPE_INVALID = 6

  • UNITS_MISSING = 7

  • UNIT_IN_NOT_FOUND = 8

  • UNIT_OUT_NOT_FOUND = 9

  • OTHERS = 10

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

Regards,

navjot

reward if helpfull

Message was edited by:

navjot sharma

Message was edited by:

navjot sharma

Read only

Former Member
0 Likes
1,258

thanks