Monday, November 7, 2016

Alternative Unit of Measure for Material

Before dealing with sap alternative unit of measure, let’s define what Base Unit of Measure for a SAP Material then we will explain the Alternative unit for Material.

SAP Units of Measurement Overview

Unit of measure in which stocks of the material are managed. The system converts all the quantities you enter in other units of measure (alternative units of measure) to the base unit of measure. Then I will explain how Alternative Units work for Material. 
You define the base unit of measure and also alternative units of measure and their conversion factors in the material master record.
It is usually refer in SAP with MEINS

SAP Units of Measurement

 Tables
All the Unit are stored in Standard Table T006.
In This Table T006, Details of the Unit and the kind of the unit are defined such as Nb od Decimal, Dimension key, Temperature, Pressure …
Check the table T006A ( Assign Internal to Language-Dependent Unit ) For Unit Description.
T006A-MSEHI is the Unit of Measurement and T006A-MSEHT is for Unit of Measurement Text.

SAP Units of Measurement Conversion Function

IF you check the data element of MEINS ( Unit of Measurement ), it has in standard a conversion routine.
Unit of Measurement Data Element
The conversion routine for MEINS are:
  • CONVERSION_EXIT_CUNIT_INPUT Conversion exit for commercial (3-char) measurement unit INPUT
  • CONVERSION_EXIT_CUNIT_OUTPUT Conversion exit for commercial (3-char) measurement unit OUTPUT
Actually, Unit of Measurement are defined in interne format and external format. This is can be helpfull when looking for SAP Material Unit Conversion.
For exemple, the internal format for Box unit, is BOXand the external unit will be KAR ( this is the commercial value ). This is can be found easly for Sap Material Unit Conversion function module with
CONVERSION_EXIT_CUNIT_INPUT or OUTPUT.

SAP Units of Measurement on Material

The Most important Unit of Measurement for a Material is the Base Unit of Measure. It is the defaut Unit for Sales, Delivery and Stock when dealing with the Material.
The Value of SAP Base Unit for Measure for a Material can be found at MARA-MEINS.

SAP Alternative Unit of Measure

A unit of measure that is defined in the SAP system in addition to the base unit of measure (BUn, base UoM). For example, the base unit of measure might be “pallet” while the alternative unit might be “carton”.

SAP Material : Alternative Units of Measure

In order to maintain or display this list, open the Material General Data ( MM02 for Change or MM03 for Display), Go to Additionnal Data (on the top bar) , then select the second tap Unit of Mesure.

Alternative Units of Mesure for MaterialMaterial Alternative Units of Mesure Overview

Let’s try to decrypt how the Units of Mesure works.
Unit of measure in which quantities can be entered alternatively to the base unit of measure / stockkeeping unit.
To convert a quantity, whose unit of measure is not the same as the base unit of measure, into the base unit of measure, the system requires a quotient:
Quantity (in alternative unit of measure) = quotient * quantity (in base unit of measure)
In Order to define the Quotient = Numerator / Denominator

Alternative Unit of Measure for Stockkeeping Unit (X)

Denominator for conversion to base units of measure

Denominator of the quotient that specifies the ratio of the alternative unit of measure to the base unit of measure.

Numerator for Conversion to Base Units of Measure (Y)

Numerator of the quotient that specifies the ratio of the alternative unit of measure to the base unit of measure.

SAP Material Alternative Units of Measure Table

The table where the alternative Units of measure, Numerator and Denominator is MARM (Units of Measure for Material).
  • MEINH: Alternative Unit of Measure for Stockkeeping Unit
  • UMREZ: Numerator for Conversion to Base Units of Measure
  • UMREN: Denominator for conversion to base units of measure
You can define an International Article Number (EAN/UPC) by alternative unit.
It is useless to look for the base unit in this table. Actually the Base Unit of measure is only on MARA-MEINS.

Convert Material Quantities to Different Unit of Measure

In order to convert SAP Material Quantities from an unit of Measure to an other or an alternative unit, use the standard function module MATERIAL_UNIT_CONVERSION.
a sample use for MATERIAL_UNIT_CONVERSION, is

Wednesday, November 2, 2016

Using SAP messages with your ABAP programs

SAP messages are an essential part of any ABAP program and are used to display information to the user to let them know what's happening. 

The following ABAP code is the simplest way to implement a message into your report. 

    MESSAGE 'Display this message' TYPE 'E'. 

SAP Message Classes 
A better way to implement your messages would be to create and maintain them via a message class using transactions SE91 or SE80. This way you have a central store for all messages, which makes it easier to maintain them. This is especially true if your messages need to be translated into multiple languages. 

To do this you first need to create a message class which is a kind of container/wrapper where you store related messages together. Once this is done you can add as many message as you require into it. You also get the option to create additional long text, which offers the user additional information about the particular issue. See the following link for more information and details of how to create a message class

Once you have created your message you can use them within your ABAP code using the following syntax: 

    MESSAGE E001(MCLASS). 

MESSAGE = ABAP statement 
E = Type of message (can also be I,W,S,A,X) 
001 = Message number 
MCLASS = Message Class 

You can also add parameters to your messages using the "&" character. So for example you could create the following message 'Purchase order & has been deleted'. You can then pass a purchase order to the message when using it and it will replace the "&" with the purchase order you pass for example 

    MESSAGE E001(MCLASS) with ekko-ebeln. 

The result would display 
"Purchase order 1234 has been deleted"

Further information about message types 

I - Information messages
Information message are displayed in a popup window and only pause processing until you have clicked through the message. 

E - Error message 
An error message will be displayed in red along the footer of the SAP screen and stops processing going any further. 

W - Warning message 
A warning message behaves similar to and error message and is displayed along the footer of the SAP screen and stops processing going any further. 

S - Success/Status message 
A Success message is also displayed along the footer of the SAP screen but does not stop processing going any further and is simply displayed at the end in green. 

Termination messages:
The termination messages (message type A or X) leads to an implicit database rollback in current SAP LUW.

A - Termination/Abend
A termination message stops processing and causes a runtime error and short dump which is also viewable in tcode ST22.

X - Exit
An exit message stops processing and displays and exit button which exits session processing. Similar to typing /n into the SAP command box.


SAP giới thiệu mã hỗ trợ AI trong ngôn ngữ ABAP riêng của mình

SAP đã ra mắt một loạt tính năng mã hỗ trợ AI trong môi trường phát triển ứng dụng dựa trên đám mây của mình, đồng thời tham gia vào danh sá...