Range-Tabelle (ABAP)

Aus MattWiki
Version vom 5. Juni 2017, 14:52 Uhr von Matt (Diskussion | Beiträge) (→‎Codebeispiel)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)

Standard Dictionary Struktur: RRRANGE

Vorgehen: 

  • Zwei Variablen erstellen: eine LT und eine LS
  • Werte in LS füllen

Codebeispiel

FUNCTION ZPAKET.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  EXPORTING
*"     REFERENCE(E_T_NWVKDAT) TYPE  ZNWVKDAT09
*"----------------------------------------------------------------------

"data: lt_range_cust type range of 0CUSTOMER.

data: lt_range type table of rrrange,
      ls_range type rrrange,
      lt_cust type table of /BI0/OICUSTOMER,
      ls_cust type /BI0/OICUSTOMER,
      lt_cust_res type table of /BIC/AZNWVKDAT00,
      ls_cust_res type /BIC/AZNWVKDAT00,
      lt_znwvkdat type znwvkdat09,
      ls_znwvkdat09 type znwvkdat09.


select DISTINCT CUSTOMER from /BIC/AZNWVKDAT00
  into table lt_cust
  UP TO 3 rows
  where customer NE '0000000000'.

ls_range-sign = 'I'.
ls_range-opt = 'EQ'.
ls_range-high = ''.

loop at lt_cust into ls_cust.
  ls_range-low = ls_cust.
  append ls_range to lt_range.
ENDLOOP.


select * from /BIC/AZNWVKDAT00
  into table E_T_NWVKDAT
  where customer in lt_range.

loop at e_t_nwvkdat INTO ls_znwvkdat09.
  
  
ENDLOOP.

ENDFUNCTION.