Dynamic WHERE Clause mit RANGES

Nützliche Abap Codes und Code Fragmente

Dynamic WHERE Clause mit RANGES

Postby Tron » Tue Aug 20, 2019 3:19 pm

Beispiel für Dynamischen Select mit Dynamischer Where Klausel.
Für Z.B. RFC_READ_TABLE mit SELECT-OPTIONS ;)

Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
  1.  
  2.   SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
  3.   SELECT-OPTIONS s_tobj FOR ts_stxh-tdobject.
  4.   SELECT-OPTIONS s_tname FOR ts_stxh-tdname.
  5.   SELECT-OPTIONS s_tid FOR ts_stxh-tdid.
  6.   SELECT-OPTIONS s_tspras FOR ts_stxh-tdspras.
  7.   SELECTION-SCREEN END OF BLOCK a.
  8.  
  9.  
  10.  
  11.   DATA ls_sel TYPE ddshselopt.
  12.   DATA lt_sel TYPE TABLE OF ddshselopt.
  13.   DATA gv_where TYPE string.
  14.  
  15.  
  16.   CLEAR ls_sel.
  17.   ls_sel-shlpfield = 'TDOBJECT'.
  18.   LOOP AT s_tobj.
  19.     MOVE-CORRESPONDING s_tobj TO ls_sel.
  20.     APPEND ls_sel TO lt_sel.
  21.  
  22.   CLEAR ls_sel.
  23.   ls_sel-shlpfield = 'TDNAME'.
  24.   LOOP AT s_tname.
  25.     MOVE-CORRESPONDING s_tname TO ls_sel.
  26.     APPEND ls_sel TO lt_sel.
  27.  
  28.   CLEAR ls_sel.
  29.   ls_sel-shlpfield = 'TDID'.
  30.   LOOP AT s_tid.
  31.     MOVE-CORRESPONDING s_tid TO ls_sel.
  32.     APPEND ls_sel TO lt_sel.
  33.  
  34.   CLEAR ls_sel.
  35.   ls_sel-shlpfield = 'TDSPRAS'.
  36.   LOOP AT s_tspras.
  37.     MOVE-CORRESPONDING s_tspras TO ls_sel.
  38.     APPEND ls_sel TO lt_sel.
  39.  
  40.   CALL FUNCTION 'F4_CONV_SELOPT_TO_WHERECLAUSE'
  41. * EXPORTING
  42. *   GEN_ALIAS_NAMES       = ' '
  43. *   ESCAPE_ALLOWED        = ' '
  44.     IMPORTING
  45.       where_clause = gv_where
  46.     TABLES
  47.       selopt_tab   = lt_sel.
  48.  
  49. *   SPLIT gv_where AT ' ' INTO TABLE gt_opt.
  50.  
  51.  
GeSHi ©
Tron
.....
.....
 
Posts: 1081
Joined: Sat Aug 04, 2007 10:21 pm

Return to Code Snippets

Who is online

Users browsing this forum: No registered users and 1 guest

cron
  • Latest Topics