Skip to content

/AWS1/IF_APC=>UPDATEEXPERIMENTDEFINITION()

About UpdateExperimentDefinition

Updates an experiment definition. You can update treatments, the control, audience rules, and other properties. You cannot update an experiment definition while an experiment run is active.

Method Signature

METHODS /AWS1/IF_APC~UPDATEEXPERIMENTDEFINITION
  IMPORTING
    !IV_APPLICATIONIDENTIFIER TYPE /AWS1/APCIDENTIFIER OPTIONAL
    !IV_EXPERIMENTDEFINITIONID TYPE /AWS1/APCIDENTIFIER OPTIONAL
    !IT_TREATMENTS TYPE /AWS1/CL_APCTREATMENTINPUT=>TT_TREATMENTINPUTLIST OPTIONAL
    !IO_CONTROL TYPE REF TO /AWS1/CL_APCTREATMENTINPUT OPTIONAL
    !IV_HYPOTHESIS TYPE /AWS1/APCDESCRIPTION OPTIONAL
    !IV_AUDIENCERULE TYPE /AWS1/APCRULE OPTIONAL
    !IV_AUDIENCEDESCRIPTION TYPE /AWS1/APCDESCRIPTION OPTIONAL
    !IV_LAUNCHCRITERIA TYPE /AWS1/APCDESCRIPTION OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_apcexperimentdefn
  RAISING
    /AWS1/CX_APCBADREQUESTEX
    /AWS1/CX_APCCONFLICTEXCEPTION
    /AWS1/CX_APCINTERNALSERVEREX
    /AWS1/CX_APCRESOURCENOTFOUNDEX
    /AWS1/CX_APCCLIENTEXC
    /AWS1/CX_APCSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_applicationidentifier TYPE /AWS1/APCIDENTIFIER /AWS1/APCIDENTIFIER

The application ID or name.

iv_experimentdefinitionid TYPE /AWS1/APCIDENTIFIER /AWS1/APCIDENTIFIER

The experiment definition ID or name.

Optional arguments:

it_treatments TYPE /AWS1/CL_APCTREATMENTINPUT=>TT_TREATMENTINPUTLIST TT_TREATMENTINPUTLIST

An updated list of treatments.

io_control TYPE REF TO /AWS1/CL_APCTREATMENTINPUT /AWS1/CL_APCTREATMENTINPUT

An updated control treatment.

iv_hypothesis TYPE /AWS1/APCDESCRIPTION /AWS1/APCDESCRIPTION

An updated hypothesis.

iv_audiencerule TYPE /AWS1/APCRULE /AWS1/APCRULE

An updated audience rule.

iv_audiencedescription TYPE /AWS1/APCDESCRIPTION /AWS1/APCDESCRIPTION

An updated audience description.

iv_launchcriteria TYPE /AWS1/APCDESCRIPTION /AWS1/APCDESCRIPTION

Updated launch criteria.

RETURNING

oo_output TYPE REF TO /aws1/cl_apcexperimentdefn /AWS1/CL_APCEXPERIMENTDEFN

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->updateexperimentdefinition(
  io_control = new /aws1/cl_apctreatmentinput(
    io_flagvalue = new /aws1/cl_apcflagvalue(
      it_attributevalues = VALUE /aws1/cl_apcattributevalue=>tt_attributevaluemap(
        (
          VALUE /aws1/cl_apcattributevalue=>ts_attributevaluemap_maprow(
            key = |string|
            value = new /aws1/cl_apcattributevalue(
              it_numberarray = VALUE /aws1/cl_apcnumberlist_w=>tt_numberlist(
                ( new /aws1/cl_apcnumberlist_w( |0.1| ) )
              )
              it_stringarray = VALUE /aws1/cl_apcstringlist_w=>tt_stringlist(
                ( new /aws1/cl_apcstringlist_w( |string| ) )
              )
              iv_booleanvalue = ABAP_TRUE
              iv_numbervalue = '0.1'
              iv_stringvalue = |string|
            )
          )
        )
      )
      iv_enabled = ABAP_TRUE
    )
    iv_description = |string|
    iv_weight = '0.1'
  )
  it_treatments = VALUE /aws1/cl_apctreatmentinput=>tt_treatmentinputlist(
    (
      new /aws1/cl_apctreatmentinput(
        io_flagvalue = new /aws1/cl_apcflagvalue(
          it_attributevalues = VALUE /aws1/cl_apcattributevalue=>tt_attributevaluemap(
            (
              VALUE /aws1/cl_apcattributevalue=>ts_attributevaluemap_maprow(
                key = |string|
                value = new /aws1/cl_apcattributevalue(
                  it_numberarray = VALUE /aws1/cl_apcnumberlist_w=>tt_numberlist(
                    ( new /aws1/cl_apcnumberlist_w( |0.1| ) )
                  )
                  it_stringarray = VALUE /aws1/cl_apcstringlist_w=>tt_stringlist(
                    ( new /aws1/cl_apcstringlist_w( |string| ) )
                  )
                  iv_booleanvalue = ABAP_TRUE
                  iv_numbervalue = '0.1'
                  iv_stringvalue = |string|
                )
              )
            )
          )
          iv_enabled = ABAP_TRUE
        )
        iv_description = |string|
        iv_weight = '0.1'
      )
    )
  )
  iv_applicationidentifier = |string|
  iv_audiencedescription = |string|
  iv_audiencerule = |string|
  iv_experimentdefinitionid = |string|
  iv_hypothesis = |string|
  iv_launchcriteria = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_id = lo_result->get_applicationid( ).
  lv_id = lo_result->get_id( ).
  lv_name = lo_result->get_name( ).
  lv_description = lo_result->get_hypothesis( ).
  lv_experimentdefinitionsta = lo_result->get_status( ).
  lv_id = lo_result->get_configurationprofileid( ).
  lv_id = lo_result->get_environmentid( ).
  lv_flagkey = lo_result->get_flagkey( ).
  lv_rule = lo_result->get_audiencerule( ).
  lv_description = lo_result->get_audiencedescription( ).
  lv_description = lo_result->get_launchcriteria( ).
  LOOP AT lo_result->get_treatments( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_treatmentkey = lo_row_1->get_key( ).
      lv_weight = lo_row_1->get_weight( ).
      lv_description = lo_row_1->get_description( ).
      lo_flagvalue = lo_row_1->get_flagvalue( ).
      IF lo_flagvalue IS NOT INITIAL.
        lv_boolean = lo_flagvalue->get_enabled( ).
        LOOP AT lo_flagvalue->get_attributevalues( ) into ls_row_2.
          lv_key = ls_row_2-key.
          lo_value = ls_row_2-value.
          IF lo_value IS NOT INITIAL.
            lv_attributestring = lo_value->get_stringvalue( ).
            lv_double = lo_value->get_numbervalue( ).
            lv_boolean = lo_value->get_booleanvalue( ).
            LOOP AT lo_value->get_stringarray( ) into lo_row_3.
              lo_row_4 = lo_row_3.
              IF lo_row_4 IS NOT INITIAL.
                lv_attributestring = lo_row_4->get_value( ).
              ENDIF.
            ENDLOOP.
            LOOP AT lo_value->get_numberarray( ) into lo_row_5.
              lo_row_6 = lo_row_5.
              IF lo_row_6 IS NOT INITIAL.
                lv_double = lo_row_6->get_value( ).
              ENDIF.
            ENDLOOP.
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDIF.
  ENDLOOP.
  lo_treatment = lo_result->get_control( ).
  IF lo_treatment IS NOT INITIAL.
    lv_treatmentkey = lo_treatment->get_key( ).
    lv_weight = lo_treatment->get_weight( ).
    lv_description = lo_treatment->get_description( ).
    lo_flagvalue = lo_treatment->get_flagvalue( ).
    IF lo_flagvalue IS NOT INITIAL.
      lv_boolean = lo_flagvalue->get_enabled( ).
      LOOP AT lo_flagvalue->get_attributevalues( ) into ls_row_2.
        lv_key = ls_row_2-key.
        lo_value = ls_row_2-value.
        IF lo_value IS NOT INITIAL.
          lv_attributestring = lo_value->get_stringvalue( ).
          lv_double = lo_value->get_numbervalue( ).
          lv_boolean = lo_value->get_booleanvalue( ).
          LOOP AT lo_value->get_stringarray( ) into lo_row_3.
            lo_row_4 = lo_row_3.
            IF lo_row_4 IS NOT INITIAL.
              lv_attributestring = lo_row_4->get_value( ).
            ENDIF.
          ENDLOOP.
          LOOP AT lo_value->get_numberarray( ) into lo_row_5.
            lo_row_6 = lo_row_5.
            IF lo_row_6 IS NOT INITIAL.
              lv_double = lo_row_6->get_value( ).
            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDIF.
  lv_iso8601datetime = lo_result->get_createdat( ).
  lv_iso8601datetime = lo_result->get_updatedat( ).
  lv_kmskeyidentifier = lo_result->get_kmskeyidentifier( ).
ENDIF.

To update an experiment definition

The following UpdateExperimentDefinition example updates the hypothesis and audience rule of an experiment definition.

DATA(lo_result) = lo_client->updateexperimentdefinition(
  iv_applicationidentifier = |339ohji|
  iv_audiencerule = |(eq $country "US")|
  iv_experimentdefinitionid = |bsxyd7k|
  iv_hypothesis = |Enabling the feature will increase conversion by 10%|
).