Wrong returncode in ZSAPLINK->DELETEOBJECTFROMNUGGET
If method ZSAPLINK->DELETEOBJECTFROMNUGGET is called with wrong parameters ( i.e. unknown object type, object not found in nugget) the part of the coding that sets the returncode isn't called.
One could argue that sending 0 as returncode is ok, because the object passed is not in the nugget any longer because is wasn't in there in the first place. But the operation of deleting an object from a nugget has failed for the same reason.
I suggest to either set the retval to a defined errorcode or even better raise an exception.
Furthermore I think the following coding could be improved by letting the called method set the returncode.
One could argue that sending 0 as returncode is ok, because the object passed is not in the nugget any longer because is wasn't in there in the first place. But the operation of deleting an object from a nugget has failed for the same reason.
I suggest to either set the retval to a defined errorcode or even better raise an exception.
Furthermore I think the following coding could be improved by letting the called method set the returncode.
if nodeName = objname.
currentNode->remove_node( ).
retVal = sy-subrc.
return.
endif.
Leave a comment