‎2019 Jan 24 4:16 AM
Hi Gurus,
My method has below parameters
Importing parameters
Iv_tabname of type tabname
Is_from_rec type any
Exporting parameter
ET_details type any
Is_from_ rec has some fields matching with Iv_tabname which would be dynamic . So Now my question is how do I formulate my where clause based on is_from_rec record and then pass the result of select query to my returning parameter ET_details
Select * from (iv_tabname) into table et_details where (is_from_rec)
‎2019 Jan 24 8:11 AM
There are few ways to achive this, i have one:
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(ITAB) TYPE CHAR30
*" REFERENCE(IWHERE) TYPE CHAR255
*" EXPORTING
*" REFERENCE(ET_RESULT) TYPE REF TO DATA
*"----------------------------------------------------------------------
FIELD-SYMBOLS <table> TYPE STANDARD TABLE.
DATA(comp_tab1) = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_name( itab ) )->get_components( ).
DATA(struct_type) = cl_abap_structdescr=>create( comp_tab1 ).
DATA(table_type) = cl_abap_tabledescr=>create( struct_type ).
CREATE DATA et_result TYPE HANDLE table_type.
ASSIGN et_result->* TO <table>.
SELECT * FROM (itab) INTO TABLE <table> WHERE (iwhere).