ATC Check: Suspect Conversion from Literal to ABAP Type
A recent ATC ABAP Test Cockpit tool check for code quality and code security (VCA) showed following error: Suspect Conversion from Literal to ABAP Type and with following details.
Suspect Conversions
Suspect Conversion from Literal to ABAP Type
The message can be suppressed with pseudo comment "#EC CI_CONV_OK
Or in some cases another very similar ATC error can be displayed
The literal "'XXXXXXXXXXXXXXXXX'" is not type-compatible with the formal parameter "I_BAPI_VIEW".
Results can be hidden using pragma ##LIT_COMPATIBLE
The solution I suggest in this tutorial can be used as assigning the same value to all fields of a structure dynamically without knowing the field names of the structure or the structure type code variable in your SAP developments.
The ABAP code block that catched the attention of ATC tool is following value assignment statement.
Although the code works without throwing any execution error at runtime and assigning 'X' abap_true value to each field of order_view structure, ATC tool shows this code fragment as a warning.
As mentioned in the ATC check error details, using pseudo comment "#EC CI_CONV_OK as in below ABAP code block can suppress the error.
But I think following assignment ABAP code routine is a better approach for assigning the same value, in this case the abap_true 'X' to all field values of ABAP structure type variable.
Here is the ABAP code for assigning the same value to all fields of a ABAP structure.