2014 Jan 29 12:19 PM
Hi Guys,
i'm getting an error while creating a structure from components.
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.
LOOP AT it_ztqm_unit_hygien INTO wa_ztqm_unit_hygien.
la_comp-name = wa_ztqm_unit_hygien-zarea.
lo_element ?= cl_abap_elemdescr=>describe_by_data( lv_zhygiene_score ).
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_ztqm_unit_hygien.
ENDLOOP.
lo_new_type = cl_abap_structdescr=>create( p_components = lt_tot_comp // this is the place where i'm getting error
p_strict = space ).
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>.
I'm getting the following error..
Component Name 'BOILER HOUSE' of the Component 6 Contains an Invalid Character
I'm having the components like "xxx,yyy " , " LAB." , " RM & PM STORE" , "WASTE STORAGE YARD".
Does somebody have an idea how to slove this.
Thanks in Advance
Regards
satish
2014 Jan 29 1:07 PM
Hi Satish,
Please elaborate something more in your example like what do you have in it_ztqm_unit_hygien.
And also tell me data type of lv_zhygiene_score .
Thanks
Deependra
2014 Jan 29 1:14 PM
Hi,
And what "error" do you get?
Don't you have any space in some component name?
Br,
Manu.
Edit: Didn't read your post completely Please remove the spaces in your component name...
e.g: "WASTE_STORAGE_YARD" and no "WASTE STORAGE YARD".
2014 Jan 29 10:23 PM
Hi Satish,
have you checked these links below?
Btw, you likely use incorrect component name. In order to check where the error is you are to go to the method CL_ABAP_STRUCTDESCR=>CREATE( ). You will see the method CHECK_COMPONENT_TABLE( ) inside. It checks for the correct component names of the structure you use. It seems to me your case is here: line 85
if comp-name+off cn 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789#$%&*-/;<=>?@^{|}'.
* illegal character in component name
raise exception type CX_SY_STRUCT_COMP_NAME
exporting textid = CX_SY_STRUCT_COMP_NAME=>illegal_char_in_name
component_name = comp-name
component_number = comp_no.
endif.
But you can put a break point inside and check by your own.
Regards,
Aliaksei
2014 Jan 30 7:45 AM
Hi deependra,
My internal table is having the following values
Area Hygiene Score
_____ ___________
| ADMIN. | 67.00 |
| BOILER HOUSE | 97.00 |
| BOTTLING | 78.00 |
| BREW HOUSE | 78.00 |
| EMPTY BOTTLE YARD | 67.00 |
| ETP | 67.00 |
| FERMENTATION,LAGERING, UNITANK | 87.00 |
| FILTERATION AND BBT | 80.00 |
| FUEL STORAGE AREA | 80.00 |
| LAB. | 98.00 |
| MALT FEEDING | 86.00 |
| RM & PM STORE | 96.00 |
| TOILET | 100.00 |
| UTILITIES | 56.00 |
| WAREHOUSE | 87.00 |
| WASTE STORAGE YARD | 89.00 |
| WTP | 67.00 |
lv_hygiene_score type is Decimal.
Regards
satish
2014 Jan 30 8:56 AM
Hi,
Have you tried what I suggested.... no empty space in components names
Manu.