# Image Capture

This section details the development aspects, including key classes, function groups, and methods used to manage image storage, retrieval, and handling. The guide is intended for SAP consultants and IT professionals responsible for implementing and maintaining image capture functionality.

## Prerequisites

### Configuration requirements

* PreBilt EWM Framework must be installed and configured.
* SAP Image Repository or External Web Link for Image Storage.
* GOS or DMS for Attachment services (if attatching to business objects)

### Technical prerequisites for Image Capture

* Device camera access:
  * Mobile devices must support camera functionality.
* Authorisation requirements:
  * Users must have the necessary SAP authorizations (/TCTM/\*) to execute transactions and access image capture functionality.
* A Category/Document Area/Content Repository must be maintained.\
  In transaction *SPRO* – `Cross-Application Components > Document management > general data > settings for storage systems > maintain storage category`\
  **Maintain category**\
  Example: SDM\_DEV\
  **Maintain Document Area**\
  Example: DMS (Document Management System)\
  **Maintain Content Repository**\
  Example: ZBTPDMSDEV (BTP DMS repository)
* Content Repository information.\
  **Maintain Content Repository**\
  Example: ZBTPDMSDEV\
  **Maintain Document Area**\
  Example: DMS (Document Management System)\
  **Maintain Storage Type**\
  Example: CMIS Content Server\
  **Maintain Version**\
  Example: 0011\
  **Maintain Description**\
  Example: BTP DMS repository

### Implementation considerations

* Integration with SAP standard transactions:
  * Image capture and display must be configured within relevant warehouse processes such as picking, putaway, receiving, and inventory counting.
* Customisation and deployment:
  * Additional effort may be required to configure the image repository and authentication settings.

## Functional overview

Image Capture and Display functionality within PreBilt for EWM™ provides the ability to store, retrieve, and present images for various logistical processes. This capability enhances operational efficiency by enabling warehouse personnel to capture images directly from mobile devices, which are then stored in SAP or external repositories for retrieval as required.

### ABAP Class Configuration & Configuration Transactions

#### /TCTM/ESV\_IMAGE\_CFG - TCTM: EWM Image Service Config

<figure><img src="/files/gj1xvrIkfRiDDtjJAysr" alt=""><figcaption></figcaption></figure>

Image retrieval and storage will vary from customer to customer. For example images can be stored in the MIME repository, in attachment services such as GOS or DMS or in a third-party system or web repository.

For this reason, the image display/capture framework provides a configurable ABAP plugin layer to cater for any requirements. To add a configuration follow these steps:

1. **Add Image Type**

This is the reference for the scenario being added and is used in the extra element configuration when adding the image display/capture to the EWM RF screen step.

2. **Add Image Service Type Implementation Class**

Create a sub class of abstract class /TCTM/EWM\_SRV\_IMAGE\_TYPE\_ABSTR and implement the required methods. This class is used to parse the image metadata from the HTTP call from the frontend. Refer to sample class /TCTM/EWM\_SRV\_IMAGE\_TYPE\_PROD for implementation details.

3. **Add Image Service Store Implementation Class**

Create a sub class of abstract class /TCTM/EWM\_SRV\_IMAGE\_STORE\_ABST and implement the GET\_IMAGE and STORE\_IMAGE as per requirements. Refer to sample class /TCTM/EWM\_SRV\_IMAGE\_STORE\_MIME for implementation details.

4. **Add MIME Not Available Image Path (Optional)**

This can be used to load a placeholder image from the MIME repository when an image is not found.

### Image capture/storage

The PreBilt for EWM™ Framework supports standard image capture, enabling users to take and upload images directly from their device. This process is initiated within the application, where users can activate the device camera, capture the necessary image, and optionally link it to a relevant business object in SAP. Once captured, the image is processed and stored according to predefined configurations.

Images can be stored in one of the following locations:

* SAP MIME Repository
* A predefined external storage location
* A cloud-based content management system

Image storage and retrieval are handled via the ICF service IMAGE under the TCT\_EWM node.

To enable image display or capture functionality, specific extra elements must be configured:

* "IMAGE" for Image Display
* "IMG\_DISCAP" for Image Display & Capture

{% hint style="info" %}
**Note**

The "UPLOAD\_TOAST" parameter is required only for the Image Display & Capture option.
{% endhint %}

The URL for storing or retrieving images is defined in the extra element parameters within the logical transaction configuration. This URL serves as the base repository path, for example: <https://sapserver.com/tctm\\_ewm/image/(image> class type)

#### How image capture and storage works

When a user captures an image through the PreBilt application, the system invokes the capturePicture function from frontend module ImageCaptureControl.js, which accesses the device camera and captures an image. The captured image is then uploaded to SAP via an POST request to the configured upload endpoint.

On the backend, the ABAP method, if\_http\_extension\~handle\_request, is the entry point for handling HTTP requests to the EWM image service

The method /TCTM/EWM\_SRV\_IMAGE\_TYPE\_PROD->parse\_data\_store processes the incoming request. It extracts MATNR and UOM from the request, formats the filename as MATNR\_UOM, and prepares metadata for storage. The system then passes the processed data to the storage class /TCTM/EWM\_SRV\_IMAGE\_STORE\_MIME->store\_image, which converts the image to an XSTRING format and writes it into SAP’s MIME Repository. This ensures each image is uniquely identified and can be retrieved when required.

### Forced capture

Forced Image Capture is a configurable enforcement mechanism that mandates image capture before a business process can proceed, this is an additional parameter.

When enabled, the system prompts the user to capture an image before proceeding with the next step. The transaction cannot be completed unless an image is provided. This is managed through configuration settings under the Extra Elements node within transaction /TCTM/EWM\_CFG

Extra Element Parameter Key = FORCE\_CAPTURE = X

<figure><img src="/files/cKTtmsLpsnMwFfyUvmtZ" alt=""><figcaption></figcaption></figure>

This is useful for scenarios such as reporting proof of delivery, damages, or quality checks, where image evidence is mandatory.

#### How forced capture works

When a product is inputted or scanned, the system attempts to retrieve its image. The ImageDisplayControl.js module sends a request to the backend to check for an existing image.

This request queries the MIME repository using the parse\_data\_retrieve method within class /TCTM/EWM\_SRV\_IMAGE\_TYPE\_PROD. Within this method, the system calls lo\_mr\_api->get, which searches for an image based on the MATNR (material number) and UOM (unit of measure) which is extracted from the request. If an image is found, it is sent to the frontend and displayed.

If no image is found and *elementDefinition.elementProperties.forceCapture* is set to true in ImageCaptureControl.js, the system triggers a forced capture prompt.

The FORCE\_CAPTURE value is received from the backend which can be seen inside the EXTRA\_ELEMENTS within the network response preview.

<figure><img src="/files/WRcRUrQ4EGNv1alszE4B" alt=""><figcaption></figcaption></figure>

The application then prevents the user from proceeding until an image is captured.

This ensures images are only captured when necessary, optimizing efficiency while enforcing mandatory image requirements when needed.

### Image display and retrieval

The Image Display feature enables users to retrieve and view stored images in real-time an essential capability for scenarios that require visual verification or cross-referencing, such as confirming the correct product during picking operations.

Similar to the image capture functionality, the image retrieval process is designed with flexibility in mind. Images can be stored in a variety of locations, including:

* A predefined SAP repository
* A configured external storage location
* A cloud-based content management system

The image display framework leverages ICF services and predefined URL structures to dynamically fetch and render images. Retrieval is based on a parameterized logic, using consistent naming conventions (e.g., MATERIAL\_UOM.png for material-specific images).

When an image needs to be displayed during a logical transaction, the frontend sends a request to the backend, passing the parameterised values. The process begins with the `retrieve_image` method in IF\_HTTP\_EXTENSION\~HANDLE\_REQUEST, which forwards the request to /TCTM/EWM\_SRV\_IMAGE\_TYPE\_PROD->parse\_data\_retrieve.

This method constructs a list of filenames using the provided parameters such as MATNR\_UOM, or simply MATNR. These filenames are then handed off to /TCTM/EWM\_SRV\_IMAGE\_STORE\_MIME->get image, which prefixes a configured base path and cycles through the list, attempting to find a matching image in the SAP MIME repository via `cl_mime_repository_api->get()`.

If a matching image is found, it’s returned to the frontend. If no image is found, the system attempts to retrieve a default fallback image using `get_not_available_image`. If no image can be retrieved at all, the system raises an HTTP error.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.theconfigteam.com/prebilt-ewm/configuration-guide/configuring-prebilt-features/image-capture.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
