‎2015 Dec 07 4:02 PM
Hey everybody, i need some help with a small feature. I want to check the actual installed version of a package. There are few systems and few different packages. The problem is i can't assume that all packages are on the system. So there are some systems with for example only one package. So i must search the packages dynamic. LV_PRODUCT_NAME is the classname of the class, which has the version information of the package. I can call the GET_VERSION method and i receive a string. RV_RELEASE_NOTE is my exporting parameter. The Problem now is that i fall constantly into the catch block. I tried a lot of things, but this is the best i had found:
METHOD get_release_notes .
DATA ls_methode TYPE tmdir.
DATA lr_class TYPE REF TO OBJECT.
DATA lv_error TYPE REF TO CX_ROOT.
ls_methode-classname = IV_PRODUCT_NAME.
ls_methode-methodname = 'get_version'.
TRY.
CREATE OBJECT lr_class TYPE (ls_methode-classname).
CALL METHOD lr_class->(ls_methode-methodname)
RECEIVING
RT_Version = RV_RELEASE_Notes.
CATCH
cx_sy_dyn_call_error INTO lv_error.
RV_RELEASE_NOTES = ls_methode-classname.
ENDTRY.
ENDMETHOD.
‎2015 Dec 07 4:57 PM
I think it all looks fine... Not sure if this matters or not:
ls_methode-methodname = 'get_version'.
I think you might need to have the method name in all caps.
ls_methode-methodname = 'GET_VERSION'.
‎2015 Dec 07 4:42 PM
Ok, i have found my issue:
the methodname was writen in small letters
PS.: And for people who are interessted, the classname was is a String.
‎2015 Dec 07 4:57 PM
I think it all looks fine... Not sure if this matters or not:
ls_methode-methodname = 'get_version'.
I think you might need to have the method name in all caps.
ls_methode-methodname = 'GET_VERSION'.