03-27-2015 6:01 AM
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
03-27-2015 6:19 AM
Single / is not allowed. You can either remove the /, or use double / with at least 3 characters between them (namespace).
Instead of /zf2 field name, you can choose value of la_comp-name as something like:
03-27-2015 6:48 AM
Hi manish,
Thanks for the prompt reply . i did same thing which you have suggested. i have removed '/' and pass only digit . lets say actually my field value is /101 . i removed / and passed only 101.
but when i'm fetching value from hr result table based on the /101 wage type, the corresponding amount is picking and showing in my <table>. but when it getting displayed it is throwing an error
'" Field symbol has not been assigned yet." or it's taking previous wage type value.
in my <table> i'm having exact value. but in my output it's getting replaced with previous value.
if there are no other fields except that, it's throwing an error saying that " Field symbol has not been assigned yet".
here /101 - total gross amount.
but it's getting replaced with previous field value.
anything has to be done.
regards
satish
03-27-2015 7:35 AM
So you have correct data in table and problem is now with ALV display.
You can focus on ALV consistency check, and recheck the field catalog. Maybe, the fieldcatalog has column text as "total gross amount" but the table field name is specified incorrectly.
03-27-2015 9:31 AM
hi manish,
i have gone through consistency check of alv .
can u clarify me that output table is here <table> which is assigned to alv FM. am i right?
if it is yes....<table> is having 101 field before displaying the output. but in consistency check when i click on output table tab which i have marked is not showing 101 field.
am i missing something.
regards
satish
03-27-2015 9:48 AM
hi manish,
thanks for your valuable time and useful kt. issue solved with ur input.
Regards
satish
03-27-2015 10:12 AM
03-27-2015 10:14 AM
03-27-2015 10:35 AM
while creating field catalog, i was passing the field value as '/101' to get the description . have removed / here also and passing only 101 to get the desc. so my field catalog and output table having same no.of fields and corresponding values. this step solved my issue.
regards
satish