Application Development 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: 

ABAP syntax check: No string calculation permitted here - why?

jrgkraus
Active Contributor
0 Kudos

I have this method:

* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Private Method ZCL_MF01_DP_OUTPUT->EQUIPMENTS_MAP
* +-------------------------------------------------------------------------------------------------+
* | [--->] IO_DP                          TYPE REF TO ZCL_CS01_CONFIRM_DP_ORDER
* | [--->] IT_CONF_T                      TYPE        GTY_T_TIME_CONFS
* | [--->] IT_CONF_M                      TYPE        GTY_T_MAT_CONFS
* | [--->] IT_EQUI                        TYPE        GTY_T_EQUIPMENTS
* | [<-()] RS_RES                         TYPE        ZPO_ORDER_DT_EQUIPMENTS
* +--------------------------------------------------------------------------------------</SIGNATURE>
  method equipments_map.
    rs_res = value #(
      equipment = value #(
        for s_equi in it_equi (
          equipment_number = |{ s_equi-equipment alpha = out }| *<--
          equipment_description = space
          serial_number = space
          time_confirmations = value #(
            time_confirmation = value #(
              for s_conft in it_conf_t where (
                equipment = s_equi-equipment )
              ( time_conf_map( s_conft ) )
            ) " time_confirmation
          ) " time_confirmations
          material_confirmations = value #(
            material_confirmation = value #(
              for s_confm in it_conf_m where (
                equipment = s_equi-equipment )
              ( mat_conf_map( s_confm ) )
            ) " material_confirmation
          ) " mat_confs
          maintenance = value #(
            warranty = space
            warranty_until = space
            maintenance_contract = space
          ) " maint
        ) " table line
      ) " equipment
    ). " equipments.
  endmethod.


On the marked line, i get the syntax error"String calculation not permitted here", but I do not understand, why?

ABAP-Version:
740 SP 0018

1 ACCEPTED SOLUTION

horst_keller
Product and Topic Expert
Product and Topic Expert

To make a long thing short:

DATA:
  BEGIN OF line,
    colt type string,
    coli TYPE i,
  END OF line.
line = VALUE #( colt = 1 + 1 ).
line = VALUE #( coli = `...` ).
line-coli = |...|.
line-coli = `...` && `...`.
line = VALUE #( coli = CONV i( |...| ) ).
line = VALUE #( coli = CONV i( `...` && `...` ) ).
line = VALUE #( coli = |...| ).                    "Error
line = VALUE #( coli = `...` && `...` ).           "Error

Let's say, we have a small flaw in assigning string expressions to incompatible structure components in the VALUE operator.

A workaround is the explicit usage of CONV. Development is notified.

4 REPLIES 4

matt
Active Contributor
0 Kudos

I think I've seen this before - do you get the same error without

alpha=out

horst_keller
Product and Topic Expert
Product and Topic Expert

To make a long thing short:

DATA:
  BEGIN OF line,
    colt type string,
    coli TYPE i,
  END OF line.
line = VALUE #( colt = 1 + 1 ).
line = VALUE #( coli = `...` ).
line-coli = |...|.
line-coli = `...` && `...`.
line = VALUE #( coli = CONV i( |...| ) ).
line = VALUE #( coli = CONV i( `...` && `...` ) ).
line = VALUE #( coli = |...| ).                    "Error
line = VALUE #( coli = `...` && `...` ).           "Error

Let's say, we have a small flaw in assigning string expressions to incompatible structure components in the VALUE operator.

A workaround is the explicit usage of CONV. Development is notified.

0 Kudos

Horst,

"Development is notified".

Is this team into Kernel side Development ?

Just curious to know which side of development handles these kind of issues.

K.Kiran.

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Sure, Kernel development, who else ...