Skip to Content
0
Mar 27, 2015 at 06:01 AM

Problem in creating dynamic alv.

28 Views

Hi guys,

i'm trying to create dynamic alv structure based on z table. In my z-table having a column which contains wage types. some of the wage types starts with '/' as prefix like '/101' , /zf2 .

my problem is when it's reading these components which are having '/' as prefix it's throwing an error " Component name '/101' of component 32 contains an invalid namespace prefix "

actually i have given P_strict = p_strict = cl_abap_structdescr=>false to handle the special characters.

following is my code

ORM dynamic_alv .

REFRESH lt_tot_comp.

lo_struct ?= cl_abap_typedescr=>describe_by_name( 'TY_FINAL' ).

lt_comp = lo_struct->get_components( ).

APPEND LINES OF lt_comp TO lt_tot_comp.

break satishkumarc .

LOOP AT it_zthr_wage_types INTO wa_zthr_wage_types.

la_comp-name = wa_zthr_wage_types-lgart.

lo_element ?= cl_abap_elemdescr=>describe_by_data( new_type ).

la_comp-type = cl_abap_elemdescr=>get_p( p_length =

lo_element->length

p_decimals = lo_element->decimals ).

APPEND la_comp TO lt_tot_comp.

CLEAR: la_comp, wa_zthr_wage_types.

ENDLOOP.

"" Failure in a creating Dynamic structure

"" http://scn.sap.com/thread/1950026

lo_new_type = cl_abap_structdescr=>create( p_components = lt_tot_comp

p_strict = cl_abap_structdescr=>false ).

lo_new_tab = cl_abap_tabledescr=>create(

p_line_type = lo_new_type

p_table_kind = cl_abap_tabledescr=>tablekind_std

p_unique = abap_false ).

CREATE DATA lo_data TYPE HANDLE lo_new_tab.

ASSIGN lo_data->* TO <table>.

ENDFORM. " DYNAMIC_ALV





could anybody please help me out to achieve this.


Thanks in Advance


regards


satish