Overview
The Material Master plugin is in the SAP Targets group on the left panel of the Designer. Use it as a target to create new materials in SAP or to update existing ones.
It is a target plugin: map fields from any source (Excel, database, SAP table, Python, and so on) to it. For each source record, the plugin creates or changes one material with the standard SAP BAPI BAPI_MATERIAL_SAVEREPLICA. It can also assign classes and characteristic values to the material with BAPI_OBJCL_CHANGE, and it can let SAP assign the material number.
The plugin works with one material type at a time. You select the material type after you connect, and the plugin builds its fields for that type.
Connecting to SAP
Password Manager
To configure the plugin:
- In SAP System, select an entry from the Password Manager.
- In Server Type, select one of two server types:
- Application Server
- Message Server
- Select the operation type and the material number option (see Operation settings).
- Click Connect.
- Select the material type to build the plugin structure.
Password manager entry should have the following keys in its Options:
App Server Host, Client, Language, SAP Router, System Number, System ID
All of those fields can be used from SAP System options template
Application Server
To configure the plugin fill the following fields:
- Server Host
- System Number
- SAPRouter - optional
- User
- Password
- Client
- Language
After that:
- Select the operation type and the material number option (see Operation settings).
- Click Connect.
- Select the material type to build the plugin structure.
Message Server
To configure the plugin fill the following fields:
- SID
- Server Host
- Logon Group
- Server Service - optional
- SAPRouter - optional
- User
- Password
- Client
- Language
After that:
- Select the operation type and the material number option (see Operation settings).
- Click Connect.
- Select the material type to build the plugin structure.
When you click Connect, the plugin reads the list of material types and their descriptions (tables T134 and T134T, in the logon language) and checks whether the function module for opening materials from the log is available (see Log). When you select a material type, it reads the interface of BAPI_MATERIAL_SAVEREPLICA and builds the fields. The description of the plugin on the canvas shows the selected material type.
Operation settings
| Field | Description |
|---|---|
| Operation type | Create New Material creates new materials. Update Existing Material changes existing materials. |
| Material number | Use Mat. Number from Source takes the material number from a mapped field. Generate a new Material Number lets SAP assign an internal number (BAPI_STDMATERIAL_GETINTNUMBER) when you create materials. |
| Material type | Appears after you connect. Select the material type; the plugin structure is built for it. |
Before a run, the plugin checks the settings and stops with a message if something is missing:
- The plugin must be connected to SAP, and a material type must be selected.
- With Create New Material, the industry sector field (
IND_SECTOR) and at least one view field (a*_VIEWfield, for exampleBASIC_VIEW) must be selected in Head data. - With Create New Material and Generate a new Material Number, the plugin checks that SAP can assign an internal number for the selected material type and shows the SAP message if it can't.
Settings
Expand Settings in the connection parameters to change the SAP connection pool settings:
| Field | Description |
|---|---|
| IDLE_TIMEOUT | Time after which an idle connection is closed. |
| POOL_SIZE | Number of connections kept open in the pool. |
| MAX_POOL_SIZE | Maximum number of connections the plugin can open at the same time. |
Click Notes to add your own notes to the plugin.
How to use
- Add the Material Master plugin to the canvas.
- Open the Connection Parameters.
- Fill in the SAP connection parameters, user name and password.
- Select the operation with the material.
- Click Connect.
- The line under the connection button turns green when the connection to SAP is established.
- Select the material type.
- Map the import fields to a source (required) and the export fields to a target (optional).
Import and export fields
The Material Master plugin consists of three main parts, see the image below:
- Input head data parameters (1)
- Input object parameters (2)
- Output (return) parameters (3)
Select fields and objects
- Open the Fields section.
- Select the fields and objects you need on the tabs. Click Select All to select everything on a tab.
| Tab | Content |
|---|---|
| Head data | Header fields of the material, for example the material number. |
| Objects | Material data views and tables, for example client-specific, plant-specific, storage location, valuation, warehouse, sales, storage type, forecast, planning and PRT data, material descriptions, units of measure, EANs, long texts, tax classifications, the extension structures, Additional Parameters, Classifications and customer-defined fields for MARA, MARC, MARD, MBEW, MLGN, MLGT and MVKE. |
| Return Data | Export fields: MATERIAL and MATL_TYPE of the processed material, and RETURN_TYPE and RETURN_MESSAGE with the SAP message. Map them to a target, for example to write generated material numbers back to Excel. |
For the data views, VeloXm fills the matching update-information ("X") structures for you.
The drop-down list shows the description of each field.
Head data
The Head data tab contains the fields of the material header (BAPIE1MATHEADER, without the material type, which comes from your selection) and three control parameters of the BAPI:
| Field | Description |
|---|---|
MATERIAL |
Material number. Mandatory (M); Add Leading Zeros is switched on by default. With Generate a new Material Number, the number assigned by SAP is used instead. |
NOAPPLLOG |
Do not write an application log. Mandatory; set by default to X with Ignore Source. |
NOCHANGEDOC |
Do not write change documents. |
INPFLDCHECK |
Response if fields are inactive. |
Objects
Data views such as client, plant, storage location, valuation, warehouse number, sales, storage type, forecast and planning data are single structures: each source record fills one of each. To load several plants or sales organizations, use one source record per plant or sales organization.
Tables such as material descriptions, units of measure, EANs, long texts, tax classifications, PRT data and the extension tables take all rows that the mapped source returns. Click Add Row on a table object to add another row block with its own mapping, for example a second description language. Material description rows without MATL_DESC are skipped.
The plugin adds the material number to every structure and table, so you don't map MATERIAL in the objects.
Additional Parameters contains optional BAPI flags: FLAG_CAD_CALL (call from CAD system), NO_ROLLBACK_WORK (override rollback if an error occurs) and FLAG_ONLINE (no ALE field selection). A flag is passed only if BAPI_MATERIAL_SAVEREPLICA in your SAP system has that parameter.
Long texts
For long texts, map at least LANGU, TEXT_ID and TEXT_LINE. The plugin fills the text object and text name from the text ID:
TEXT_ID |
Text name built by the plugin |
|---|---|
GRUN, BEST, IVER |
Material number (object MATERIAL). |
LTXT |
Material number and plant from the plant data (object MDTXT). |
0001 |
Material number, sales organization and distribution channel from the sales data (object MVKE). |
Line breaks in the source text start new lines. Lines longer than 132 characters are split into several lines, and trailing spaces are removed.
Customer-defined fields
The objects MARA Customer-Defined Fields to MVKE Customer-Defined Fields show the fields of the extension structures BAPI_TE_MARA, BAPI_TE_MARC, BAPI_TE_MARD, BAPI_TE_MBEW, BAPI_TE_MLGN, BAPI_TE_MLGT and BAPI_TE_MVKE in your system. Map the fields like any other field. The plugin packs the values into the EXTENSIONIN and EXTENSIONINX tables and sets the update flags for you. The key fields of these structures (for example PLANT, STGE_LOC, SALES_ORG and DISTR_CHAN) are mandatory.
The customer-defined fields must already exist in the BAPI_TE_* and BAPI_TE_*X structures and be handled by the BAPI extension in your SAP system. The plugin only fills these structures.
Classification
For Classifications, click Add Class and select the class. Then select the characteristics to fill. Hover over a classification item to see a tooltip with its class or characteristic details, for example whether multiple values or interval values are allowed. For numeric characteristics, select Use As String to send the value as text instead of a number. Classification is saved with BAPI_OBJCL_CHANGE.
The classification object also has the optional fields STATUS (classification status), STANDARDCLASS (standard class), CHANGENUMBER (change number) and KEYDATE (date), which are passed to BAPI_OBJCL_CHANGE.
- Characteristic values are sent according to the data type of the characteristic: character values, numeric and time values, date values, or currency values.
- For a value with a defined value list, you can give either the value or its description; the plugin sends the value.
- For a single-value characteristic, only the first source value is used. A multiple-value characteristic takes all values the source returns.
The class details and characteristics are read from SAP with BAPI_CLASS_GET_CHARACTERISTICS and BAPI_CLASS_GETDETAIL.
Mapping
To use this plugin, create a mapping between a source and the Material Master plugin. The source can be the Excel plugin, a database, the SAP Read Table plugin, the Python plugin and so on.
For example, if the source is the Excel plugin, map the fields between the Excel plugin and the Material Master plugin with drag and drop, as shown below:
Field options
Open the details of an import field to set how its value is converted before it is sent to SAP:
| Option | Description |
|---|---|
| Default Value | A value to use instead of, or in addition to, the source value. Choose No Default Value., Ignore Source. (always use the default value) or Only If Source Empty. (use the default value only when the source value is empty). A D marker shows that a default value is set. |
| Convert To Upper Case | Converts the value to upper case. Marked with U. |
| Add Leading Zeros | Pads the value with leading zeros to the field length. Marked with Z. |
Mandatory fields are marked with M. Export fields have a Remove Zeros option that removes leading zeros from the returned value.
Run-time behavior
- The plugin saves the material with
BAPI_MATERIAL_SAVEREPLICAand the classification withBAPI_OBJCL_CHANGE. Changes are committed withBAPI_TRANSACTION_COMMIT, or rolled back withBAPI_TRANSACTION_ROLLBACKif the classification returns an error. If the material BAPI itself returns an error, nothing is committed (see SAP calls for each record). - Simulation mode is supported: the material BAPI runs in test mode (
TESTRUN) and all changes are rolled back. - The migration log shows a Material Key column and a Material Description column. Click the Material Key to open the material in SAP. This requires SAP GUI on your computer and the function module
/DSCSAG/MAT_RFC_DISPLAYin the SAP system; VeloXm checks that the function module exists when you connect.
SAP calls for each record
For each source record, the plugin calls SAP in this order:
BAPI_STDMATERIAL_GETINTNUMBER: only with Create New Material and Generate a new Material Number. SAP assigns one internal number for the material type and the industry sector (IND_SECTOR) from the head data. If no material number is available after this step (or, with Use Mat. Number from Source, if the source has no number), the record gets the error MM Number not found in source. and nothing is sent to SAP.BAPI_MATERIAL_SAVEREPLICA: creates or changes the material with the head data, all filled data views with their update-information ("X") structures, and the tables.BAPI_OBJCL_CHANGE: once for each class that has characteristic values, with object tableMARAand the material number as the object key. This step runs only if step 2 returned no error.BAPI_TRANSACTION_COMMIT(with wait) if steps 2 and 3 returned no error, orBAPI_TRANSACTION_ROLLBACKif the classification returned an error or the run is a simulation.
If BAPI_MATERIAL_SAVEREPLICA returns an error, the classification step is skipped and nothing is committed. All calls of one record run in the same SAP session.
Simulation mode
In simulation mode, BAPI_MATERIAL_SAVEREPLICA runs with TESTRUN = X, the classification is still checked with BAPI_OBJCL_CHANGE, and the plugin then calls BAPI_TRANSACTION_ROLLBACK instead of the commit. The log shows the messages SAP would return.
With Generate a new Material Number, the number is drawn from the SAP number range in simulation mode too, and also once during the check before the run. Numbers drawn this way are not used for a material, so gaps in the number range are possible.
Log
For each record, the log shows the Material Key (the material number) and the Material Description (the first material description of the record). The technical log contains the plugin version, the operation type, the material number type, whether the run is a simulation, and the import and export parameters of each SAP call.
If SAP returns errors, the log row is marked as an error and lists every error message, with the BAPI parameter if SAP names one. The RETURN_TYPE export field is then E and RETURN_MESSAGE contains the error messages; for a successful record they are S and empty.
Prerequisites
- An SAP user with RFC access and authorization to create or change materials of the selected material type and plant, sales and warehouse data you load, to change classifications, and to read tables
T134andT134TwithRFC_READ_TABLE. - For Generate a new Material Number: an internal number range for the material type.
- For opening materials from the log: SAP GUI on your computer and the function module
/DSCSAG/MAT_RFC_DISPLAYin the SAP system. This function module is not part of standard SAP; without it, the rest of the plugin works normally.
Our experienced team of experts has the capability to develop customized solutions to fit your individual needs.
We understand that each situation is unique and thus can provide services tailored to those requirements. Our goal is to provide the best possible service and to ensure the most successful outcome for the project.
Please contact us for more information on how we can help you.