Skip to Content
Technical Articles
Author's profile photo Joerg Michaelis

SAP EWM MFS Receiving and Processing Telegrams

Introduction

With the built-in component SAP EWM MFS, automated material handling equipment (MHE) of warehouses can be connected to and can be conducted by SAP EWM. To achieve this, information has to be exchanged between SAP EWM and the control systems of the automated MHE. This blog provides insight into the mechanisms of receiving information and processing received information.

Telegram Receiving

As a precondition for receiving telegrams in SAP EWM MFS the TCP/IP connection between a PLC (or a sub system) and SAP EWM MFS has to be established by SAP EWM MFS.

Technically, the receipt of telegrams is done with the function module /SCWM/MFS_RECEIVE2. This function module is either called from the SAP socket layer (ABAP Push Channel) or from PCo (or another TCP/IP<->RFC-converter) on the receipt of a telegram.

We distinguish between data telegrams and acknowledgement telegrams (indicated by the field handshake in the telegram header).
A data telegram contains application data that should be processed by the communication partner.
An acknowledgement telegram is used on protocol level to indicate positive receipt of a data telegram or the refusal to accept a received data telegram.

For more information about MFS protocol please refer to the second blog in the series, SAP EWM MFS Communication [HYPERLINK TO BLOG 2].

The function module is called with these parameters: lgnum, plc, channel, ipaddress, port and telegram, where either the pair plc and channel or the pair ipaddress and port is set.

Parameter Name Typing Associated Type Optional Description
IV_LGNUM TYPE /SCWM/LGNUM X Warehouse Number
IV_PLC TYPE /SCWM/DE_MFSPLC X PLC
IV_CHANNEL TYPE /SCWM/DE_MFSCCH X Communication Channel
IV_IPADDRESS TYPE /SCWM/DE_MFS_HOST X IP address
IV_PORT TYPE ME_PORT X Port
IV_TELEGRAM TYPE /SCWM/DE_MFSTELE Telegram

Functional description of /SCWM/MFS_RECEIVE2

  • Check lgnum, plc and channel or determine plc and channel, if ipaddress and port have been passed
  • Read attributes (Customizing, Master Data) for plc and channel
  • Replace filler character with “space” in received telegram (FM /SCWM/MFS_TELE_FORMAT)
  • Move content of received telegram into the teletotal-structure (contains all fields of all used telegrams /SCWM/S_MFS_TELETOTAL) (FM /SCWM/MFS_MOVE_STR2TELETOTAL)
    • Get telegram header from PLC-customizing, get telegram type from telegram header of received telegram
      Note: If the header structure cannot be determined or the telegram structure cannot be determined by the telegram type in the telegram, an exception will be thrown and an alert entry will be written (/SAPAPO/AMON1). No telegram log will be written.
    • Move corresponding fields from received telegram into overall structure:

The%20internal%20structure%20/SCWM/S_MFS_TELETOTAL%20containing%20a%20superset%20of%20telegram%20fields%20used%20in%20project%20specific%20telegrams%20was%20introduced%20to%20enable%20a%20generic%20interface%20for%20internal%20processing

The internal structure /SCWM/S_MFS_TELETOTAL containing a superset of telegram fields used in project specific telegrams was introduced to enable a generic interface for internal processing

  • Check, whether telegram logging is activated (strongly recommended) (FM /SCWM/MFS_CHECK_LOGGING). If yes,
    • Try to get applicable warehouse task
    • Write telegram log (table /SCWM/MFSTELELOG) and commit work (FM /SCWM/MFS_TELE_LOG)
  • Now a BAdI for manipulating the content of the received telegram (teletotal-structure) is called (SCWM/EX_MFS_TELE_RCV).
    Note: Please be aware that you have to handle the PLC names of EWM objects here as mapping was not executed yet.
  • Next, telegram is checked (FM /SCWM/MFS_TELE_CHECK)
    • Sequence number is checked (if received telegram is a data telegram)
    • Telegram length, start character and end character are checked
    • If check is set on customizing data of PLC, sender and receiver will be checked
    • If an error was detected, send acknowledgement telegram with com. error determined by detected error and customizing (Extended Warehouse Management -> Material Flow System (MFS) -> Exception Handling -> Assign telegram errors to PLC errors)
      Stop telegram processing in case of certain errors detected
  • Perform mapping for telegram content (objects like CP, Resource, Bin), if set in customizing (PLC level) (FM /SCWM/MFS_TELE_MAP)
    • Call a BAdI for mapping (SCWM/EX_MFS_TELEPLC2EWMOBJ)
    • Select entries in mapping table (master data table /SCWM/MFSOBJMAP)
  • In case, a data telegram was received
    • Update channel data (received sequence number, timestamp for last receipt of a telegram)
    • Check synchronization, check, whether received telegram is a LIFE telegram
    • Call BAdI for CP determination (SCWM/EX_MFS_TELE_DET_CP)
    • Store telegram in table /SCWM/MFSTELEQ; commit work
    • Send acknowledgement telegram (FM /SCWM/MFS_SEND)
    • Initiate processing of telegram in /SCWM/MFSTELEQ by calling /SCWM/MFS_PROCESS_TELE_Q (which is done asynchronously in case /SCWM/MFS_RECEIVE2 is not called in an APC environment)
  • In case, an acknowledgement telegram was received
    • Check synchronization and update channel data accordingly
    • Check, whether com. error is set in the received acknowledgement telegram; if set, determine exception (customizing Extended Warehouse Management -> Material Flow System (MFS) -> Exception Handling -> EWM exceptions -> Define EWM exceptions for communication errors) and internal process code (customizing Extended Warehouse Management -> Cross-Process Settings -> Exception handling -> Define exception codes) and handle exception according to internal process code (FM /SCWM/MFS_ACK_EXCEPTION)
      Note: If the mapping between the value of the field comm_error in the telegram and an exception is not defined, an exception will be thrown and an alert entry will be written (/SAPAPO/AMON1).
    • If no error occurred, get telegram category and check, whether a WT is affected. If yes, update KZSUB (FM /SCWM/MFS_ASYNC_KZSUB_UPD).
      and delete telegram from /SCWM/MFSDELAY (as the PLC has confirmed to take over responsibility for the telegram by sending a positive acknowledgement telegram)
    • If no WT is affected, delete telegram from /SCWM/MFSDELAY

Standard Enhancement Possibilities in /SCWM/MFS_RECEIVE2

Receive-BAdI /SCWM/EX_MFS_TELE_RCV (method tele_rcv)

In this BAdI you can manipulate the content of the received telegram – already in the teletotal-structure. Be aware that names are PLC names as the mapping between PLC names and EWM names was not performed yet.

Sample applications:

  • Field RSRC is not filled in received telegram by the PLC partner. The field RSRC has to be filled either by using information from the fields SOURCE or DEST or from the field CP (if the PLC partner fills both resource and communication point into that field). It is crucial for the determination of the action function module that should process the telegram (Based on warehouse number, telegram type and resource type)
  • PLC handles HU type information different than EWM (container type, container width, container length and container height versus EWM HU type). Such, the field HU type is not filled in the incoming telegram.
  • If you are using trays or totes that have internal compartments, the ident on the label contains not only the HU ident but some orientation information in addition (e. g. some L and R or 1 and 2 for left and right). So, the Field HU IDENT contains both the HU ident and the orientation information. Use the BAdI to have only the HU ident in the field HU IDENT and move the orientation information into some other field.

Tele-Check-BAdI /SCWM/EX_MFS_TELE_CHECK_MAP (method tele_check_map)

In this BAdI you can

  • Change the communication error the system has detected – here called mfs_error
  • Change the exception code the system has detected
  • Decide, whether to re-start the connection of this channel
  • Accept a received sequence number (although the system would not)

Sample applications – none.

Mapping-BAdI /SCWM/EX_MFS_TELE_PLC2EWMOB (method plc2emwob)

In this BAdI you can map the PLC names of objects like communication point, resource or storage bin.

Sample applications:

  • Convert bin names
    PLC: AASXXXYYZ (aisle, side, X-coordinate, Y-coordinate and Z-coordinate)
    EWM: TTTT-AA-S-sss-ll (storage type, aisle, side, stack, level) plus logical position

CP-Determination-BAdI /SCWM/EX_MFS_TELE_DET_CP (method det_cp)

In this BAdI you can change or fill the content of the field CP (required for action function module determination).

There is a fallback implementation in class /SCWM/CL_EI_MFS_TELE_DET_CP, which depends on the telegram category (‘G’ WTCO warehouse task confirmation) of the received telegram type and uses the telegram field DEST and the communication point bin assignment (/SCWM/TMFSCP).

Sample applications:

  • Field CP (required for action function module determination) not filled in received telegram

Acknowledge-BAdI /SCWM/EX_MFS_TELE_ACK (method tele_ack)

In this BAdI you can manipulate the content of the acknowledgement telegram that you send:

Sample applications:

  • In modernization projects, sometimes dedicated telegram types have to be used for positive (“ACK”) and negative (“NAK”) acknowledgments. With this BAdI you can build such telegrams.

Com.Error-Mapping-BAdI /SCWM/EX_MFS_TELE_ERROR_MAP (method error_map)

In this BAdI you can map the received communication error to an exception.

Sample applications – none

Note: This mapping can be done by customizing as well (Table /SCWM/TMFSCERMPI)

Telegram Processing

Technically, the processing of telegrams is done with an action function module. Here you can use a function module provided by the SAP standard or you can use a custom function module.

Inbound telegrams to be processed are stored in the table /SCWM/MFSTELEQ by /SCWM/MFS_RECEIVE2. The telegram content is stored by using the overall internal telegram structure /SCWM/S_MFS_TELETOTAL. The processing of a received telegram is initiated by the function module /SCWM/MFS_PROCESS_TELE_Q. This function module is regularly called by /SCWM/MFS_RECEIVE2 on the receipt of a telegram. In addition, it can be called by /SCWM/MFS_PERIODCHK (Retry telegram processing) for telegram retries or from the warehouse management monitor manually.

The function module is called with these parameters: lgnum, plc, channel and retry.

Parameter Name Typing Associated Type Optional Description
IV_LGNUM TYPE /SCWM/LGNUM Warehouse Number
IV_PLC TYPE /SCWM/DE_MFSPLC PLC
IV_CHANNEL TYPE /SCWM/DE_MFSCCH Communication Channel
IV_RETRY TYPE /SCWM/DE_MFS_RETRY_FLG X Retry Telegram

Available action function modules:

If you create , the coding should be like that of an SAP action function module. All those function modules share a common interface as they are called dynamically by /SCWM/MFS_PROCESS_TELE_Q.

Functional description of /SCWM/MFS_PROCESS_TELE_Q

  • Check number of processes already working on plc and channel in /SCWM/MFSTELEQ and number of allowed processes (customizing Extended Warehouse Management -> Material Flow System (MFS) -> Master Data -> Communication Channel -> Define Communication Channel)
  • Read records from /SCWM/MFSTELEQ sorted by timestamp
  • Determine and lock next record to be processed
    Note: Even if you have set up more than one work process to process received telegrams of a channel, telegrams for the same communication point or for the same resource will not be processed in parallel. This re-builds reality, where objects cannot jump over another at one communication point or resource.
  • Determine function module for telegram processing using lgnum, plc, cp, rsrc, dest and teletype (plus function module for additional asynchronous processing)

  • The function module is then executed; according to the result the record in /SCWM/MFSTELEQ is updated or deleted
  • If a function module for asynchronous processing was determine, this one is called then

Standard Enhancement Possibilities in /SCWM/MFS_PROCESS_TELE_Q

There are no BAdIs available. Launching telegram processing with the rules for parallel and sequential processing shall not be modified.
Content of telegrams can be manipulated by using the BAdIs called in /SCWM/MFS_RECEIVE2. The processing of telegrams can be influenced by defining the processing function module via customizing, using BAdIs of the MFS standard action function modules or using your own customer specific function modules.

In case you missed it, you can find the introduction to the entire blog series here.

To make sure you are notified of updates in this blog series, please follow our assigned tag, SAP Extended Warehouse Management. Once published, the links will appear below:

For the other topics in the MFS series, please visit one of the following blog posts:

For more information about SAP Extended Warehouse Management, please follow us on social media, our YouTube channel or our community pages:

SAP EWM Community:

https://www.sap.com/community/topics/extended-warehouse-management.html

SAP Digital Supply Chain Channel:

https://www.youtube.com/channel/UCELmE2CEAkcwqpBLnuZHufA

EWM LinkedIn Community:

https://www.linkedin.com/groups/1952257/

For a complete list of Q&A from the EWM community, please access this link:
https://answers.sap.com/tags/01200615320800000705

In case you do not find your specific question there, feel free to post your question via the following form:
https://answers.sap.com/questions/ask.html?primaryTagId=01200615320800000705

 

 

 

Assigned tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Vinod Dongre
      Vinod Dongre

      Hi Joerg,

      Thank for this great blog.

      We are in the process of setting up the similar setup. Currently PLC is not able to communicate with EWM.

      What is the IV_PORT in function module "/SCWM/MFS_RECEIVE2" to be provided? Is it regular SAPGUI 3200 or ICM Port for HTTP/S? Or do we have to enable TCP Socket Service?

      I appreciate your valuable response on this.

      Thanks,

      Vinod