Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/package.devc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DEVC>
<CTEXT>Project: Convert ABAP range tables to SQL where clause</CTEXT>
<CTEXT>ABAP_SELTAB_TO_WHERE</CTEXT>
</DEVC>
</asx:values>
</asx:abap>
Expand Down
12 changes: 6 additions & 6 deletions src/zcl_abap_seltab_to_where.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,12 @@ CLASS ZCL_ABAP_SELTAB_TO_WHERE IMPLEMENTATION.

METHOD _sql_operator.
CASE iv_selop.
WHEN: 'EQ'. rv_sqlop = |EQ { _mv_quote_l }%LOW%{ _mv_quote_r }|.
WHEN: 'NE'. rv_sqlop = |NE { _mv_quote_l }%LOW%{ _mv_quote_r }|.
WHEN: 'GE'. rv_sqlop = |GE { _mv_quote_l }%LOW%{ _mv_quote_r }|.
WHEN: 'LE'. rv_sqlop = |LE { _mv_quote_l }%LOW%{ _mv_quote_r }|.
WHEN: 'GT'. rv_sqlop = |GT { _mv_quote_l }%LOW%{ _mv_quote_r }|.
WHEN: 'LT'. rv_sqlop = |LT { _mv_quote_l }%LOW%{ _mv_quote_r }|.
WHEN: 'EQ'. rv_sqlop = |= { _mv_quote_l }%LOW%{ _mv_quote_r }|.
WHEN: 'NE'. rv_sqlop = |<> { _mv_quote_l }%LOW%{ _mv_quote_r }|.
WHEN: 'GE'. rv_sqlop = |>= { _mv_quote_l }%LOW%{ _mv_quote_r }|.
WHEN: 'LE'. rv_sqlop = |<= { _mv_quote_l }%LOW%{ _mv_quote_r }|.
WHEN: 'GT'. rv_sqlop = |> { _mv_quote_l }%LOW%{ _mv_quote_r }|.
WHEN: 'LT'. rv_sqlop = |< { _mv_quote_l }%LOW%{ _mv_quote_r }|.

WHEN: 'CP'. rv_sqlop = |LIKE { _mv_quote_l }%LOW%{ _mv_quote_r }|.
WHEN: 'NP'. rv_sqlop = |NOT LIKE { _mv_quote_l }%LOW%{ _mv_quote_r }|.
Expand Down
1 change: 0 additions & 1 deletion src/zcl_abap_seltab_to_where.clas.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<asx:values>
<VSEOCLASS>
<CLSNAME>ZCL_ABAP_SELTAB_TO_WHERE</CLSNAME>
<VERSION>1</VERSION>
<LANGU>E</LANGU>
<DESCRIPT>Convert range table to SQL where clause</DESCRIPT>
<STATE>1</STATE>
Expand Down
38 changes: 33 additions & 5 deletions src/zr_demo_seltab_to_where.prog.abap
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,43 @@
*&---------------------------------------------------------------------*
REPORT zr_demo_seltab_to_where.

DATA: lt_seltab TYPE zcl_abap_seltab_to_where=>tt_named_seltables,
lt_rng_carrid TYPE RANGE OF sflight-carrid.
DATA: lt_seltab TYPE zcl_abap_seltab_to_where=>tt_named_seltables,
lt_rng_carrid TYPE RANGE OF sflight-carrid,
lt_rng_initial TYPE RANGE OF sflight-carrid.

lt_rng_carrid = VALUE #( sign = 'I' option = 'EQ' ( low = 'ABC' ) ).
lt_rng_carrid = VALUE #(
sign = 'I' option = 'EQ' ( low = 'ABC' )
sign = 'I' option = 'NE' ( low = 'ABC' )
sign = 'I' option = 'GT' ( low = 'ABC' )
sign = 'I' option = 'LT' ( low = 'ABC' )
sign = 'I' option = 'GE' ( low = 'ABC' )
sign = 'I' option = 'LE' ( low = 'ABC' )
sign = 'I' option = 'BT' ( low = 'ABC' high = 'ABC' )
sign = 'E' option = 'EQ' ( low = 'ABC' )
sign = 'E' option = 'NE' ( low = 'ABC' )
sign = 'E' option = 'GT' ( low = 'ABC' )
sign = 'E' option = 'LT' ( low = 'ABC' )
sign = 'E' option = 'GE' ( low = 'ABC' )
sign = 'E' option = 'LE' ( low = 'ABC' )
sign = 'E' option = 'BT' ( low = 'ABC' high = 'ABC' )
).

lt_seltab = VALUE #( ( name = 'CARRID' dref = REF #( lt_rng_carrid ) ) ).
lt_rng_initial = VALUE #(
sign = 'I' option = 'BT' ( low = 'ABC' high = 'ABC' )
).

lt_seltab = VALUE #(
( name = 'CARRID' dref = REF #( lt_rng_carrid ) )
( name = 'CARRID_INITIAL' dref = REF #( lt_rng_initial ) )

).

DATA(lv_where) = zcl_abap_seltab_to_where=>combine_seltabs(
it_named_seltabs = lt_seltab
).

WRITE: lv_where.
cl_demo_output=>new(
)->begin_section( 'KKW'
)->end_section(
)->write_data( lv_where
)->display( ).
2 changes: 0 additions & 2 deletions src/zr_demo_seltab_to_where.prog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
<asx:values>
<PROGDIR>
<NAME>ZR_DEMO_SELTAB_TO_WHERE</NAME>
<STATE>A</STATE>
<VARCL>X</VARCL>
<SUBC>1</SUBC>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
Expand Down