Skip to content

/AWS1/IF_MPI=>LISTPURCHASEOPTIONS()

About ListPurchaseOptions

Returns the purchase options (offers and offer sets) available to the buyer. You can filter results by product, seller, purchase option type, visibility scope, and availability status.

You must include at least one of the following filters in the request: a PRODUCT_ID filter to specify the product for which to retrieve purchase options, or a VISIBILITY_SCOPE filter to retrieve purchase options by visibility.

Method Signature

METHODS /AWS1/IF_MPI~LISTPURCHASEOPTIONS
  IMPORTING
    !IT_FILTERS TYPE /AWS1/CL_MPIPRCHSEOPTIONFILTER=>TT_PURCHASEOPTIONFILTERLIST OPTIONAL
    !IV_MAXRESULTS TYPE /AWS1/MPIMAXRESULTS OPTIONAL
    !IV_NEXTTOKEN TYPE /AWS1/MPINEXTTOKEN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_mpilistprchseoptsout
  RAISING
    /AWS1/CX_MPIACCESSDENIEDEX
    /AWS1/CX_MPIINTERNALSERVEREX
    /AWS1/CX_MPITHROTTLINGEX
    /AWS1/CX_MPIVLDTNEXCEPTION
    /AWS1/CX_MPICLIENTEXC
    /AWS1/CX_MPISERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Optional arguments:

it_filters TYPE /AWS1/CL_MPIPRCHSEOPTIONFILTER=>TT_PURCHASEOPTIONFILTERLIST TT_PURCHASEOPTIONFILTERLIST

Filters to narrow the results. Multiple filters are combined with AND logic. Multiple values within the same filter are combined with OR logic.

iv_maxresults TYPE /AWS1/MPIMAXRESULTS /AWS1/MPIMAXRESULTS

The maximum number of results that are returned per call. You can use nextToken to get more results.

iv_nexttoken TYPE /AWS1/MPINEXTTOKEN /AWS1/MPINEXTTOKEN

If nextToken is returned, there are more results available. Make the call again using the returned token to retrieve the next page.

RETURNING

oo_output TYPE REF TO /aws1/cl_mpilistprchseoptsout /AWS1/CL_MPILISTPRCHSEOPTSOUT

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->listpurchaseoptions(
  it_filters = VALUE /aws1/cl_mpiprchseoptionfilter=>tt_purchaseoptionfilterlist(
    (
      new /aws1/cl_mpiprchseoptionfilter(
        it_filtervalues = VALUE /aws1/cl_mpipuroptfltvallist_w=>tt_prchseoptionfiltervaluelist(
          ( new /aws1/cl_mpipuroptfltvallist_w( |string| ) )
        )
        iv_filtertype = |string|
      )
    )
  )
  iv_maxresults = 123
  iv_nexttoken = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_purchaseoptions( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_nonemptystring = lo_row_1->get_purchaseoptionid( ).
      lv_catalog = lo_row_1->get_catalog( ).
      lv_purchaseoptiontype = lo_row_1->get_purchaseoptiontype( ).
      lv_nonemptystring = lo_row_1->get_purchaseoptionname( ).
      lv_timestamp = lo_row_1->get_availablefromtime( ).
      lv_timestamp = lo_row_1->get_expirationtime( ).
      lo_sellerinformation = lo_row_1->get_sellerofrecord( ).
      IF lo_sellerinformation IS NOT INITIAL.
        lv_sellerprofileid = lo_sellerinformation->get_sellerprofileid( ).
        lv_nonemptystring = lo_sellerinformation->get_displayname( ).
      ENDIF.
      LOOP AT lo_row_1->get_badges( ) into lo_row_2.
        lo_row_3 = lo_row_2.
        IF lo_row_3 IS NOT INITIAL.
          lv_nonemptystring = lo_row_3->get_displayname( ).
          lv_purchaseoptionbadgetype = lo_row_3->get_badgetype( ).
        ENDIF.
      ENDLOOP.
      LOOP AT lo_row_1->get_associatedentities( ) into lo_row_4.
        lo_row_5 = lo_row_4.
        IF lo_row_5 IS NOT INITIAL.
          lo_productinformation = lo_row_5->get_product( ).
          IF lo_productinformation IS NOT INITIAL.
            lv_productid = lo_productinformation->get_productid( ).
            lv_nonemptystring = lo_productinformation->get_productname( ).
            lo_sellerinformation = lo_productinformation->get_manufacturer( ).
            IF lo_sellerinformation IS NOT INITIAL.
              lv_sellerprofileid = lo_sellerinformation->get_sellerprofileid( ).
              lv_nonemptystring = lo_sellerinformation->get_displayname( ).
            ENDIF.
          ENDIF.
          lo_offerinformation = lo_row_5->get_offer( ).
          IF lo_offerinformation IS NOT INITIAL.
            lv_offerid = lo_offerinformation->get_offerid( ).
            lv_nullablestring = lo_offerinformation->get_offername( ).
            lo_sellerinformation = lo_offerinformation->get_sellerofrecord( ).
            IF lo_sellerinformation IS NOT INITIAL.
              lv_sellerprofileid = lo_sellerinformation->get_sellerprofileid( ).
              lv_nonemptystring = lo_sellerinformation->get_displayname( ).
            ENDIF.
          ENDIF.
          lo_offersetinformation = lo_row_5->get_offerset( ).
          IF lo_offersetinformation IS NOT INITIAL.
            lv_offersetid = lo_offersetinformation->get_offersetid( ).
            lo_sellerinformation = lo_offersetinformation->get_sellerofrecord( ).
            IF lo_sellerinformation IS NOT INITIAL.
              lv_sellerprofileid = lo_sellerinformation->get_sellerprofileid( ).
              lv_nonemptystring = lo_sellerinformation->get_displayname( ).
            ENDIF.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
  lv_nexttoken = lo_result->get_nexttoken( ).
ENDIF.

Filter by Product ID

Filter by Product ID

DATA(lo_result) = lo_client->listpurchaseoptions(
  it_filters = VALUE /aws1/cl_mpiprchseoptionfilter=>tt_purchaseoptionfilterlist(
    (
      new /aws1/cl_mpiprchseoptionfilter(
        it_filtervalues = VALUE /aws1/cl_mpipuroptfltvallist_w=>tt_prchseoptionfiltervaluelist(
          ( new /aws1/cl_mpipuroptfltvallist_w( |prod-sampleOfferId| ) )
        )
        iv_filtertype = |PRODUCT_ID|
      )
    )
  )
).

Filter by Seller with Private Offerset

Filter by Seller with Private Offerset

DATA(lo_result) = lo_client->listpurchaseoptions(
  it_filters = VALUE /aws1/cl_mpiprchseoptionfilter=>tt_purchaseoptionfilterlist(
    (
      new /aws1/cl_mpiprchseoptionfilter(
        it_filtervalues = VALUE /aws1/cl_mpipuroptfltvallist_w=>tt_prchseoptionfiltervaluelist(
          ( new /aws1/cl_mpipuroptfltvallist_w( |seller-sampleResellerId| ) )
        )
        iv_filtertype = |SELLER_OF_RECORD_PROFILE_ID|
      )
    )
    (
      new /aws1/cl_mpiprchseoptionfilter(
        it_filtervalues = VALUE /aws1/cl_mpipuroptfltvallist_w=>tt_prchseoptionfiltervaluelist(
          ( new /aws1/cl_mpipuroptfltvallist_w( |OFFERSET| ) )
        )
        iv_filtertype = |PURCHASE_OPTION_TYPE|
      )
    )
    (
      new /aws1/cl_mpiprchseoptionfilter(
        it_filtervalues = VALUE /aws1/cl_mpipuroptfltvallist_w=>tt_prchseoptionfiltervaluelist(
          ( new /aws1/cl_mpipuroptfltvallist_w( |PRIVATE| ) )
        )
        iv_filtertype = |VISIBILITY_SCOPE|
      )
    )
  )
).