10-06-2016 12:23 PM
Dear Experts,
I want to use the ALV Grid output of the standard program RFRECPSFA520 in my Z program. I know that using the Method cl_salv_bs_runtime_info=>set, SUBMIT and Return and then cl_salv_bs_runtime_info=>get_data_ref gives you the desired result. But I am getting the exception CX_SY_STRUCT_COMP_NAME since 'Component Name '%_KEY' of the Component 1 Contains an Invalid Character'.
My Code:
TYPES: BEGIN OF abap_componentdescr,
name TYPE string,
type TYPE REF TO cl_abap_datadescr,
as_include TYPE abap_bool,
suffix TYPE string,
END OF abap_componentdescr.
DATA: lt_test TYPE STANDARD TABLE OF abap_componentdescr
WITH KEY name.
DATA: structdescr TYPE REF TO cl_abap_structdescr,
lo_ref TYPE REF TO data.
TRY.
structdescr ?= cl_abap_structdescr=>create(
p_components = lt_test
p_strict = cl_abap_structdescr=>false ).
CATCH cx_sy_struct_creation.
ENDTRY.
*-- Get the report lines as internal table
TRY.
cl_salv_bs_runtime_info=>get_data_ref(
IMPORTING
r_data = lo_ref ).
ASSIGN lo_ref->* TO <lt_data>.
CATCH cx_salv_bs_sc_runtime_info.
ENDTRY.
I am not getting any value in lt_test and after that I am getting a dump from the method cl_salv_bs_runtime_info=>get_data_ref.
Please help!
10-06-2016 1:47 PM
You should attach the short dump (as txt file).
Does it occur at CL_SALV_BS_RUNTIME_INFO=>GET_DATA_REF or where?
If RFRECPSFA520 generates an internal table with component named %_KEY, then it's possible that the standard method CREATE_DATA_FOR_COMPONENT of class CL_SALV_BS_DDIC has a little flaw in lines "if ls_comp-name ca '-'. l_strict = abap_false. endif." I guess it should be "if ls_comp-name ca '-%'." (and all other non-strict characters)