CONV – Conversion Operator

light 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.

1


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

2


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.

3


OUTPUT:

4


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.

5


OUTPUT:

6


Scenario:2 

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

7


OUTPUT:

8


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.

9


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

10


OUTPUT:

11


 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s