Skip to content

/AWS1/IF_MDT=>PUTFUNCTION()

About PutFunction

Creates or updates a function. A function defines reusable logic that MediaTailor executes at lifecycle hooks during ad insertion. For more information about functions, see Working with functions in the MediaTailor User Guide.

Method Signature

METHODS /AWS1/IF_MDT~PUTFUNCTION
  IMPORTING
    !IV_FUNCTIONID TYPE /AWS1/MDT__STRING OPTIONAL
    !IV_FUNCTIONTYPE TYPE /AWS1/MDTFUNCTIONTYPE OPTIONAL
    !IV_DESCRIPTION TYPE /AWS1/MDT__STRING OPTIONAL
    !IO_HTTPREQUESTCONFIGURATION TYPE REF TO /AWS1/CL_MDTHTTPREQUESTCONF OPTIONAL
    !IO_CUSTOMOUTPUTCONFIGURATION TYPE REF TO /AWS1/CL_MDTCUSTOMOUTPUTCONF OPTIONAL
    !IO_SEQUENTIALEXECUTORCONF TYPE REF TO /AWS1/CL_MDTSEQNTLEXECUTORCONF OPTIONAL
    !IT_TAGS TYPE /AWS1/CL_MDT__MAPOF__STRING_W=>TT___MAPOF__STRING OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_mdtputfuncresponse
  RAISING
    /AWS1/CX_MDTCLIENTEXC
    /AWS1/CX_MDTSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_functionid TYPE /AWS1/MDT__STRING /AWS1/MDT__STRING

The identifier of the function. The identifier must be unique within your account.

iv_functiontype TYPE /AWS1/MDTFUNCTIONTYPE /AWS1/MDTFUNCTIONTYPE

The type of the function. The function type determines what the function can do at runtime. Valid values: CUSTOM_OUTPUT evaluates expressions and produces output bindings with no external calls. HTTP_REQUEST makes an HTTP call to an external service and evaluates output expressions that can reference the response. SEQUENTIAL_EXECUTOR runs a sequence of child functions in order, passing data between steps through temporary data. For more information, see Function types and composition in the MediaTailor User Guide.

Optional arguments:

iv_description TYPE /AWS1/MDT__STRING /AWS1/MDT__STRING

A description of the function.

io_httprequestconfiguration TYPE REF TO /AWS1/CL_MDTHTTPREQUESTCONF /AWS1/CL_MDTHTTPREQUESTCONF

The configuration for an HTTP_REQUEST function. Specifies the HTTP method, URL, headers, body, timeout, and output expressions. Required when FunctionType is HTTP_REQUEST.

io_customoutputconfiguration TYPE REF TO /AWS1/CL_MDTCUSTOMOUTPUTCONF /AWS1/CL_MDTCUSTOMOUTPUTCONF

The configuration for a CUSTOM_OUTPUT function. Specifies the runtime and output expressions. Required when FunctionType is CUSTOM_OUTPUT.

io_sequentialexecutorconf TYPE REF TO /AWS1/CL_MDTSEQNTLEXECUTORCONF /AWS1/CL_MDTSEQNTLEXECUTORCONF

The configuration for a SEQUENTIAL_EXECUTOR function. Specifies the ordered list of child functions to execute, an optional output block, and a timeout. Required when FunctionType is SEQUENTIAL_EXECUTOR.

it_tags TYPE /AWS1/CL_MDT__MAPOF__STRING_W=>TT___MAPOF__STRING TT___MAPOF__STRING

The tags to assign to the function. Tags are key-value pairs that you can associate with Amazon resources to help with organization, access control, and cost tracking. For more information, see Tagging AWS Elemental MediaTailor Resources.

RETURNING

oo_output TYPE REF TO /aws1/cl_mdtputfuncresponse /AWS1/CL_MDTPUTFUNCRESPONSE

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->putfunction(
  io_customoutputconfiguration = new /aws1/cl_mdtcustomoutputconf(
    it_output = VALUE /aws1/cl_mdt__mapof__string_w=>tt___mapof__string(
      (
        VALUE /aws1/cl_mdt__mapof__string_w=>ts___mapof__string_maprow(
          key = |string|
          value = new /aws1/cl_mdt__mapof__string_w( |string| )
        )
      )
    )
    iv_runtime = |string|
  )
  io_httprequestconfiguration = new /aws1/cl_mdthttprequestconf(
    it_headers = VALUE /aws1/cl_mdt__mapof__string_w=>tt___mapof__string(
      (
        VALUE /aws1/cl_mdt__mapof__string_w=>ts___mapof__string_maprow(
          key = |string|
          value = new /aws1/cl_mdt__mapof__string_w( |string| )
        )
      )
    )
    it_output = VALUE /aws1/cl_mdt__mapof__string_w=>tt___mapof__string(
      (
        VALUE /aws1/cl_mdt__mapof__string_w=>ts___mapof__string_maprow(
          key = |string|
          value = new /aws1/cl_mdt__mapof__string_w( |string| )
        )
      )
    )
    iv_body = |string|
    iv_methodtype = |string|
    iv_reqtimeoutmilliseconds = 123
    iv_runtime = |string|
    iv_url = |string|
  )
  io_sequentialexecutorconf = new /aws1/cl_mdtseqntlexecutorconf(
    it_functionlist = VALUE /aws1/cl_mdtfunctionref=>tt___listoffunctionsref(
      (
        new /aws1/cl_mdtfunctionref(
          iv_functionid = |string|
          iv_runcondition = |string|
        )
      )
    )
    it_output = VALUE /aws1/cl_mdt__mapof__string_w=>tt___mapof__string(
      (
        VALUE /aws1/cl_mdt__mapof__string_w=>ts___mapof__string_maprow(
          key = |string|
          value = new /aws1/cl_mdt__mapof__string_w( |string| )
        )
      )
    )
    iv_runtime = |string|
    iv_timeoutmilliseconds = 123
  )
  it_tags = VALUE /aws1/cl_mdt__mapof__string_w=>tt___mapof__string(
    (
      VALUE /aws1/cl_mdt__mapof__string_w=>ts___mapof__string_maprow(
        key = |string|
        value = new /aws1/cl_mdt__mapof__string_w( |string| )
      )
    )
  )
  iv_description = |string|
  iv_functionid = |string|
  iv_functiontype = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv___string = lo_result->get_functionid( ).
  lv_functiontype = lo_result->get_functiontype( ).
  lv___string = lo_result->get_description( ).
  lo_httprequestconfiguratio = lo_result->get_httprequestconfiguration( ).
  IF lo_httprequestconfiguratio IS NOT INITIAL.
    lv_runtimetype = lo_httprequestconfiguratio->get_runtime( ).
    LOOP AT lo_httprequestconfiguratio->get_output( ) into ls_row.
      lv_key = ls_row-key.
      lo_value = ls_row-value.
      IF lo_value IS NOT INITIAL.
        lv___string = lo_value->get_value( ).
      ENDIF.
    ENDLOOP.
    lv_methodtype = lo_httprequestconfiguratio->get_methodtype( ).
    lv___integer = lo_httprequestconfiguratio->get_reqtimeoutmilliseconds( ).
    lv___string = lo_httprequestconfiguratio->get_url( ).
    lv___string = lo_httprequestconfiguratio->get_body( ).
    LOOP AT lo_httprequestconfiguratio->get_headers( ) into ls_row.
      lv_key = ls_row-key.
      lo_value = ls_row-value.
      IF lo_value IS NOT INITIAL.
        lv___string = lo_value->get_value( ).
      ENDIF.
    ENDLOOP.
  ENDIF.
  lo_customoutputconfigurati = lo_result->get_customoutputconf( ).
  IF lo_customoutputconfigurati IS NOT INITIAL.
    lv_runtimetype = lo_customoutputconfigurati->get_runtime( ).
    LOOP AT lo_customoutputconfigurati->get_output( ) into ls_row.
      lv_key = ls_row-key.
      lo_value = ls_row-value.
      IF lo_value IS NOT INITIAL.
        lv___string = lo_value->get_value( ).
      ENDIF.
    ENDLOOP.
  ENDIF.
  lo_sequentialexecutorconfi = lo_result->get_sequentialexecutorconf( ).
  IF lo_sequentialexecutorconfi IS NOT INITIAL.
    lv_runtimetype = lo_sequentialexecutorconfi->get_runtime( ).
    LOOP AT lo_sequentialexecutorconfi->get_output( ) into ls_row.
      lv_key = ls_row-key.
      lo_value = ls_row-value.
      IF lo_value IS NOT INITIAL.
        lv___string = lo_value->get_value( ).
      ENDIF.
    ENDLOOP.
    LOOP AT lo_sequentialexecutorconfi->get_functionlist( ) into lo_row_1.
      lo_row_2 = lo_row_1.
      IF lo_row_2 IS NOT INITIAL.
        lv___string = lo_row_2->get_runcondition( ).
        lv___string = lo_row_2->get_functionid( ).
      ENDIF.
    ENDLOOP.
    lv___integer = lo_sequentialexecutorconfi->get_timeoutmilliseconds( ).
  ENDIF.
  LOOP AT lo_result->get_tags( ) into ls_row.
    lv_key = ls_row-key.
    lo_value = ls_row-value.
    IF lo_value IS NOT INITIAL.
      lv___string = lo_value->get_value( ).
    ENDIF.
  ENDLOOP.
  lv___string = lo_result->get_arn( ).
ENDIF.