2011 May 09 3:49 PM
Hi Guys,
i get a strange failure while creating a structure from components.
lr_out_tab ?= cl_abap_tabledescr=>describe_by_data( it_outtab ).
lr_out_struc ?= lr_out_tab->get_table_line_type( ).
lt_out_comp = lr_out_struc->get_components( ).
lr_new_struc = cl_abap_structdescr=>create( lt_out_comp ). <-- cx_sy_struct_comp_name exception
I get this failure, when i have component-names like xxx-yyyy. Does somebody have an idea how to slove this.
Greetings
André
2011 May 10 6:41 AM
Hello Andre,
You're getting the error message because the param P_STRICT of the method CREATE( ) is set to TRUE(by default).
If you set the creation mode as "strict"(P_STRICT = CL_ABAP_STRUCTDESCR=>TRUE), no special characters are allowed in the column names! Since your component names contain a '-' you're getting the exception CX_SY_STRUCT_COMP_NAME.
If you set the creation mode as "non-strict"(P_STRICT = CL_ABAP_STRUCTDESCR=>FALSE), following spl. characters are allowed:
#$%&*-/;<=>?@^{ | }
So in your call you need to set the "non-strict" mode while creating the dynamic structure:
* Get the Dynamic structure definition
TRY.
lo_structdescr =
cl_abap_structdescr=>create(
p_components = lt_struc_comp
p_strict = cl_abap_structdescr=>false ).
CATCH cx_sy_struct_creation . "#EC NO_HANDLER
ENDTRY.Hope i'm clear.
BR,
Suhas
PS: Check the source code of CREATE( ) if you want to validate
Hello Andre,
You're getting the error message because the param P_STRICT of the method CREATE( ) is set to TRUE(by default).
If you set the creation mode as "strict"(P_STRICT = CL_ABAP_STRUCTDESCR=>TRUE), no special characters are allowed in the column names! Since your component names contain a '-' you're getting the exception CX_SY_STRUCT_COMP_NAME.
If you set the creation mode as "non-strict"(P_STRICT = CL_ABAP_STRUCTDESCR=>FALSE), following spl. characters are allowed:
#$%&*-/;<=>?@^{ | }
So in your call you need to set the "non-strict" mode while creating the dynamic structure:
* Get the Dynamic structure definition
TRY.
lo_structdescr =
cl_abap_structdescr=>create(
p_components = lt_struc_comp
p_strict = cl_abap_structdescr=>false ).
CATCH cx_sy_struct_creation . "#EC NO_HANDLER
ENDTRY.Hope i'm clear.
BR,
Suhas
PS: Check the source code of CREATE( ) if you want to validate
2011 May 10 6:41 AM
Hello Andre,
You're getting the error message because the param P_STRICT of the method CREATE( ) is set to TRUE(by default).
If you set the creation mode as "strict"(P_STRICT = CL_ABAP_STRUCTDESCR=>TRUE), no special characters are allowed in the column names! Since your component names contain a '-' you're getting the exception CX_SY_STRUCT_COMP_NAME.
If you set the creation mode as "non-strict"(P_STRICT = CL_ABAP_STRUCTDESCR=>FALSE), following spl. characters are allowed:
#$%&*-/;<=>?@^{ | }
So in your call you need to set the "non-strict" mode while creating the dynamic structure:
* Get the Dynamic structure definition
TRY.
lo_structdescr =
cl_abap_structdescr=>create(
p_components = lt_struc_comp
p_strict = cl_abap_structdescr=>false ).
CATCH cx_sy_struct_creation . "#EC NO_HANDLER
ENDTRY.Hope i'm clear.
BR,
Suhas
PS: Check the source code of CREATE( ) if you want to validate
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |