2016 Feb 11 1:07 PM
2016 Feb 11 1:56 PM
Thanks if someone can give example .
Eliram.
2016 Feb 11 1:16 PM
You can check REPORT demo_sel_screen_tables_ranges in SAP for an example:
DATA: s_carrid2 TYPE RANGE OF spfli-carrid,
s_carrid2_wa LIKE LINE OF s_carrid2.
s_carrid2_wa-sign = 'I'.
s_carrid2_wa-option = 'EQ'.
s_carrid2_wa-low = 'AA'.
APPEND s_carrid2_wa TO s_carrid2.
SUBMIT demo_selection_screen_ldb_1 WITH carrid IN s_carrid2
VIA SELECTION-SCREEN AND RETURN.
A selection table s_carrid is created with reference to column CARRID of database table SPFLI. The s_carrid-low and s_carrid-high fields have the same type as CARRID. The work area of the internal table s_carrid is filled and appended to the table. Program demo2 is called. If demo2 is linked to logical database F1S, its selections screen contains the fields of selection criterion CARRID from the logical database. These fields are filled with the contents of the internal table.
Of course, if you wish to use the range in a select statement, if would be something like this:
SELECT * FROM [dbase table] INTO TABLE [internal table] WHERE carrid in s_carrid2.
Note: replace the * with the fields you require from the dbase table
2016 Feb 11 1:34 PM
You didn't understand me .
I have asked about NATIVE SQL here's an example of my code .
How i transfer in where clause
Hkont in S_HKONT -> abap range .
I don't succeed to transfer abap range to where clause .
EXEC SQL.
OPEN dbcur for
SELECT /*+ FULL(B) */
bukrs, hkont, gjahr, belnr, shkzg, buzei, budat, bldat,
monat, blart, xblnr, dmbtr, sgtxt, ccbtc, vbund
FROM SAPSR3.BSAS B
WHERE mandt = :sy-mandt
AND bukrs = :p_bukrs
AND rfzei = 000
AND budat >= :p_budat
ENDEXEC.
DO.
EXEC SQL.
FETCH NEXT dbcur into :ls_bsis-bukrs,
:ls_bsis-hkont,
:ls_bsis-gjahr,
:ls_bsis-belnr,
:ls_bsis-shkzg,
:ls_bsis-buzei,
:ls_bsis-budat,
:ls_bsis-bldat,
:ls_bsis-monat,
:ls_bsis-blart,
:ls_bsis-xblnr,
:ls_bsis-dmbtr,
:ls_bsis-sgtxt,
:ls_bsis-ccbtc,
:ls_bsis-vbund.
ENDEXEC.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND ls_bsis TO lt_bsis.
ENDDO.
2016 Feb 11 1:39 PM
My mistake, apologies.
Might this thread help https://scn.sap.com/thread/1666042 ?
Not sure the IN operand works in native SQL, it looks like BETWEEN is used instead.
2016 Feb 11 1:47 PM
2016 Feb 11 1:56 PM
2016 Feb 11 2:06 PM
2016 Feb 11 2:23 PM
Input parameter FIELD_RANGES of FREE_SELECTIONS_RANGE_2_WHERE is a small internal table deep structure
Hint: Just add an initial record (*) to the parameter work area, modify its TABLENAME value, add an initial record (*) to field FRANGE_T (an itab too) modify its FIELDNAME value and then loop at your select-option/range table, map fields to a RSDSSELOPT structure and append it to SELOPT_T table.
Regards,
Raymond
(*) use an APPEND INTIAL LINE TO itab ASSIGNING where you defined some FIELD-SYMBOLS of type RSDS_TRANGE and RSDS_FRANGE (Add a TYPE-POOLS rsds. in program global area/class properties)
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |