Conversion operation- CONV
Conversion Operator CONV – Converts the argument data to the data type specified using type & creates the desired result.Let’s use CONV operator in various scenarios.
Scenario 1: The method CONVERT_TO has an importing parameter SOURCE whose data type is STRING.

In our example LV_CHAR is character type and we can;t simply pass it in the method call, resulting compile time error.

The general approach is to assign the character data to a string type variable and pass it in the method call, which works perfectly fine.

OUTPUT:

In stead of doing a two step process, we can directly use the CONV operator, which accepts the character data and converts it to the string.

OUTPUT:

Scenario:2
Here the CONV operator first converts the SQUAREROOT result into integer and then it is added.

OUTPUT:

Scenario:3 – Here we have a method that accepts an importing table, but in the method call we assign a table type which is little different.

Resulting compilation time error as type incompatible. In such a case we can use CONV operator. We can make the use of # operand.

OUTPUT:

Thank you for article. It was useful! You can also check my article about CONV ABAP
LikeLike