Friday, December 24, 2010
Here are few function modules used to create dynamic WHERE clause.
- CONVERT_SELECT_INTO_WHERE
- ADSPC_CREATE_WHERE_CLAUSE
- DYNSQL_GENERATE_WHERE_CLAUSE
- FREE_SELECTIONS_RANGE_2_WHERE
REPORT ztest_dynamic. "---------------------------------------------------------------------------* "Declaration "---------------------------------------------------------------------------* "Table for condition DATA: wa_cond TYPE string, it_cond TYPE TABLE OF string. "Variables DATA: lv_cityfrom TYPE spfli-cityfrom. "---------------------------------------------------------------------------* "Selection Screen "---------------------------------------------------------------------------* PARAMETERS: city1(10) TYPE c, city2(10) TYPE c. "---------------------------------------------------------------------------* "Start of selection "---------------------------------------------------------------------------* START-OF-SELECTION. CONCATENATE 'CITYFROM = ''' city1 '''' INTO wa_cond. APPEND wa_cond TO it_cond. CLEAR wa_cond. CONCATENATE 'OR CITYFROM = ''' city2 '''' INTO wa_cond. APPEND wa_cond TO it_cond. CLEAR wa_cond. CONCATENATE 'OR CITYFROM = ''' 'BERLIN' '''' INTO wa_cond. APPEND wa_cond TO it_cond. CLEAR wa_cond. "Check the Where wa_condition LOOP AT it_cond INTO wa_cond. WRITE wa_cond. ENDLOOP. SKIP. "Select Query with dynamic where clause SELECT cityfrom INTO lv_cityfrom FROM spfli WHERE (it_cond). WRITE / lv_cityfrom. ENDSELECT.
Followers
Popular Posts
- ABAP - ALV Report example with steps
- ABAP - Step by step tutorial on Smart Forms - Template Node
- ABAP - Sending email with pdf attachment
- SAP Adobe Form - Steps to create simple ADOBE Form and calling it from ABAP Program
- SAP ABAP - CL_ABAP_CHAR_UTILITIES class usage
- ABAP - Multiple value selection from F4 help for SELECT-OPTIONS
- Execute ABAP Report using SUBMIT statement
- ABAP - Select all or Deselect all in ALV or Check box handling in ALV
- Web Dynpro ABAP ALV - ON_CLICK event
- ABAP - Dynamic WHERE clause
0 comments:
Post a Comment
Your useful comments, suggestions are appreciated.Your comments are moderated.