A value and its field-control flag work together

Some EML forms use %control to show which components are intentionally supplied. This matters because an initial value can itself be meaningful: without a field-control flag, a consumer and BO may not distinguish “set this field to initial” from “this field was not provided.”

Set flags in the derived request type

MODIFY ENTITIES OF ZR_PURCHASE_REQUEST
  ENTITY Request
  CREATE FROM VALUE #(
    %control-RequestId = if_abap_behv=>mk-on
    %control-SupplierId = if_abap_behv=>mk-on
    %control-Status = if_abap_behv=>mk-on
    ( %cid = 'new-2204'
      RequestId = 'PR-2204'
      SupplierId = 'SUP-044'
      Status = 'OPEN' ) )
  MAPPED DATA(mapped)
  FAILED DATA(failed)
  REPORTED DATA(reported).

The exact %control components come from the BO’s BDEF-derived type. The short form CREATE FIELDS ( ... ) is another way to declare a known field set. Choose one form that matches the use case; don’t copy field names or flags from another BO.

Sources

Developer practice · ABAP

Practice: create only the provided fields

Use CREATE FROM with %control flags for RequestId, SupplierId, and Status, then create the request instance.

Choose your ABAP environment

This choice changes the output pattern checked here: WRITE belongs in a classic executable report, while out->write( ) uses the supplied output reference in an ABAP Cloud class-run method. It does not switch the language version of the other code; check release and API availability in your target system.

Complete the task and include the output statement shown for your selected environment. Variable names can differ if you use them consistently. This browser checker checks structure only; it does not compile or run ABAP.

0 required structures detected · 0 checks