VinceCoder
2/25/2019 - 11:44 AM

Get SET values (1° Method)

Leggere i valori in un set attraverso FM 'G_SET_GET_ALL_VALUES'

TRANSAZIONI RELATIVE AI SET:

GS01 = Creazione SET GS02 = Modifca SET GS03 = Visualizzazione SET GS04 = Cancellazione SET

 Esempio Nr. 1 di come leggere il SET nel codice ABAP:
 
REPORT ztest_set.

RANGES: r_sdsta_ru_new FOR vlcvehicle-sdsta.
DATA: t_set_value TYPE STANDARD TABLE OF rgsb4 WITH HEADER LINE.

START-OF-SELECTION.

  CLEAR: t_set_value, r_sdsta_ru_new.
  REFRESH: t_set_value, r_sdsta_ru_new.

  CALL FUNCTION 'G_SET_GET_ALL_VALUES'
    EXPORTING
      client        = sy-mandt
      setnr         = 'ZCLASSE_CESPITE'     "set name
      table         = 'ANKA'
      class         = '0000'
      fieldname     = 'ANLKL'
    TABLES
      set_values    = t_set_value
    EXCEPTIONS
      set_not_found = 1
      OTHERS        = 2.

  LOOP AT t_set_value.
    r_sdsta_ru_new-low        = t_set_value-from.
    r_sdsta_ru_new-high       = t_set_value-to.
    r_sdsta_ru_new-sign       = 'I'.                     "Inclusion

    IF t_set_value-to  = space OR
       t_set_value-to  = t_set_value-from.
      r_sdsta_ru_new-option   = 'EQ'.                    "Equivalent
    ELSE.
      r_sdsta_ru_new-option   = 'BT'. "Between
    ENDIF.
    WRITE:/ 'DA:', t_set_value-from, '    A:',  t_set_value-to.
    APPEND r_sdsta_ru_new.
  ENDLOOP.