Skip to Content
0
Jan 25, 2023 at 01:30 PM

Unable to create an instance of cl_gui_Custom_container in RAP

29 Views

I have created one class method in DS1 100 and I am calling the same in an oData service created from RAP. ( Created custom entity cds with parameter and called the following class method in the class method of cds entity class )


The code is as follows which works fine if I execute the method stand alone. But inside odata service it is showing exception create_error as the is_init attribute of class is blank.
Please advice what needs to be done.

Code
==========
DATA: lr_container TYPE REF TO cl_gui_custom_container.
CREATE OBJECT lr_container
EXPORTING
container_name = 'SCN_WF_CON_H'

EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc <> 0.
*-->Raise Exception
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. " IF sy-subrc <> 0