Application Development and Automation 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: 
Read only

short dumps of CL_PERS_OBJECT_DATA using Set_data method

0 Likes
687

Hi Experts,

I am getting shortdumps on the class CL_PERS_OBJECT_DATA when calling set_data method.

The error message is OBJECTS_OBJREF_NOT_ASSIGNED . There is one export parameter which of data type of "any" and mandantory.

The details of the code as follows:

data: rf_pers_object type ref to cl_pers_object_data.

types:

ty_spers_obj type spers_obj.

data: lta_personalization type table of ty_spers_obj.

call method rf_pers_object->set_data

exporting

p_pers_data = lta_personalization

p_write_through = space

exceptions

data_type_error = 1

internal_error = 2

others = 3.

if sy-subrc <> 0.

raise pers_object_error.

endif.

Could you please what exactly this means where i am missing the point.

Any adivse early is much appreciated.

Best Regards

Good_Guy

Hi Experts,

I am getting shortdumps on the class CL_PERS_OBJECT_DATA when calling set_data method.

The error message is OBJECTS_OBJREF_NOT_ASSIGNED . There is one export parameter which of data type of "any" and mandantory.

The details of the code as follows:

data: rf_pers_object type ref to cl_pers_object_data.

types:

ty_spers_obj type spers_obj.

data: lta_personalization type table of ty_spers_obj.

call method rf_pers_object->set_data

exporting

p_pers_data = lta_personalization

p_write_through = space

exceptions

data_type_error = 1

internal_error = 2

others = 3.

if sy-subrc <> 0.

raise pers_object_error.

endif.

Could you please what exactly this means where i am missing the point.

Any adivse early is much appreciated.

Best Regards

Good_Guy

2 REPLIES 2
Read only

MarcinPciak
Active Contributor
0 Likes
597

This object must be instantiated first in order you can call its instance methods.

As it has private instantiation you are able to do so only be means of create_object static method, giving the key on the input. Then you use the returned instance for further processing. This goes like


DATA: rf_pers_object TYPE REF TO cl_pers_object_data.
TYPES:
ty_spers_obj TYPE spers_obj.

DATA: pers_key TYPE spers_key.

DATA: lta_personalization TYPE TABLE OF ty_spers_obj.

"first extract the key, I took first found
SELECT SINGLE pers_key FROM spers_regt
      INTO pers_key
      WHERE lang = 'EN'.
CHECK sy-subrc = 0.

"then create the object
CALL METHOD cl_pers_object_data=>create_object
  EXPORTING
    p_pers_key = pers_key  
  RECEIVING
    r_object   = rf_pers_object.  "and receive the object instance


"now call the instance method
CALL METHOD rf_pers_object->set_data
  EXPORTING
    p_pers_data     = lta_personalization
    p_write_through = space
  EXCEPTIONS
    data_type_error = 1
    internal_error  = 2
    OTHERS          = 3.

Of course the pers_key must be provided by you. I assume you know one you want to use.

Regards

Marcin

Also refer standard program R_USER_DEFAULTS .

Edited by: Marcin Pciak on Jun 25, 2010 9:35 AM

Read only

0 Likes
597

Hi Marcin

Many thanks for kind help.

This has been resolved.

Your time and help much appreciated.

Best Regards

chandra