‎2008 Jun 12 8:05 AM
Hi firends,
I have created simple ooops report . its going dump . It is saying that "Access via 'NULL' object reference not possible." Please rectify this code.
The copde is below:
&----
*& Report YCLASS_OOPS_BANK
*&
&----
*&
*&
&----
REPORT yclass_oops_bank.
DATA: act TYPE REF TO zaccountaa.
DATA: bal TYPE i.
SELECTION-SCREEN BEGIN OF BLOCK a. .
PARAMETERS: p_amnt TYPE dmbtr,
p_dep TYPE dmbtr,
p_witd TYPE dmbtr.
SELECTION-SCREEN END OF BLOCK a.
START-OF-SELECTION.
clear act.
CALL METHOD act->set_balance( p_amnt ).
WRITE:/ 'SET BALANCE', p_amnt.
bal = act->deposit( p_dep ).
write:/ 'Deposited ', p_dep ,' bucks making balance to ', bal.
bal = act->withdraw( p_witd ).
write:/ 'Withdrew ', p_witd ,' bucks making balance to ', bal.
thnaks
vvv
‎2008 Jun 12 10:50 AM
Hi,
There are 2 problems here.
&----
*& Report YCLASS_OOPS_BANK
*&
&----
*&
*&
&----
REPORT yclass_oops_bank.
DATA: act TYPE REF TO zaccountaa.
DATA: bal TYPE i.
SELECTION-SCREEN BEGIN OF BLOCK a. .
PARAMETERS: p_amnt TYPE dmbtr,
p_dep TYPE dmbtr,
p_witd TYPE dmbtr.
SELECTION-SCREEN END OF BLOCK a.
START-OF-SELECTION.
create object act. -
> First you should create the object.
clear act. -
> This is not required.
IF act is bound. -
> In any object related code you can have a check like this to avoid dumps.
the below code is called only if act is not initial.
CALL METHOD act->set_balance( p_amnt ).
WRITE:/ 'SET BALANCE', p_amnt.
bal = act->deposit( p_dep ).
write:/ 'Deposited ', p_dep ,' bucks making balance to ', bal.
bal = act->withdraw( p_witd ).
write:/ 'Withdrew ', p_witd ,' bucks making balance to ', bal.
ENDIF.
I hope this helps.
thnaks
Saurabh
‎2008 Jun 12 8:13 AM
Hi ,
u have to add a statement Create object act. before calling method.
Because this statement creates a instanst and ref is create only when you use this statement,
Reward Points .
raj
‎2008 Jun 12 10:25 AM
DATA: bal TYPE i.
SELECTION-SCREEN BEGIN OF BLOCK a. .
PARAMETERS: p_amnt TYPE dmbtr,
p_dep TYPE dmbtr,
p_witd TYPE dmbtr.
SELECTION-SCREEN END OF BLOCK a.
START-OF-SELECTION.
DATA: act TYPE REF TO zaccountaa.
create object act.
clear act.
CALL METHOD act->set_balance( p_amnt ).
WRITE:/ 'SET BALANCE', p_amnt.
bal = act->deposit( p_dep ).
write:/ 'Deposited ', p_dep ,' bucks making balance to ', bal.
bal = act->withdraw( p_witd ).
write:/ 'Withdrew ', p_witd ,' bucks making balance to ', bal.
‎2008 Jun 12 1:39 PM
‎2008 Jun 12 10:50 AM
Hi,
There are 2 problems here.
&----
*& Report YCLASS_OOPS_BANK
*&
&----
*&
*&
&----
REPORT yclass_oops_bank.
DATA: act TYPE REF TO zaccountaa.
DATA: bal TYPE i.
SELECTION-SCREEN BEGIN OF BLOCK a. .
PARAMETERS: p_amnt TYPE dmbtr,
p_dep TYPE dmbtr,
p_witd TYPE dmbtr.
SELECTION-SCREEN END OF BLOCK a.
START-OF-SELECTION.
create object act. -
> First you should create the object.
clear act. -
> This is not required.
IF act is bound. -
> In any object related code you can have a check like this to avoid dumps.
the below code is called only if act is not initial.
CALL METHOD act->set_balance( p_amnt ).
WRITE:/ 'SET BALANCE', p_amnt.
bal = act->deposit( p_dep ).
write:/ 'Deposited ', p_dep ,' bucks making balance to ', bal.
bal = act->withdraw( p_witd ).
write:/ 'Withdrew ', p_witd ,' bucks making balance to ', bal.
ENDIF.
I hope this helps.
thnaks
Saurabh
‎2008 Aug 29 11:38 AM
creat a container object
call screen 100
after selection criteria
creat customer contorl provide name CONTAINER or some thing else and then
in top DATA container TYPE REF TO cl_gui_custom_container.
in pbo
CREATE OBJECT container
EXPORTING container_name = 'CONTAINER'.
now u can can use output in this container it can be a simple report or any thing