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: 

Method t create dynamic structure if the field name contains space

Former Member
0 Kudos
309

HI all,

I am creating a dynamic internal table. Everything id fine but when creating dynamic structure if field name contains space its giving me dump.Can you please suggest me any other methos which takes space in the field name.

Iam using the following method:

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

In the gt_component i have one of the field with space like ( RU STAND) and its giving error.

Any help will be appreciated.

thanks

Suku.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
259

can't you just check it and change it if it is not compliant?

DATA:
   colname(80)  TYPE c VALUE 'RU STAND'.


REPLACE ALL OCCURRENCES OF REGEX '[^A-Z_0-9/]'
  IN colname WITH '' IGNORING CASE.

TRANSLATE colname TO UPPER CASE.

WRITE colname.

3 REPLIES 3

Former Member
0 Kudos
260

can't you just check it and change it if it is not compliant?

DATA:
   colname(80)  TYPE c VALUE 'RU STAND'.


REPLACE ALL OCCURRENCES OF REGEX '[^A-Z_0-9/]'
  IN colname WITH '' IGNORING CASE.

TRANSLATE colname TO UPPER CASE.

WRITE colname.

uwe_schieferstein
Active Contributor
0 Kudos
259

Hello Sukumar

If the space in the fieldname is a mistake then you could simply use:

CONDENSE ld_fieldname NO-GAPS.

However, I guess your fieldname should contain this space:

>...suggest me any other methos which takes space in the field name.

>

Well, have you ever seen a field or column name in SAP standard containing a space in its name???

Regards

Uwe

0 Kudos
259

Hi Uwe,

I know that SAP field name doesnt contain spaces. Actually I am showing field values as columns.

I think now you understood.

thanks

suku