Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

cx_obl_model_error Exception in cl_binary_relation=>read_links_of_objects

1MoreDev
Explorer
0 Kudos
505

Hi, i need to get the Notes atached to a Purchase Order in my print program that is called from COR2.

But im having a problem: cl_binary_relation=>read_links_of_objects is returning the exception cx_obl_model_error.

The strange thing here is that, with the same Purchase Order if i use this method on SE24 i get the same exception, but only at the first run, if i run the method again with the same data it returns the links.

What could be the problem ?


  ls_objects-instid = p_order_num. "Purchase order number
  ls_objects-typeid = 'BUS0001'.
  ls_objects-catid = 'BO'.

  "Append the object to the object table "
  APPEND ls_objects TO lt_objects.

  "Get the links for atachments"
  try.
      cl_binary_relation=>read_links_of_objects(
        EXPORTING
          it_objects = lt_objects
        IMPORTING
          et_links_a = lt_links_a ).

    CATCH cx_obl_model_error.
    CATCH cx_obl_parameter_error.
    CATCH cx_obl_internal_error.
  ENDTRY.

Any possibilites are welcome

Regards.

1 REPLY 1

1MoreDev
Explorer
0 Kudos
176

Just in case, i tried to populate even fields that i though not obligatory and it solved my problem somehow.

Anyway if someone has some idea about why i have to populate them it is apreciated.

Now i pass the Relation type 'NOTE' and role 'GOSAPPLOBJ' and it fixed the problem.


  " Build object with document number type and category"
  ls_objects-instid = p_order_num.
  ls_objects-typeid = 'BUS0001'
  ls_objects-catid = 'BO'.
  "Append the object to the object table "
  APPEND ls_objects TO lt_objects.

  "Build the relation type table to get only notes
  wa_rel_opt-sign   = 'I'.
  wa_rel_opt-option = 'EQ'.
  wa_rel_opt-low    = 'NOTE'.
  "Append the relation type
  APPEND wa_rel_opt TO it_rel_opt.

  "Build role table for GOS
  wa_rol-sign   = 'I'.
  wa_rol-option = 'EQ'.
  wa_rol-low    = 'GOSAPPLOBJ'.

  "Append the role type
  APPEND wa_rol TO it_rol.

  "Get the links for atachments"
  TRY.
      cl_binary_relation=>read_links_of_objects(
        EXPORTING
          it_objects          = lt_objects
          it_role_options     = it_rol
          it_relation_options = it_rel_opt
        IMPORTING
          et_links_a = lt_links_a ).

    CATCH cx_obl_model_error.
    CATCH cx_obl_parameter_error.
    CATCH cx_obl_internal_error.
  ENDTRY.

Regards.