cancel
Showing results for 
Search instead for 
Did you mean: 

Can we read standard Change Documents in S/4HANA Cloud Public using class CL_CHDO_READ_TOOLS?

DiegoValdivia
Participant
352

Hi everyone,

In some SAP Blog posts and SAP Notes, it's mentioned to use class CL_CHDO_READ_TOOLS to read Change Document information.

Today, I created a test class to read change documents for object EINKBELEG (Purchasing Documents) and got some exception "You are not authorized to display change documents".

I did a test by reading a Custom Change Document and the code worked perfectly.

I have read all standard documentation mentioning class CL_CHDO_READ_TOOLS, but none of the pages mention any restriction related to reading Standard Change Documents.

SAP Help - Reading Change Documents 

This is my code:

CLASS zktest2 DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .

  PUBLIC SECTION.
   INTERFACES if_oo_adt_classrun.
ENDCLASS.

CLASS zktest2 IMPLEMENTATION.
  METHOD if_oo_adt_classrun~main.
    TRY.
        cl_chdo_read_tools=>changedocument_read(
          EXPORTING
            i_objectclass = 'EINKBELEG'
          IMPORTING
            et_cdredadd_tab = data(lt_cdredadd_tab)
          ).
      CATCH cx_root INTO DATA(lo_root).
        DATA(lv_message) = lo_root->get_text( ).
        out->write( lv_message ).
    ENDTRY.
  ENDMETHOD.
ENDCLASS.

has anyone faced this issue?

View Entire Topic
PrasanthPadmanabhan
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Diego,

I tried to replicate the same code which you have pasted in a Dev 080 system of SAP S/4HANA Cloud Public Edition and I am able to see that usage of this class is allowed for cloud development

PrasanthPadmanabhan_0-1721728405376.png

PrasanthPadmanabhan_1-1721728483788.png

Could you try this again?
This could also be because you do not have the roles to access the object class 'EINKBELEG'

Thanks,
Prasanth

 

 

DiegoValdivia
Participant
0 Kudos

Hi Prasanth,

Thanks for your reply.

Quick question, when you executed the class, do you receive an exception? if so, could you share a screenshot of the exception text?

PrasanthPadmanabhan
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Diego,

I did not get any exception while activating or executing the class after that. It was a straightforward implementation for me.

Thanks,
Prasanth

DiegoValdivia
Participant
0 Kudos
Thanks for your reply, Prasanth. I did a test on some On Premise 2023 system and was able to execute the class correctly. I'll investigate how identify and add the missing roles in S4 Cloud Public.