02-24-2014 11:39 AM
Hi, I would like to know if it is possible to create a method that accepts an importing parameter with a generic data type, the scenario is I need my method to accept a parameter with any "NUMERIC" data type be it integers, floats , quantities but no character types so that the developer doesnt have to create intermediate variables when calling my method he could just pass the variable from his program and the casting happens inside my method, is this possible? and if it is then how ?.
02-24-2014 4:18 PM
the scenario is I need my method to accept a parameter with any "NUMERIC" data type be it integers, floats , quantities
ABAP has the generic type NUMERIC, you could have just typed NUMERIC.
Keep these points in mind while doing generic programming - http://help.sap.com/abapdocu_740/en/abentype_formal_param_guidl.htm.
iv_param TYPE REF TO data
So you think data reference will not accept character-like actual parameters.
BR,
Suhas
02-24-2014 11:41 AM
02-24-2014 4:18 PM
the scenario is I need my method to accept a parameter with any "NUMERIC" data type be it integers, floats , quantities
ABAP has the generic type NUMERIC, you could have just typed NUMERIC.
Keep these points in mind while doing generic programming - http://help.sap.com/abapdocu_740/en/abentype_formal_param_guidl.htm.
iv_param TYPE REF TO data
So you think data reference will not accept character-like actual parameters.
BR,
Suhas
02-24-2014 4:42 PM
Hello,
I think this is a good example for your requirement.
ABAP OO - Generic class for inserting, updating and deleting records.
Thanks & Regards,
Abhijit