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

How to call this typical method

Former Member
0 Likes
992

Hi friends,

How are you all doing...

Can any one say how to call method 'on_costing_component_to_outtab' which belongs to the class 'cl_im__gui_itemization_ck'. Here the problem is two of this method parameters l_cl_cost_estimate & l_cl_costing_component are referred to further classes.

I declared in below faction and it is working fine when this method has normal code. Inside this method if some other class method is call then it is giving dump saying that paramether l_cl_cost_estimate & l_cl_costing_component are passed null and could not recognious until runtime. So how to make this method to work, there is one more class method called inside of this method. If i am creating objects for l_cl_cost_estimate & l_cl_costing_component then it is saying sub classes cannot be created.

Please give guidance for this so that i proceed further. Its very urgent friends.

Data: l_cl_exm_im_gui_itemization_ck TYPE REF TO cl_im__gui_itemization_ck,

l_cl_cost_estimate TYPE REF TO cl_cost_estimate,

l_cl_costing_component TYPE REF TO cl_costing_component.

create object: l_cl_exm_im_gui_itemization_ck.

CALL METHOD l_cl_exm_im_gui_itemization_ck->if_ex_gui_itemization_ck~on_costing_component_to_outtab

EXPORTING

im_execution_service = l_ck_execution_service

im_cost_estimate = l_cl_cost_estimate "class

im_costing_component = l_cl_costing_component "class

im_gui_currency = l_ck_ewknz

CHANGING

ch_outtab_line = ws_ch_outtab_line.

-


METHOD if_ex_gui_itemization_ck~on_costing_component_to_outtab.

....

...

CALL METHOD im_cost_estimate->set_state

EXPORTING

im_calc_requested = ckc_yes.

ENDMETHOD.

-


1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
918

Hello Srikanth

You cannot provide empty reference variables to the method but you need to have <b>instances </b>of CL_COST_ESTIMATE and/or CL_COSTING_COMPONENT.

The CONSTRUCTOR method of CL_COST_ESTIMATE has an optinal parameter IM_QUANTITY (of type CKBK_QUANTITY) and

CL_COSTING_COMPONENT has an optional parameter IM_QUANTITY (of type CKF_QUANTITY).

Based on your business scenario you have to provide reasonable values for these importing parameters and create instances of both classes. These instances are then "fed" to method ON_COSTING_COMPONENT_TO_OUTTAB.

Regards

Uwe

Hi friends,

How are you all doing...

Can any one say how to call method 'on_costing_component_to_outtab' which belongs to the class 'cl_im__gui_itemization_ck'. Here the problem is two of this method parameters l_cl_cost_estimate & l_cl_costing_component are referred to further classes.

I declared in below faction and it is working fine when this method has normal code. Inside this method if some other class method is call then it is giving dump saying that paramether l_cl_cost_estimate & l_cl_costing_component are passed null and could not recognious until runtime. So how to make this method to work, there is one more class method called inside of this method. If i am creating objects for l_cl_cost_estimate & l_cl_costing_component then it is saying sub classes cannot be created.

Please give guidance for this so that i proceed further. Its very urgent friends.

Data: l_cl_exm_im_gui_itemization_ck TYPE REF TO cl_im__gui_itemization_ck,

l_cl_cost_estimate TYPE REF TO cl_cost_estimate,

l_cl_costing_component TYPE REF TO cl_costing_component.

create object: l_cl_exm_im_gui_itemization_ck.

CALL METHOD l_cl_exm_im_gui_itemization_ck->if_ex_gui_itemization_ck~on_costing_component_to_outtab

EXPORTING

im_execution_service = l_ck_execution_service

im_cost_estimate = l_cl_cost_estimate "class

im_costing_component = l_cl_costing_component "class

im_gui_currency = l_ck_ewknz

CHANGING

ch_outtab_line = ws_ch_outtab_line.

-


METHOD if_ex_gui_itemization_ck~on_costing_component_to_outtab.

....

...

CALL METHOD im_cost_estimate->set_state

EXPORTING

im_calc_requested = ckc_yes.

ENDMETHOD.

-


6 REPLIES 6
Read only

Former Member
0 Likes
918

help full answers will be rewarded friends

Read only

uwe_schieferstein
Active Contributor
0 Likes
919

Hello Srikanth

You cannot provide empty reference variables to the method but you need to have <b>instances </b>of CL_COST_ESTIMATE and/or CL_COSTING_COMPONENT.

The CONSTRUCTOR method of CL_COST_ESTIMATE has an optinal parameter IM_QUANTITY (of type CKBK_QUANTITY) and

CL_COSTING_COMPONENT has an optional parameter IM_QUANTITY (of type CKF_QUANTITY).

Based on your business scenario you have to provide reasonable values for these importing parameters and create instances of both classes. These instances are then "fed" to method ON_COSTING_COMPONENT_TO_OUTTAB.

Regards

Uwe

Read only

Former Member
0 Likes
918

Hello Uwe Schieferstein,

When i am creating objects for this class cl_cost_estimate & cl_costing_component then it is giving error message sub classes are not allowed to create instances. Yet I am unable to solve this problem. If possible try to test in zprogram by call in this method.

Its not allowing me to create object in this faction.

l_cl_cost_estimate type ref to cl_cost_estimate

l_cl_costing_component type ref to cl_costing_component

then it is saying sub classes cannot be created.

Pls try this friends..

Thanks & Regards,

Chitupolu Srikanth..

Read only

Former Member
0 Likes
918

pls help out friends

Read only

Former Member
0 Likes
918

You can create instances of Class <b>cl_cost_estimate</b> using method <b>create_simple</b> or <b>create_from_db_table</b>.

This class in declared with the attribute "Creation of Instances" as Protected, so the only ways to create an Instace are declaring an Inheriting class and then use the Instance method "Constructor" or create a new class, setting <b>cl_cost_estimate</b> as a friend, and then again call the method Constructor. Otherwise, you can use static methods to get an Instance of the class, and the correct methods are those mentioned above (they return an instance of the object itself).

As Static Methods (with ret parameter), you can call these like

lr_cost_estimate = cl_cost_estimate=>create_simple( EXPORTING .... )

.

For class cl_costing_component, you can simply create an instance directly using Constructor (CREATE OBJECT <ref_obj>).

Hope this helps,

Roby.

Message was edited by:

Roberto Pagni

Read only

Former Member
0 Likes
918

DATA: l_cl_exm_im_gui_itemization_ck TYPE REF TO zcl_im__gui_itemization_ck, "MAIN CLASS

l_cl_cost_estimate TYPE REF TO cl_cost_estimate, "CLASS

l_cl_costing_component TYPE REF TO cl_costing_component. "CLASS

DATA: l_costing_variant TYPE ckf_cost_estimate_header-costing_variant,

l_costing_model TYPE ck_costmodel,

ls_organization TYPE ckf_organization,

ls_costing_dates TYPE ckf_costing_dates,

l_exttx TYPE ck_adhoc_exttx, "kk_path

ls_texts TYPE khtu.

DATA: lr_cp TYPE REF TO cl_wrap_gen_cp_ck.

CREATE OBJECT lr_cp

EXPORTING

i_kokrs = ls_organization-controlling_area

i_bukrs = ls_organization-company_code

i_werks = ls_organization-plant

i_prctr = ls_organization-profit_center

  • I_GSBER =

  • I_KALSM =

  • I_ZSCHL =

  • I_KALNR =

i_klvar = l_costing_variant

  • I_OBJNR =

i_date_of_rates = ls_costing_dates-valuation_date

i_valuation_date = ls_costing_dates-valuation_date

i_date_from = ls_costing_dates-date_from

i_date_to = ls_costing_dates-date_to

  • I_REVENUES_ALLOWED = 'X'

i_revenue_det_type = 'N' "! for this display case:don't offer DIP

i_sd_doc_for_rev = i_sd_doc_for_rev

i_posnr_sd_doc_for_rev = i_posnr_sd_doc_for_rev

i_execution_profile = '0001'

i_description_cp = l_exttx. "ls_texts

  • assign object of costing

DATA: lr_object_of_costing TYPE REF TO if_object_of_costing.

lr_object_of_costing = lr_cp.

  • create ce

DATA: lr_cost_estimate TYPE REF TO cl_cost_estimate.

CALL METHOD cl_cost_estimate=>create

EXPORTING

im_costing_variant = l_costing_variant

im_object_of_costing = lr_object_of_costing

RECEIVING

re_cost_estimate = lr_cost_estimate.

l_cl_cOST_ESTIMATE = lr_cost_estimate.

create object : l_cl_exm_im_gui_itemization_ck,

l_cl_costing_component.

CALL METHOD l_cl_exm_im_gui_itemization_ck->IF_EX_GUI_ITEMIZATION_CK~on_costing_component_to_outtab

EXPORTING

im_execution_service = c_ck_execution_service

im_cost_estimate = l_cl_cOST_ESTIMATE

im_costing_component = l_cl_costing_component

im_gui_currency = c_ck_ewknz

CHANGING

ch_outtab_line = ws_ch_outtab_line.