Skip to Content

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Apr 27 at 09:14 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded