- Creating Range Tables in SAP ABAP (Simple Explanation)
Usage and Explanation- A Range table can be used when you want
to split the data into single table or Multiple tables.This data can be
used while selecting data for multiple conditions.Whenever you create a Range Table by default there are 4 values created for this table namely
- Sign
- Option
- Low
- High
-You can pass value to sign as either 'I' (Include) or 'E'(Exclude)
-Option can be used for operand like 'EQ'(Equal to),'NE'(Not Equal To),'BT'(Between)
-Low is the actual value that you need to pass in the table
-High option is not needed unless using the BT option
*&-------------------------------------------------------------* *& Report Z_RANGE_STATEMENT *& *&-------------------------------------------------------------* REPORT Z_RANGE_STATEMENT. TYPES: BEGIN OF t_ekko, ebeln TYPE ekpo-ebeln, ebelp TYPE ekpo-ebelp, statu TYPE ekpo-statu. TYPES :END OF t_ekko. DATA: lt_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0, wa_ekko TYPE t_ekko. DATA: r_ebeln type range of ekko-ebeln, "range table wa_ebeln like line of r_ebeln. "work area for range table START-OF-SELECTION.
*Filling data for Range table
wa_ebeln-sign = 'I'. "I = include, E = exclude wa_ebeln-option = 'EQ'. "EQ, BT, NE wa_ebeln-low = 'Value needed to be stored'. *wa_ebeln-high = "not needed unless using the BT optionAppend wa_ebeln to r_ebeln.
*Select Data from EKPO select ebeln
ebelp
statu
from ekpo
into table it_ekko
where ebeln IN r_ebeln.
If sy-subrc is Initial.
SORT it_ekko BY ebeln ebelp.
Endif.
Use LOOP . . ENDLOOP and add multiple entries.
Tutorial - Create two range tables and select data from Mara based on the two Range tables. If you face any issues/Questions/Concerns please comment below and i will answer your queries.
No comments:
Post a Comment