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: 

Using private methods of standard class

Former Member
0 Kudos
762

Hi Gurus,

I am using CL_ERP_SALES_LCM_INTERACTION class to update customer method, I have 3 questions

1. How can I pass specific value to attribute MS_Y_CUSTOMER

2. I am calling method SAVE which calling intenally other method SAVE_DB(Private method), So giving Dump.How can I avoid this dump.

3. SAVE_DB again calling methods of different class How to handle this.

Below is the my code , please help me out.

As of now I am passing the value to the Atrribute MS_Y_CUSTOMER in Debug mode.

   DATA   : OBJ TYPE REF TO CL_ERP_SALES_LCM_INTERACTION.   

CREATE OBJECT OBJ.

   CALL METHOD OBJ->SAVE
  EXPORTING
    IV_TEST_RUN     = ' '
*    IV_NO_COMMIT    = SPACE
*    IS_PHONE        =
*    IS_MOBILE       =
*    IS_FAX          =
*    IS_EMAIL        =
*    IS_WEB          =
*    IS_COMMON       =
*    IS_ADDRESS      =
*    IT_CONTACTS     =
    IT_BANKDETAIL   = lt_x_bankdetail[]
*    IS_SALESDATA    =
*    IT_TAXES        =
*    IT_VAT          =
*    IT_PFUNCTIONS   =
    IS_CHANGED_DATA = ls_changed_data
  IMPORTING
    ES_MESSAGE      = ls_message.

4 REPLIES 4

former_member184675
Active Participant
0 Kudos
149

Hi,

As far as I know you can not work with Private/Protected methods of a class. You can only address Public and Static ones.

Consider making a copy/inherit of the Standard Class into a Z one and change the methods visibility there. But usually the public/static methods of an SAP standard class should suffice in the context of the class's purpose.

-

Andrei

dirk_wittenberg
Contributor
0 Kudos
149

Hi,

1: MS_Y_CUSTOMER is filled in method LOAD_DB. As it is a private method you can't fill it directly

2: What's the error message in the dump, please provide more information

3: As SAVE_DB is a private method you shouldn't bother about it - it's private not for public. Your interface is the public method SAVE.

REgards,

Dirk

0 Kudos
149

hi Dirk,

Thanks for your response.

Below is Dump analysis: (SAVE_DB method calling another method of different class i.e

   CALL METHOD mo_maccess->debtor_exists)

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_REF_IS_INITIAL', was not

caught in

procedure "SAVE_DB" "(METHOD)", nor was it propagated by a RAISING clause.

Since the caller of the procedure could not have anticipated that the

exception would occur, the current program is terminated.

The reason for the exception is:

You attempted to use a 'NULL' object reference (points to 'nothing')

access a component (variable: "ME->MO_MACCESS").

An object reference must point to an object (an instance of a class)

before it can be used to access components.

Either the reference was never set or it was set to 'NULL' using the

CLEAR statement.

0 Kudos
149

Hi,

ME->MO_ACCESS is being instantiated in method OPEN_SESSION. Call this in your code before saving.

Regards