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

Unable to interpret .

d4xtian
Participant
0 Likes
2,655

Hi guys,

I loop into a table and i want to concatenate that data into a string.

LOOP AT lv_int  ASSIGNING FIELD-SYMBOL(<fs_int>) .

  CONCATENATE <fs_int> 
    INTO gv_orginal_string
    separated  by gv_comma_separator .

  WRITE : / <fs_int> .


ENDLOOP.

I have the following error :

"Unable to interpret <fs_int>. Possible cause of error include incorrect spellings or comma errors.

what did i do wrong...

Thanks you...

Hi guys,

I loop into a table and i want to concatenate that data into a string.

LOOP AT lv_int  ASSIGNING FIELD-SYMBOL(<fs_int>) .

  CONCATENATE <fs_int> 
    INTO gv_orginal_string
    separated  by gv_comma_separator .

  WRITE : / <fs_int> .


ENDLOOP.

I have the following error :

"Unable to interpret <fs_int>. Possible cause of error include incorrect spellings or comma errors.

what did i do wrong...

Thanks you...

4 REPLIES 4
Read only

Nitish2027
Participant
2,531

Hi fotso

You have not selected the field that you want to concatenate the value of. You cannot use <fs_int> as it will have a structure type same as the internal table lv_int. (Do learn naming convention as well and try naming internal tables as lt_int or it_int instead of lv_int).Make the following changes in your logic.
LOOP AT lv_int  ASSIGNING FIELD-SYMBOL(<fs_int>).

  CONCATENATE gv_original_string <fs_int>-field_name 
    INTO gv_orginal_string
    separated  by gv_comma_separator.

  WRITE : / <fs_int>.

ENDLOOP.
Thanks 🙂
Read only

Sandra_Rossi
Active Contributor
2,531

Concatenate is to concatenate at least 2 fields. You have indicated only 1 field.

Note: I prefer any of these 2 syntaxes rather than using CONCATENATE:

gv_orginal_string = |{ gv_orginal_string },{ <fs_int> }|.

gv_orginal_string = gv_orginal_string && ',' && <fs_int>.
Read only

touzik_itc
Active Participant
0 Likes
2,531
gv_orginal_string = concat_lines_of( table = lt_int sep = ',' ).
Read only

thkolz
Contributor
0 Likes
2,531
DATA:
lr_strucdescr TYPE REF TO cl_abap_structdescr,
s_flight TYPE sflight,
v_output TYPE string.

s_flight-carrid = '123'.
s_flight-currency = 'USD'.
s_flight-fldate = sy-datum.

lr_strucdescr ?= cl_abap_typedescr=>describe_by_data( s_flight ).

LOOP AT lr_strucdescr->components INTO DATA(s_components).
ASSIGN COMPONENT s_components-name OF STRUCTURE s_flight TO FIELD-SYMBOL(<fs_field>).
IF v_output IS INITIAL.
v_output = <fs_field>.
ELSE.
v_output = |{ v_output },{ <fs_field> }|.
ENDIF.
ENDLOOP.

cl_demo_output=>display( v_output ).