SAP Jobsuche bei DV-Treff
jarda51
  • jarda51
  • SAP Forum - User Thema Starter
vor 12 Jahre
Hallo,

ich bin in Objektprogramierung ganz neu. Ich habe da ein Report aus Internet, wo ein Teil fehlt. (wo " " Create instance of go_cost_obj -> required

" steht) Ich weiß nicht aber was da stehen sollte.

das steht vor dem Code:

Instantiation of class CL_COST_ESTIMATE is protected. Thus, there should always be a static "factory" method or a factory class around for instantiang.

The following coding sample shows how to to instantiate the classes required for calling your method.

Code:

REPORT zus_sdn_cost_estimate.

DATA: gd_service TYPE ck_execution_service,

gd_currency TYPE ck_ewknz,

gd_line TYPE string,

gd_cost_var type CK_KLVAR,

go_cost_obj type ref to IF_OBJECT_OF_COSTING,

go_item_cc TYPE REF TO cl_im_gui_itemization_cc,

go_estimate TYPE REF TO cl_cost_estimate,

go_component TYPE REF TO cl_costing_component.

START-OF-SELECTION.

* CREATE OBJECT go_item_cc.

" Create instance of go_cost_obj -> required

CALL METHOD cl_cost_estimate=>create

EXPORTING

* im_quantity = ckc_default_quantity

im_costing_variant = gd_cost_var

* im_valuation_date = sy-datum

* im_costing_date_from =

* im_costing_date_to =

* im_costing_version = '01'

* im_no_cost_rollup = space

* im_saving_allowed = 'x'

im_object_of_costing = go_cost_obj

* im_no_cost_estimate_ref =

receiving

re_cost_estimate = go_estimate

EXCEPTIONS

failed = 1

others = 2.

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

* CREATE OBJECT go_component

* EXPORTING

* im_quantity =

* CALL METHOD

* go_item_cc->IF_EX_GUI_ITEMIZATION_CK~ON_COSTING_COMPONENT_TO_OUTTAB

* EXPORTING

* im_execution_service = gd_service

* im_cost_estimate = go_estimate

* im_costing_component = go_component

* im_gui_currency = gd_currency

* CHANGING

* ch_outtab_line = gd_line.

END-OF-SELECTION.


Planung- und Steuerungsysteme

www.tocwithsap.com

Förderer

ahelm
vor 12 Jahre
Hallo jarda51,

die Variable go_cost_obj verweist auf ein Interface. Du musst vorab eine Klasse implementieren, die dieses Interface implementiert und von dieser Klasse ein Objekt erzeugen, das der Variable go_cost_obj zugewiesen wird.

mfg Andreas

jarda51
  • jarda51
  • SAP Forum - User Thema Starter
vor 12 Jahre
Hallo Andreas,

klappt!

Danke und Gruß

Jarda


Planung- und Steuerungsysteme

www.tocwithsap.com