https://oprsteny.com/?p=1193Method 1.
1. Go to Tcode STVARV
2. Declaration Part
*Type for TVARVC parameters
types:BEGIN OF ty_tvarvc,
name TYPE rvari_vnam, "Name
sign TYPE tvarv_sign, "I/E (include/exclude values)
opti TYPE tvarv_opti, "Selection option (EQ/BT/CP/...)
low TYPE tvarv_val, "Selection value (LOW or HIGH value)
high TYPE tvarv_val, "Selection value (LOW or HIGH value)
END OF ty_tvarvc,
tt_tvarvc TYPE STANDARD TABLE OF ty_tvarvc,
tt_range_field1 type range of jest-stat.
CONSTANTS: lc_ztest_name TYPE rvari_vnam VALUE 'ZPS_VALID'. "TVARVC Param. name
DATA: lt_tvarvc TYPE tt_tvarvc, "Internal table for TVARVC values
lt_field1 TYPE tt_range_field1, "Range table for field field1
ls_field1 TYPE LINE OF tt_range_field1.
FIELD-SYMBOLS: <lfs_tvarvc> TYPE ty_tvarvc.
3. Quary Part.
start-of-selection.
*Get the contents of TVARVC table
SELECT name "Name
sign "I/E (include/exclude values)
opti "Selection option (EQ/BT/CP/...)
low "Selection value (LOW or HIGH value)
high "Selection value (LOW or HIGH value)
FROM tvarvc
INTO TABLE lt_tvarvc
WHERE name EQ lc_ztest_name.
IF sy-subrc IS INITIAL.
LOOP AT lt_tvarvc ASSIGNING <lfs_tvarvc>.
MOVE <lfs_tvarvc>-sign TO ls_field1-sign.
MOVE <lfs_tvarvc>-opti TO ls_field1-option.
MOVE <lfs_tvarvc>-low TO ls_field1-low.
MOVE <lfs_tvarvc>-high TO ls_field1-high.
APPEND ls_field1 TO lt_field1.
ENDLOOP.
ENDIF.
4. select Query
select * from jest into table it_jest for all entries in it_prps where objnr = it_prps-objnr and inact eq '' and stat in lt_field1.
--------*****************************************************---------------------------
Method 2:
Data:lr_selection_range TYPE RANGE OF jest-stat,
ls_selection LIKE LINE OF lr_selection_range.
ls_selection-low = 'I0001'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
ls_selection-low = 'I0043'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
ls_selection-low = 'I0046'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
ls_selection-low = 'I0061'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
ls_selection-low = 'I0062'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
ls_selection-low = 'I0063'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
ls_selection-low = 'I0064'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
ls_selection-low = 'I0065'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
ls_selection-low = 'I0076'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
select * from jest into table it_jest for all entries in it_prps where objnr = it_prps-objnr and inact eq '' and stat in lr_selection_range.
1. Go to Tcode STVARV
2. Declaration Part
*Type for TVARVC parameters
types:BEGIN OF ty_tvarvc,
name TYPE rvari_vnam, "Name
sign TYPE tvarv_sign, "I/E (include/exclude values)
opti TYPE tvarv_opti, "Selection option (EQ/BT/CP/...)
low TYPE tvarv_val, "Selection value (LOW or HIGH value)
high TYPE tvarv_val, "Selection value (LOW or HIGH value)
END OF ty_tvarvc,
tt_tvarvc TYPE STANDARD TABLE OF ty_tvarvc,
tt_range_field1 type range of jest-stat.
CONSTANTS: lc_ztest_name TYPE rvari_vnam VALUE 'ZPS_VALID'. "TVARVC Param. name
DATA: lt_tvarvc TYPE tt_tvarvc, "Internal table for TVARVC values
lt_field1 TYPE tt_range_field1, "Range table for field field1
ls_field1 TYPE LINE OF tt_range_field1.
FIELD-SYMBOLS: <lfs_tvarvc> TYPE ty_tvarvc.
3. Quary Part.
start-of-selection.
*Get the contents of TVARVC table
SELECT name "Name
sign "I/E (include/exclude values)
opti "Selection option (EQ/BT/CP/...)
low "Selection value (LOW or HIGH value)
high "Selection value (LOW or HIGH value)
FROM tvarvc
INTO TABLE lt_tvarvc
WHERE name EQ lc_ztest_name.
IF sy-subrc IS INITIAL.
LOOP AT lt_tvarvc ASSIGNING <lfs_tvarvc>.
MOVE <lfs_tvarvc>-sign TO ls_field1-sign.
MOVE <lfs_tvarvc>-opti TO ls_field1-option.
MOVE <lfs_tvarvc>-low TO ls_field1-low.
MOVE <lfs_tvarvc>-high TO ls_field1-high.
APPEND ls_field1 TO lt_field1.
ENDLOOP.
ENDIF.
4. select Query
select * from jest into table it_jest for all entries in it_prps where objnr = it_prps-objnr and inact eq '' and stat in lt_field1.
--------*****************************************************---------------------------
Method 2:
Data:lr_selection_range TYPE RANGE OF jest-stat,
ls_selection LIKE LINE OF lr_selection_range.
ls_selection-low = 'I0001'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
ls_selection-low = 'I0043'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
ls_selection-low = 'I0046'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
ls_selection-low = 'I0061'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
ls_selection-low = 'I0062'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
ls_selection-low = 'I0063'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
ls_selection-low = 'I0064'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
ls_selection-low = 'I0065'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
ls_selection-low = 'I0076'.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
APPEND ls_selection TO lr_selection_range.
select * from jest into table it_jest for all entries in it_prps where objnr = it_prps-objnr and inact eq '' and stat in lr_selection_range.
No comments:
Post a Comment