code-pal-for-abap icon indicating copy to clipboard operation
code-pal-for-abap copied to clipboard

New check - modification of importing parameter via field-symbol

Open FreHu opened this issue 5 years ago • 1 comments

  methods EXECUTE
    importing
      !IR_OPERAND1 type ref to DATA
      !IR_OPERAND2 type ref to DATA
      !IR_RESULT type ref to DATA.

METHOD execute.      
   CHECK ir_operand1 IS BOUND AND
   ir_operand2 IS BOUND AND
   ir_result   IS BOUND.

    ASSIGN ir_operand1->* TO FIELD-SYMBOL(<operand1>).
    ASSIGN ir_operand2->* TO FIELD-SYMBOL(<operand2>).
    ASSIGN ir_result->*   TO FIELD-SYMBOL(<result>).

    TRY.
      <result> = <operand1> - <operand2>.
    CATCH cx_root.
    ENDTRY.
ENDMETHOD.

I found this method which treats an importing parameter as if it were changing/returning.

FreHu avatar Jun 08 '20 17:06 FreHu

Thanks Frederik!! We'll take a closer look.