Code: Alles auswählen.
PARAMETERS: p_from TYPE SPFLI-CITYFROM, p_to TYPE SPFLI-CITYTO.
DATA: where_clause TYPE STRING,
carr TYPE spfli-carrid,
conn TYPE spfli-connid.
CONCATENATE 'CITYFROM = ''' p_from ''' AND CITYTO = ''' p_to ''''
INTO where_clause.
SELECT carrid connid FROM spfli
INTO (carr, conn)
WHERE (where_clause).
WRITE: / carr, conn.
ENDSELECT.
Code: Alles auswählen.
SELECT * FROM db_table
INTO TABLE internal_table
WHERE field IN range.
Code: Alles auswählen.
REPORT ZTEST_DP .
types: begin of myfieldcat,
table type tabname,
field type fieldname,
end of myfieldcat.
data: lv_guid type crmt_object_guid,
dref type ref to data.
data: lt_orderadm_h type table of crmd_orderadm_h.
data: ls_source type string,
lt_source like standard table of ls_source with header line,
l_form(30) type c value 'RANGE_CREATE',
ls_fieldcat type myfieldcat,
lt_fieldcat type standard table of myfieldcat.
data: l_message(240) type c,
l_line type i,
l_word(72) type c,
l_name like sy-repid.
field-symbols: <l_range> type table,
<l_wa> type any,
<l_sign> type any,
<l_option> type any,
<l_low> type any,
<l_high> type any.
data: lt_table type ref to data.
field-symbols: <l_table> type table.
constants:
con_report(60) type c value 'REPORT GENENERATED_SUBROUTINE_POOL.'.
ls_fieldcat-table = 'CRMD_ORDERADM_H'.
ls_fieldcat-field = 'GUID'.
concatenate 'CREATE_' ls_fieldcat-field '_RANGE' into l_form.
clear lt_source.
lt_source = con_report.
append lt_source.
concatenate 'TYPES: BEGIN OF%' ls_fieldcat-field '_RANGE,' into
lt_source.
translate lt_source using '% '.
append lt_source.
lt_source = 'SIGN(1), OPTION(2), '.
append lt_source.
concatenate 'LOW LIKE%' ls_fieldcat-table '-' ls_fieldcat-field ',' into lt_source.
translate lt_source using '% '.
append lt_source.
concatenate 'HIGH LIKE%' ls_fieldcat-table '-' ls_fieldcat-field ',' into lt_source.
translate lt_source using '% '.
append lt_source.
concatenate 'END OF%' ls_fieldcat-field '_RANGE.' into lt_source.
translate lt_source using '% '.
append lt_source.
concatenate 'FORM CREATE_' ls_fieldcat-field '_RANGE using pointer type ref to data' into lt_source.
append lt_source.
lt_source = 'wa_pointer type ref to data.'.
append lt_source.
concatenate 'CREATE DATA POINTER TYPE STANDARD TABLE OF%' ls_fieldcat-field '_RANGE.' into lt_source.
translate lt_source using '% '.
append lt_source.
concatenate 'CREATE DATA WA_POINTER TYPE%' ls_fieldcat-field '_RANGE.' into lt_source.
translate lt_source using '% '.
append lt_source.
lt_source = 'ENDFORM.'.
append lt_source.
l_name = 'TEST'.
break-point.
catch system-exceptions generate_subpool_dir_full = 9.
generate subroutine pool lt_source name l_name
message l_message line l_line word l_word.
endcatch.
case sy-subrc.
when 0.
when 9.
when others.
message x000(0k) with l_message l_line l_word.
endcase.
data: lv_range type ref to data,
lv_wa type ref to data.
perform (l_form) in program (l_name) using lv_range lv_wa.
assign lv_range->* to <l_range>.
assign lv_wa->* to <l_wa>.
assign component 'SIGN' of structure <l_wa> to <l_sign>.
assign component 'OPTION' of structure <l_wa> to <l_option>.
assign component 'LOW' of structure <l_wa> to <l_low>.
<l_sign> = 'I'.
<l_option> = 'EQ'.
<l_low> = '000B147F69751943AF66D20CEA797415'.
append <l_wa> to <l_range>.
<l_low> = '008EE69ED61DC94DAC4C05D8A51A9BD1'.
append <l_wa> to <l_range>.
break-point.
create data lt_table type standard table of (ls_fieldcat-table).
assign lt_table->* to <l_table>.
select * from (ls_fieldcat-table) into table <l_table>
where guid in <l_range>.
break-point.