Entering content frame

Syntax documentation GET_SIMPLE_HELPVALUES Locate the document in its SAP Library structure

Use

Method GET_SIMPLE_HELPVALUES of the service object (RUNTIME->DDIC_UTILS) defines the list of values from a simple value help.

As import parameter you must declare a reference to the data object whose value help is used. This data object must have a direct or indirect reference to an elementary Dictionary type (data element or structure field) to which a simple value help (fixed values, check table, search help) is assigned. For example, the method can pass a reference to a data object that is associated with an elementary component of a Dictionary structure (DATA: var TYPE strucname-compname.) or a data object that directly is associated with a data reference (DATA: var TYPE dtelname.).

The method returns the values found in a two-column table. The KEY column contains the internal values, while the VALUE column contains the associated texts themselves. Parameter SORT_VALUES can be used to control whether and how the list of values should be sorted. For example, for a list of values with a number for the day and a name for the day of the week, sorting by VALUE column would give you the following order: Tuesday, Thursday, Friday, Wednesday, Monday, Saturday, Sunday. You should sort by the KEY column here. If the value help was defined with fixed values, these are often stored in the required order and you do not need to sort the values.

Parameters and Exceptions

Import parameters:

 

SORT_VALUES

Sorts the list of values (NO_SORT, BY_VALUE, BY_KEY)

 

DATA_OBJECT_REF

Reference to a data object

Change parameters:

 

HELPVALUE_TAB

List of values belonging to a data object

Exceptions:

 

CX_BSP_SERVICES_PARAM

 
 

CX_BSP_SERVICES_NOTFOUND

 
 

CX_BSP_SERVICES_SHLP

 

Example

Page Attributes

Attribute

Auto

TypCat

Ref. Type

Description

airlinelist

 

TYPE

SHSVALTAB

Available airlines

Event OnInitialization

data: flight        type        sflight,

      dataref       type ref to data,

      errortext     type        string,

      l_ex_services type ref to cx_bsp_services.

 

get reference of flight-carrid into dataref.

* get list of available airlines

try.

call method runtime->ddic_utils->get_simple_helpvalues

            exporting data_object_ref = dataref

            changing  helpvalue_tab   = airlinelist.

catch cx_bsp_services into l_ex_services.

*   catch exception into message object

    errortext = l_ex_services->get_text( ).

    call method messages->add_message

         exporting condition = 'AIRLINES'

                   message = errortext

                   severity = CL_BSP_MESSAGES=>CO_SEVERITY_ERROR.

endtry.

Layout

<%@page language="abap"%>

<html>

  <head>

    <link rel="stylesheet" href="../../sap/public/bc/bsp/styles/sapbsp.css">

    <title> Simple value help from DDIC </title>

  </head>

  <body class="bspBody1">

   <% if messages->num_messages( ) = 0.

    data: wa type SHSVALSTR. %>

    Which airline do you want to fly with?

    <p>

    <select name="AIRLINE">

     <% loop at airlinelist into wa.%>

      <option value=" <%=wa-key%> "> <%=wa-value%> </option>

     <% endloop. %>

    </select>

   <% else. %>

    Sorry, there are no airlines available

   <% endif. %>

  </body>

</html>

 

 

Leaving content frame