Question

I tried to use the cl_ci_objectset class to reference a set of objects to run a inspection afterwards:

  data: lr_ci_objectset type ref to cl_ci_objectset.

  CALL METHOD cl_ci_objectset=>get_ref
    EXPORTING
     P_OBJSNAM                = 'ZTEST'
  RECEIVING
    p_ref                     = lr_ci_objectset
  EXCEPTIONS
  ... exception list ...
  IF sy-subrc <> 0.
    MESSAGE i005(zsci).
*   Fehler beim Ermitteln der Objektmenge
    RAISE cancel.
  ENDIF.


* Prüfen, ob es überhaupt Objekte in der SCI Objektmenge gibt
  IF lr_ci_objectset->iobjlst-objects[] IS INITIAL.
    write 'Object Menge leer'.
*   in diesem Fall kann auch nichts geprüft werden
    RETURN.
  ENDIF.

   write 'Object Menge nicht leer'.

the set 'ZTEST' is exsisting in the system as a public object set.

after more testing i found the solution.

IF lr_ci_objectset->iobjlst-objects[] IS INITIAL.

is the wrong array for a objset and is therefore used.

IF lr_ci_objectset->OBJECTSINF IS INITIAL.

is functional.

Était-ce utile?

La solution

You can't check whether "an object set is empty" that easily. Object sets can be either discrete sets of objects (just like the contents of a transport) or a set of selection criteria. The latter might or might not yield a list of objects when the selection is executed - so the resulting object list may be empty, even if the object set is not.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top