Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CL_ABAP_STRUCTDESCR ..... Invalid character error

Former Member
0 Likes
3,022

Dear Friends,

I am creating dynamic table using RTTS and display in ALV. However, I am not able to use special character as column heading.

The error is caused at statement:

gr_struct_typ = cl_abap_structdescr=>create( p_components = gt_component ).

It gives following error.

I read some thread and tried like this but it did not work.

TRY.
gr_struct_typ = cl_abap_structdescr=>create( p_components = gt_component ).
p_strict = cl_abap_structdescr=>false ).
CATCH cx_sy_struct_creation .
ENDTRY.

I also tried p_strict = space but no success. Can anyone provide a suitable solution that how can i use Special Characters cl_abap_structdescr=>create .

Thanks

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
2,137

Is your actual code similar to

  lo_structure_type = cl_abap_structdescr=>create(
                            p_components = lt_component
                            p_strict     = abap_false ). " or ' '

In any case, look quickly at the source of the CREATE method, even with non-strict check, there is a limited list of allowed characters. In strict mode only 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789' are allowed, and in non-strict mode only 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789#$%&*-/;<=>?@^{|}' are allowed, so your leading dot is never allowed.

Dear Friends,

I am creating dynamic table using RTTS and display in ALV. However, I am not able to use special character as column heading.

The error is caused at statement:

gr_struct_typ = cl_abap_structdescr=>create( p_components = gt_component ).

It gives following error.

I read some thread and tried like this but it did not work.

TRY.
gr_struct_typ = cl_abap_structdescr=>create( p_components = gt_component ).
p_strict = cl_abap_structdescr=>false ).
CATCH cx_sy_struct_creation .
ENDTRY.

I also tried p_strict = space but no success. Can anyone provide a suitable solution that how can i use Special Characters cl_abap_structdescr=>create .

Thanks

5 REPLIES 5
Read only

RaymondGiuseppi
Active Contributor
2,138

Is your actual code similar to

  lo_structure_type = cl_abap_structdescr=>create(
                            p_components = lt_component
                            p_strict     = abap_false ). " or ' '

In any case, look quickly at the source of the CREATE method, even with non-strict check, there is a limited list of allowed characters. In strict mode only 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789' are allowed, and in non-strict mode only 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789#$%&*-/;<=>?@^{|}' are allowed, so your leading dot is never allowed.

Read only

0 Likes
2,137

Dear Raymond,

Thanks for your reply. You are right. It will never wok in case of 'dot'. Yes, i tried the same way as you mentioned. So shall i remove leading dot? What would you suggest? Can you please also tell how can i check this with non-strict?

Read only

0 Likes
2,137

No choice, you must remove invalid characters...

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,137

By the way, your leading dot looks like some names in table DD03L (table of DDIC fields) used for including structures in other structures/tables. Maybe you want to add a component ABAP_ENTW_IN of a structure which would be named BCXE1D_AE. If it's correct that BCXE1D_AE is a DDIC structure/table, don't you want to add BCXE1D_AE as an include? Or do you want to add only one component of the structure?

Read only

pokrakam
Active Contributor
2,137

You talk about column heading but the error is about a component name. The two are very different.

Names must follow the standard abap element naming rules. If you want column headings you need to provide field descriptions, where you can use special characters. Provide those as part of your components and you should be OK.