Forward Declaration in Class Builder
Hi All,
In the Class Builder (SE24)when i create a new Class, There is an option of Forward declaration in the Property Tab. In this, we can add Type Group Interface and Class. What is the Purpose of this forward declaration?
The F1 help does not provide any help.
Regards,
Kapil.
in addition to above replies, it can be used for classes and interfaces in that case Forward declaration is equivalent to
CLASS <class_name> DEFINITION LOAD.
interface <interface_name> load
statements which are normally used in Program ( case for local classes )
use of Load from SAP docu
... LOAD
Effect
The variant with the LOAD addition loads a global class class from the Class Library. This statement was needed before Release 6.20 if you wanted to access one of the static components of class from within a program, or to declare an event handler for class before class had been loaded automatically. From Release 6.20 onwards, the LOAD addition is only needed if the compilation of an ABAP program fails because it includes recursive accesses of a globa l class. In such cases, you may be able to make the program compilable by explicitly loading the class before recursion.
Thanks,
kranthi.
Similar Messages
-
Receiving the warning of class forward declaration
I am trying to build the Clustering Plug in project on my Leopard. I have following 2 queries -
In that project an interface class is defined as
@interface ClusteringController : NSWindowController { ....... ..... .... } @end.
And this class is used in implementation class using forward declaration as follows
@class ClusteringController;
then in one fuction it is used as follows
(long) filterImage:(NSString*) menuName {
ClusteringController *cluster = [[ClusteringController alloc] init]; [cluster showWindow:self]; return 0; }
When i try to build this project it showing a warning as follows
warning: receiver 'ClusteringController' is a forward class and corresponding @interface may not exist
Also there is 1 more warning is coming
warning: no '-updateProxyWhenReconnect' method found
This warning is coming for the following line of code
if(delegate) [delegate updateProxyWhenReconnect];
Can anybody help me to overcome these warnings?shaktirsg wrote:
And this class is used in implementation class using forward declaration as follows
@class ClusteringController;
An implementation requires an #import of the entire interface file for any class used in the code. As a rule:
Use @class when a class is used in an @interface
Use #import when a class is used in an @implementation
if(delegate) \[delegate updateProxyWhenReconnect\];
warning: no '- updateProxyWhenReconnect' method found
It looks like the compiler doesn't know the class of 'delegate'. Can we see the code that sets the 'delegate' variable? Also please let us know where updateProxyWhenReconnect is declared. Is it declared in the interface for the class to which 'delegate' belongs? If so, it might be good for us to also see that @interface file.
\- Ray -
OO ABAP - Retrieve source from Class Builder?
Hi. Is there a way to display the source code for a class or interface definition that was created with the class builder (se24).
I looked through the drop downs, but I didn't see anything to display the source.
Thanks in advance.
BrendanA class is distributed upon several includes. The Se24 in my 45b system offers to view the source via button on the bottom of the method list.
If you like you can try the following sample program also. Just paste the source and create the Pf-Status 'STA_MAIN' (line 135) and add the commands PICK(f2),Back, Exit, My_Edit(any key).
PS: double clicking on a include navigates forward ( if PICK is set to F2 ).
PPS: If you experience trouble with pasting the code and lost line termination, please paste into wordpad an save as text file.
[code]
report: Ze80Lite
created: 17.aug.2000
purpose
this report displays various informations of report-source files
Change History
#nn - dd.mmm.yyyy - Author
short description
#00 - 17.aug.2000 - KZI
initial
report Ze80Lite
no standard page heading
line-size 120
message-id sx.
*$ external types & constants =====================
*======================================================================
*$ local types ========================================================
*======================================================================
types:
typ_source type string,
typ_source_tab type standard table of typ_source,
begin of typ_file_info,
lsind type syst-lsind,
isvalid type flag,
r3state type d010sinf-r3state,
prgnam type programm,
srcnam type programm,
prgtyp type d010sinf-subc,
end of typ_file_info,
begin of typ_line_info,
flag_newline type flag,
flag_comment type flag,
text type string,
end of typ_line_info,
begin of typ_method_info,
methodname type tmdir-methodname,
methodindx type tmdir-methodindx,
end of typ_method_info,
typ_method_info_tab type standard table of typ_method_info,
typ_line_tab type standard table of typ_line_info.
selection-screen begin of block sel1 with frame title text-s01.
parameter:
p_prgnam type programm obligatory,
p_state type d010sinf-r3state default 'I',
p_typprg radiobutton group 0001 default 'X',
p_typcla radiobutton group 0001,
p_typifc radiobutton group 0001,
p_typfct radiobutton group 0001,
p_typmod radiobutton group 0001,
p_typool radiobutton group 0001.
selection-screen end of block sel1.
constants:
begin of gcr_rep,
typ_prg type i value 1,
typ_cla type i value 2,
typ_ifc type i value 3,
typ_fct type i value 4,
typ_mod type i value 5,
typ_pool type i value 6,
max_modi type syst-lsind value 5,
max_width type i value 80,
mem_prg type memoryid value 'ST22_PRGNAME',
mem_typ type memoryid value '91A', " missuse
mem_dir type memoryid value '91B', " missuse
mem_sta type memoryid value '91C', " missuse
end of gcr_rep.
data:
goa_file type standard table of typ_file_info.
=====================================================================
*$ report eventing ====================================================
=====================================================================
initialization.
perform sub_init.
at selection-screen.
perform sub_check.
start-of-selection.
perform sub_main.
at line-selection.
perform sub_click.
at user-command.
perform sub_command
using sy-ucomm.
sy-ucomm = ''.
=====================================================================
*$ subroutines ========================================================
=====================================================================
form : sub_main
purp. : main entry point for procecssing
param : <global> from selectio screen
rcode : ---
hist. : #00 - KZI - created
form sub_main.
data declaration
data:
lon_error type i,
lon_srctyp type i,
loc_srcnam type programm,
lor_file type typ_file_info.
init
set pf-status 'STA_MAIN'.
clear:
lor_file,
goa_file.
do 10 times.
append lor_file to goa_file[].
enddo.
get the type
" keep in sync with parameter, sub_check, sub_init
case 'X'.
when p_typprg.
lon_srctyp = gcr_rep-typ_prg.
when p_typcla.
lon_srctyp = gcr_rep-typ_cla.
when p_typifc.
lon_srctyp = gcr_rep-typ_ifc.
when p_typfct.
lon_srctyp = gcr_rep-typ_fct.
when p_typmod.
lon_srctyp = gcr_rep-typ_mod.
when p_typool.
lon_srctyp = gcr_rep-typ_pool.
when others.
lon_srctyp = gcr_rep-typ_prg.
endcase.
get true name
perform sub_get_srcnam
using
lon_srctyp
p_prgnam
changing
lon_error
loc_srcnam.
perform sub_dsp_source
using
p_prgnam
loc_srcnam.
the end
exit. " form
endform. "sub_main
form : sub_click
purp. : entry point for line selection
param : <global> sy-lisel
rcode : ---
hist. : #00 - KZI - created
form sub_click.
data declaration
data:
lon_error type i,
loc_prgnam type programm,
loc_srcnam type programm.
get possibly program name
if ( 0 eq lon_error ).
perform sub_get_word_from_list
changing
loc_prgnam.
if ( '' eq loc_prgnam ).
lon_error = 1.
else.
translate loc_prgnam to upper case.
endif.
endif.
get source name
if ( 0 eq lon_error ).
case loc_prgnam.
when 'METHODS'.
perform sub_dsp_methods.
when others.
perform sub_get_srcnam
using
gcr_rep-typ_prg
loc_prgnam
changing
lon_error
loc_srcnam.
if ( 0 eq lon_error ).
perform sub_dsp_source
using
loc_srcnam
loc_srcnam.
endif.
endcase.
endif.
the end
exit. " form
endform. "sub_click
form : sub_command
purp. : entry point for user command
param : ---
rcode : ---
hist. : #00 - KZI - created
form sub_command
using
value(poc_cmd) type syst-ucomm.
data declaration
data:
lon_error type i,
lon_lsind type syst-lsind,
lor_file type typ_file_info.
try to catch a valid file info
if ( 0 eq lon_error ).
read table goa_file[]
into lor_file
with key lsind = sy-lsind.
if ( 0 ne sy-subrc ).
lon_error = 1.
elseif ( 'X' ne lor_file-isvalid ).
lon_error = 1.
endif.
endif.
dispatch work
if ( 0 eq lon_error ).
case poc_cmd.
when 'MY_EDIT'.
editor-call for report lor_file-srcnam display-mode.
when 'MY_HELP'.
perform sub_dsp_help.
when others.
" nop
endcase.
endif.
endform. "sub_command
form : sub_get_word_from_list
purp. : get the word clicked on
param : <global> sy-lisel
rcode : ---
hist. : #00 - created
#01 - fixed a problem with words starting in first column
form sub_get_word_from_list
changing
prc_srcnam type programm.
data:
loc_cmp(1) type c,
lon_bgn type i,
lon_end type i,
lon_len type i.
get fundamental data
lon_len = strlen( sy-lisel ).
lon_bgn = sy-cucol.
lon_end = sy-cucol.
find begin/end of word
do.
loc_cmp = sy-lisel+lon_bgn(1).
if
'' eq loc_cmp or
'"'',.' ca loc_cmp
exit." do
endif.
lon_bgn = lon_bgn - 1.
if ( 0 GT lon_bgn ).
exit. " do
endif.
enddo.
lon_bgn = lon_bgn + 1.
do.
loc_cmp = sy-lisel+lon_end(1).
if
lon_len le lon_end or
'' eq loc_cmp or
'"'',.' ca loc_cmp
exit.
endif.
lon_end = lon_end + 1.
enddo.
lon_end = lon_end - 1.
if end >= begin give it back
if ( lon_end ge lon_bgn ).
lon_len = lon_end - lon_bgn + 1.
prc_srcnam = sy-lisel+lon_bgn(lon_len).
endif.
endform. "sub_get_word_from_list
form : sub_get_srcnam
purp. : builds sourcename according to selection screen settings
param : pon_prgtyp distinquish the various program types
pon_prgnam the program name used to build the source file
rcode : prn_error 0 success, else failure
prc_srcnam name of sourcefile
hist. : #00 - KZI - created
form sub_get_srcnam
using
value(pon_prgtyp) type i
value(poc_prgnam) type program
changing
prn_error type i
prc_srcnam type programm.
data declaration
data:
lon_error type i, " local errorflag
x type i, " simple counter
y type i, " simple counter
lor_tfdir type tfdir. " prog info tab.
build the true filename dependend on prg type
" keep this source in sync with parameter, sub_check, sub_init
case pon_prgtyp.
when gcr_rep-typ_prg.
" simple program
prc_srcnam = poc_prgnam.
when gcr_rep-typ_cla.
" class
prc_srcnam = poc_prgnam.
x = strlen( poc_prgnam ).
if ( 30 > x ).
y = 30 - x.
prc_srcnam+x(y) = '=============================='.
endif.
prc_srcnam+30(2) = 'CP'.
when gcr_rep-typ_ifc.
" interface
prc_srcnam = poc_prgnam.
x = strlen( poc_prgnam ).
if ( 30 > x ).
y = 30 - x.
prc_srcnam+x(y) = '=============================='.
endif.
prc_srcnam+30(2) = 'IP'.
when gcr_rep-typ_fct.
" function pool
concatenate
'SAPL'
poc_prgnam
into prc_srcnam.
when gcr_rep-typ_mod.
" function module
select
single *
into lor_tfdir
from tfdir
where funcname = poc_prgnam.
if ( 0 eq sy-subrc ).
concatenate
'L'
lor_tfdir-pname+4
'U'
lor_tfdir-include
into prc_srcnam.
else.
lon_error = 1.
endif.
when gcr_rep-typ_pool.
" type pool
concatenate '%_C' poc_prgnam into prc_srcnam.
when others.
" unknown type
lon_error = 1.
endcase.
the end
if ( 0 eq lon_error ).
prn_error = 0.
else.
prn_error = 1.
prc_srcnam = p_prgnam.
endif.
endform. "sub_get_srcnam
form : Sub_Dsp_Methods
purp. : displays methods of a Class
param : prc_ClassName the name of the class to display methods from
rcode :
hist. : #00 - KZI - created
form sub_dsp_methods.
data declaration
constants:
c_Num_Index type i value 35,
c_Num_Modulo type i value 36,
c_Index(37) type c
value '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ?'.
data:
lon_Fraction type i,
lon_Modulo type i,
lon_Index type i,
lon_Offset type i,
loa_methods type typ_method_info_tab,
loc_Class_Name type tmdir-classname,
loc_include_Name type programm,
lor_file type typ_file_info,
loc_Index(3) type c.
field-symbols:
<lor_method> type typ_method_info.
init &_ precheck
lor_file-isvalid = ''.
lor_file-prgtyp = ''.
lor_file-lsind = sy-lsind + 1.
modify goa_file[] from lor_file index lor_file-lsind.
read table goa_file[] index sy-lsind into lor_file.
if ( 0 ne sy-subrc or 'X' ne lor_File-isValid ).
exit.
endif.
loc_Class_Name = lor_File-PrgNam.
if ( loc_class_name cs '=' ).
loc_Class_Name = loc_class_name(sy-fdpos).
endif.
get all methods
select methodname methodindx from tmdir
into corresponding fields of table loa_methods[]
where
classname = loc_class_name AND
methodname <> ''
order by
methodindx.
if ( 0 ne sy-subrc ).
write:
'could not be loaded!'(e04),
/ 'No entry in TMDIR,' , loc_class_name.
exit.
endif.
put em on the list.
Format: Reset.
loc_Include_Name = loc_Class_Name.
concatenate
loc_Include_Name
'=================================================='
into loc_Include_Name.
loc_Include_Name+30 = 'CM'.
loop at loa_methods[] assigning <lor_method>.
loc_Index = '000'.
lon_Offset = 3.
lon_Modulo = <lor_Method>-MethodIndx mod c_Num_Modulo.
lon_Fraction = <lor_Method>-MethodIndx div c_Num_Modulo.
while ( ( lon_Fraction > 0 or lon_Modulo > 0 ) and lon_Offset > 0 ).
lon_Offset = lon_Offset - 1.
loc_Indexlon_Offset(1) = c_Indexlon_Modulo(1).
loc_Include_Name+32 = loc_Index.
lon_Modulo = lon_Fraction mod c_Num_Modulo.
lon_Fraction = lon_Fraction div c_Num_Modulo.
endwhile.
write: /
loc_include_name intensified,
at 40 <lor_method>-methodname(40).
endloop.
endform. "sub_Dsp_Methods
form : sub_Dsp_Source
purp. : loads source file from database and displays its contents
with write
param : prc_srcnam name of source piece to display
rcode : <hide> name of occasional included files
hist. : #00 - KZI - created
form sub_dsp_source
using
value(poc_prgnam) type programm
value(poc_srcnam) type programm.
data declaration
data:
lon_error type i,
lon_warn type i,
loa_source type standard table of typ_source,
loa_lines type typ_line_tab,
loc_line type string,
loc_print type string,
lon_tmp type i,
lon_tabix type syst-tabix,
lor_d010sinf type d010sinf,
lor_file type typ_file_info.
field-symbols:
<lof_source> type typ_source,
<lof_line> type typ_line_info.
init &_ precheck
format:
reset.
if ( gcr_rep-max_modi lt sy-lsind ). " limit modes
sy-lsind = gcr_rep-max_modi.
endif.
lor_file-srcnam = poc_srcnam.
lor_file-prgnam = poc_prgnam.
lor_file-lsind = sy-lsind + 1.
lor_file-r3state = p_state.
poc_srcnam = ucase( poc_srcnam ).
check existance
if ( 0 eq lon_error ).
select *
from d010sinf up to 1 rows
into lor_d010sinf
where
prog = poc_srcnam
order by
r3state
cdat.
if ( lor_d010sinf-r3state eq p_state ).
exit. " loop
endif.
endselect.
if ( 0 ne sy-subrc ).
lon_error = 1.
write:
'could not be loaded!'(e04),
/ 'No entry in D010SINF,' , poc_srcnam.
endif.
endif.
get report text
if ( 0 eq lon_error ).
read report poc_srcnam into loa_source[] state p_state.
if ( 0 ne sy-subrc and 'I' eq p_state ).
read report poc_srcnam into loa_source[] state 'A'.
lon_warn = 1.
endif.
if ( 0 ne sy-subrc ).
lon_tmp = strlen( poc_srcnam ).
write: / 'Program'(e01).
format inverse on. format color col_negative on.
write at (lon_tmp) poc_srcnam.
format inverse off. format color col_negative off.
write: /
'Cannot load source info, sy-subrc= '(e02),sy-subrc.
endif.
endif.
create display
if ( 0 eq lon_error ).
perform sub_dsp_source_lines
using
poc_prgnam
0
0
loa_source[]
changing
lon_error.
endif.
update internal memory
if ( 0 eq lon_error ).
lor_file-isvalid = 'X'.
if ( 0 eq lon_warn ).
lor_file-r3state = p_state.
else.
lor_file-r3state = 'A'.
endif.
lor_file-prgtyp = lor_d010sinf-subc.
else.
lor_file-isvalid = ''.
lor_file-prgtyp = ''.
endif.
modify goa_file[] from lor_file index lor_file-lsind.
the end
if ( 0 ne lon_warn ).
message s777 with
'There is no inactive version => no upload possible!'(i01).
endif.
exit. " form
endform. "sub_dsp_source
form : sub_dsp_source_lines
purp. : loads source file from database and displays its contents
with write
param : poc_prgnam name of source piece to display
pra_source source to display
rcode : prn_error 0 success
hist. : #00 - KZI - created
form sub_dsp_source_lines
using
value(poc_prgnam) type programm
value(pon_lwr_ndx) type i
value(pon_upr_ndx) type i
pra_source type typ_source_tab
changing
prn_error type i.
data declaration
data:
lon_Strlen type i,
lon_Tabix(5) type n,
loa_lines type typ_line_tab,
loc_line type string,
lon_error type i,
lon_tmp type i,
lon_lwr_ndx type syst-tabix,
lon_upr_ndx type syst-tabix.
field-symbols:
<lof_source> type typ_source,
<lof_line> type typ_line_info.
init &_ precheck
format:
reset.
lon_error = 0.
describe table pra_source[] lines lon_tmp.
if ( 1 gt pon_lwr_ndx or lon_tmp lt pon_lwr_ndx ).
lon_lwr_ndx = 1.
else.
lon_lwr_ndx = pon_lwr_ndx.
endif.
if ( 1 gt pon_upr_ndx or lon_tmp lt pon_upr_ndx ).
lon_upr_ndx = lon_tmp.
else.
lon_upr_ndx = pon_upr_ndx.
endif.
create display
if ( 0 eq lon_error ).
format: reset.
loop at pra_source[]
assigning <lof_source>
from lon_lwr_ndx
to lon_upr_ndx.
lon_tabix = syst-tabix.
loc_line = <lof_source>.
perform sub_cut_text_comment
using
loc_line
'X'
changing
loa_lines[].
loop at loa_lines[] assigning <lof_line>.
if ( 'X' eq <lof_line>-flag_newline ).
if ( 0 ne lon_tabix ).
write:
/(5) lon_tabix intensified color col_normal.
else.
write:
/(5) ' .' intensified color col_normal.
endif.
write at 6 ''.
lon_tabix = 0.
endif.
lon_Strlen = strlen( <lof_Line>-Text ).
if ( 'X' eq <lof_line>-flag_comment ).
write: at (lon_Strlen)
<lof_line>-text intensified no-gap.
else.
write: at (lon_Strlen)
<lof_line>-text no-gap.
endif.
endloop.
endloop.
endif.
the end
if ( 0 ne lon_error ).
prn_error = 1.
else.
prn_error = 0.
endif.
exit. " form
endform. "sub_dsp_source_lines
form : sub_chk_input
purp. : (en) validate input data
(de) validieren der eingabewerte
param : ---
rcode : ---
hist. : #00 - initial
form sub_dsp_help.
data declaration
data:
lon_error type i,
loa_tline type standard table of tline,
loc_docnam type syst-repid.
show help about ?
if ( 0 eq lon_error ). " Help
loc_docnam = sy-repid.
call function 'HELP_OBJECT_SHOW'
exporting
dokclass = 'RE'
dokname = loc_docnam
tables
links = loa_tline[]
exceptions
object_not_found = 1
sapscript_error = 2
others = 3.
if ( 0 ne sy-subrc ).
lon_error = 1.
message w777 with 'No Help Available'(w00).
sy-subrc = 0.
endif.
endif.
endform. "sub_dsp_help
form : sub_init
purp. : initializes the selection screen
param : ---
rcode : ---
hist. : #00 - KZI - created
form sub_init.
data declaration
data:
loc_memory(256) type c,
lon_memory type i.
memory id logic
" get prog
get parameter id gcr_rep-mem_prg field p_prgnam.
if ( 0 ne sy-subrc or '' eq p_prgnam ).
p_prgnam = sy-repid.
endif.
set parameter id gcr_rep-mem_prg field p_prgnam.
" get prog type ( keep in sync with parameters sub_check and
" sub_get_srcnam )
get parameter id gcr_rep-mem_typ field loc_memory.
condense loc_memory.
loc_memory = loc_memory(4).
if ( loc_memory co ' 0123456789' ).
lon_memory = loc_memory.
else.
lon_memory = gcr_rep-typ_prg.
endif.
clear:
p_typcla,
p_typfct,
p_typifc,
p_typmod,
p_typool,
p_typprg.
case lon_memory.
when gcr_rep-typ_prg.
p_typprg = 'X'.
when gcr_rep-typ_cla.
p_typcla = 'X'.
when gcr_rep-typ_ifc.
p_typifc = 'X'.
when gcr_rep-typ_fct.
p_typfct = 'X'.
when gcr_rep-typ_mod.
p_typmod = 'X'.
when gcr_rep-typ_pool.
p_typool = 'X'.
when others.
" default
p_typprg = 'X'.
endcase.
" get status ( keep in sync with sub check ).
get parameter id gcr_rep-mem_sta field p_state.
if ( 'A' ne p_state ).
" only 'I' or 'A' is allowed
p_state = 'I'.
endif.
set parameter id gcr_rep-mem_sta field p_state.
endform. "sub_init
form : sub_check
purp. : at the selection screen
param : ---
rcode : ---
hist. : #00 - KZI - created
form sub_check.
data declaration
data:
loc_memory(4) type c,
lon_rcode type i.
memory id handling
case p_state.
when 'A' or 'I'.
" ok
when others.
message e777 with
'Only ''A'' and ''I'' are allowed for state'(se1).
endcase.
set parameter id gcr_rep-mem_prg field p_prgnam.
set parameter id gcr_rep-mem_sta field p_state.
" multiple choice
" keep in sync with parameters and sub_check, sub_main
case 'X'.
when p_typprg.
loc_memory = gcr_rep-typ_prg.
when p_typcla.
loc_memory = gcr_rep-typ_cla.
when p_typifc.
loc_memory = gcr_rep-typ_ifc.
when p_typfct.
loc_memory = gcr_rep-typ_fct.
when p_typmod.
loc_memory = gcr_rep-typ_mod.
when p_typool.
loc_memory = gcr_rep-typ_pool.
when others.
" if bugfree this should never happen, sync source if you
" expierience this source to be executed
loc_memory = gcr_rep-typ_prg.
endcase.
if ( '' ne loc_memory ).
set parameter id gcr_rep-mem_typ field loc_memory.
endif.
endform. "sub_check
form : sub_split_comment
purp. : splits a line into a comment and command part.
param : poc_line to source line
poc_command the command part
poc_comment the comment part
rcode : <hide> name of occasional included files
hist. : #00 - KZI - created
form sub_split_comment
using
value(poc_line) type typ_source
changing
prc_command type typ_source
prc_comment type typ_source.
data declaration
data:
loc_First_Char(1) type c,
lon_len_old type i,
lon_len_new type i,
lon_pos_cmt type i,
loc_buf1 type string,
loc_buf2 type string,
loc_cmtbuf(240) type c.
init & precheck
clear:
prc_command,
prc_comment.
computation
loc_First_Char = poc_Line.
if ( '*' eq loc_First_Char ).
prc_command = ''.
prc_comment = poc_line.
else.
if ( poc_line ca '"' and poc_line np '''"''' ).
split poc_line at '"' into loc_buf1 loc_buf2.
if ( '' eq loc_buf1 ).
prc_command = ''.
prc_comment = poc_line.
else.
lon_len_old =
strlen( poc_line ).
lon_len_new =
strlen( loc_buf1 ) +
strlen( loc_buf2 ).
lon_pos_cmt = lon_len_old - lon_len_new - 2.
if ( 0 gt lon_pos_cmt or 240 lt lon_pos_cmt ).
lon_pos_cmt = 0.
endif.
loc_cmtbuf+lon_pos_cmt = '"'.
prc_command = loc_buf1.
concatenate loc_cmtbuf loc_buf2 into prc_comment.
endif.
else.
prc_command = poc_line.
prc_comment = ''.
endif.
endif.
the end
exit. " form
endform. "sub_split_comment
form : sub_cut_text_comment
purp. : splits a line into a comment and command part.
param : poc_line to source/text line
poc_cmt 'X' chk for comments
rcode : pra_lines filled with line info ( reset )
hist. : #00 - KZI - created
form sub_cut_text_comment
using
value(poc_line) type string
value(poc_cmt_check) type flag
changing
pra_lines type typ_line_tab.
data declaration
data:
loc_buf1 type string,
loc_buf2 type string,
loc_comment type string,
loc_command type string.
data:
loc_First_Char(1) type c,
loc_new_line type flag,
lon_cur_pos type i,
lon_new_pos type i.
init & precheck
clear:
pra_lines[],
loc_command,
loc_comment.
computation
loc_First_Char = poc_Line.
if ( '' eq poc_cmt_check or '' eq poc_line ).
loc_command = poc_line.
loc_comment = ''.
else.
if ( '*' eq loc_First_Char ).
loc_command = ''.
loc_comment = poc_line.
else.
if ( poc_line ca '"' and poc_line np '''"''' ).
split poc_line at '"' into loc_buf1 loc_buf2.
if ( '' eq loc_buf1 ).
loc_command = ''.
loc_comment = poc_line.
else.
loc_command = loc_buf1.
concatenate '"' loc_buf2 into loc_comment.
endif.
else.
loc_command = poc_line.
loc_comment = ''.
endif.
endif.
endif.
cvt text
lon_cur_pos = 0.
loc_new_line = 'X'.
if ( '' ne loc_command ).
perform sub_cut_text_width
using
loc_command
loc_new_line
lon_cur_pos
gcr_rep-max_width
changing
pra_lines[]
lon_new_pos.
lon_cur_pos = lon_new_pos.
loc_new_line = ''.
endif.
if ( '' ne loc_comment ).
perform sub_cut_text_width
using
loc_comment
loc_new_line
'X'
lon_cur_pos
gcr_rep-max_width
changing
pra_lines[]
lon_new_pos.
lon_cur_pos = lon_new_pos.
loc_new_line = ''.
endif.
if ( '' ne loc_new_line ).
perform sub_cut_text_width
using
loc_new_line
lon_cur_pos
gcr_rep-max_width
changing
pra_lines[]
lon_new_pos.
lon_cur_pos = lon_new_pos.
loc_new_line = ''.
endif.
the end
exit. " form
endform. "sub_cut_text_comment
form : sub_cut_text_width
purp. : splits text info into several lines to make them
fit to a max-width
param : poc_line to source/text line
poc_cmt 'X' chk for comments
rcode : pra_lines appended ( no reset ) line info.
hist. : #00 - KZI - created
form sub_cut_text_width
using
value(poc_text) type string
value(poc_new_line) type flag
value(poc_typ_cmt) type flag
value(pon_cur_pos) type i
value(pon_max_width) type i
changing
pra_lines type typ_line_tab
prn_new_pos type i.
data declaration
data:
lor_text_info type typ_line_info,
lon_cnt_loop type i,
lon_tmp type i,
lon_pos_cur type i,
lon_len_cur type i,
loc_buf_cur type string,
loc_new_line type flag.
init & precheck
loc_buf_cur = poc_text.
loc_new_line = poc_new_line.
lon_pos_cur = pon_cur_pos.
do.
if ( '' eq loc_buf_cur and '' eq loc_new_line or
1000 lt lon_cnt_loop ).
exit. " do
else.
lon_cnt_loop = lon_cnt_loop + 1.
clear:
lor_text_info.
lor_text_info-flag_comment = poc_typ_cmt.
if ( '' ne loc_new_line ).
loc_new_line = ' '.
lor_text_info-flag_newline = 'X'.
lon_pos_cur = 0.
endif.
lon_len_cur = strlen( loc_buf_cur ).
lon_tmp = lon_pos_cur + lon_len_cur.
if ( lon_tmp le pon_max_width ).
" all fits in currentline
lor_text_info-text = loc_buf_cur.
loc_buf_cur = ''.
lon_pos_cur = lon_pos_cur + lon_len_cur.
else.
" we need to split
lon_tmp = pon_max_width - lon_pos_cur.
if ( 0 gt lon_tmp ).
" should not happen
lor_text_info-text = loc_buf_cur.
loc_buf_cur = ''.
else.
lor_text_info-text = loc_buf_cur(lon_tmp).
loc_buf_cur = loc_buf_cur+lon_tmp.
endif.
lon_pos_cur = 0.
loc_new_line = 'X'.
endif.
append lor_text_info to pra_lines[].
endif.
enddo.
the end
prn_new_pos = lon_pos_cur.
exit. " form.
endform. "sub_cut_text_width
[/code] -
What are the uses of declaring a class "final"?
Can any one please tell me the uses of declaring a class "final"?
I know that final classes cannot be extended. Other than this,
Is there any thing that will improve the compiler time for the final classes?compiler performance is utterly unimportant anyway...
If the compiler takes too long, just get a faster build system :) -
Defining attribute for internal table within class builder?
Hello there,
I use an function module that provides me an internal table which has the reference type of the DDIC object zml_output. Furthermore I call this function module within a global class that should keep the result of the function module into the attribute lt_result, that is declared as private and typed with
lt_result TYPE zml_output.
Even the definition of that attribute causes the following error message:
"lt_result" is not an internal table.
I don't have any clue how to type lt_result differently. Actually I would need the following type of typing "TYPE TABLE OF" but that does not exist within the class builder.
Thanks for your help in advanced!
RobertHi Konstantinidis ...
Of course I can provide it to you. The code of my methode load_data reads as follows:
method LOAD_DATA.
CALL FUNCTION 'ZDATAGET'
EXPORTING
iv_dat = iv_dat
iv_time1 = iv_time1
iv_delta = iv_delta
TABLES
et_result = lt_result.
endmethod.
Especially the lt_result causes the mentioned error message
The compiler seems to expect something "TABLE" like for attribute lt_result. But whatever I tried it doesn't seem to work out.
Many thanks for help... -
hi,
i hv a doubt in a class builder.
i tried to to use static attribute inside a method.but that attribute couldnt store the last value when again it used in another method .hw can i solve this problem.hi
hope it will help you.
Reward if help.
Classes and Interfaces
This section describes the definition of classes and interfaces and of their components. Classes and interfaces form the basis for ABAP Objects, the object-oriented part of the ABAP language. Classes and interfaces can be defined in ABAP programs of the following program types:
In a class pool, you use the Class Builder tool of the ABAP Workbench to define exactly one global class of the class library, which can then be used in all other ABAP programs. In the global declaration section of a class pool, you can individually define local data types, classes and interfaces to tbe used in the class pool and make type groups known. Apart from the TYPES and TYPE-POOLS statements, in class pools no other statements are allowed outside of classes and interfaces.
In an interface pool, you use the Class Builder tool of the ABAP Workbench to define exactly one global interface of the class library to be used in all other ABAP programs. In the global declaration section of an interface pool, you are not allowed to define local data types, classes and interfaces. You can declare type groups. Apart from the statement TYPE-POOLS, in interface pools no other statements are allowed outside of the global interfaces.
In all other ABAP programs, except type groups, you can define local classes and interfaces to be used in the program itself.
Apart from the TYPES and TYPE-POOLS statements, in class and interface pools no other statements are allowed outside of CLASS - ENDCLASS or INTERFACE - ENDINTERFACE. -
Class builder - attributes access in methods
Hi All,
I have created a class ZZ_CL_ABC and its methods :
ZZ_M1
ZZ_M2
in method ZZ_M1, one table gets filled up ITAB and I want to access this ITAB in the ZZ_M2.
These methods are getting called from one report
DATA I_ZZ_CL_ABC TYPE REF TO ZZ_CL_ABC .
CREATE OBJECT I_ZZ_CL_ABC .
call method I_ZZ_CL_ABC->zz_M1
exporting
imat = imat.
call method I_ZZ_CL_ABC->zz_M2.
Now I want to access the ITAB which gets filled up in method ZZ_M1 and I want to access that in ZZ_M2, when ZZ_M2 gets called through the program.
rgds,
Madhuri
Edited by: Matt on Sep 9, 2011 6:11 AM - changed tags to lower caseI have created a class through class builder zcl_material.
in it I have written 2 methods:
get_material
get_quantity
in method get_material, the materials are getting stored in table it_material.
in method get_quantity, the quantity for materials in it_quantiry, for materials present in the it_material table is calculated
Now I am using this class in one report and calling its methods
get_material : select * from mara into it_material.
get_quantity : select * from mard in it_quantity for all entries in it_material.
The it_material table, I dont want to pass to the report. So what i did is, I declared this table in the attributes tab of the class builder with level instance and visibility as private.
after calling method get_material, the data is present in the it_material.
but when I am calling the method get_quantity, in the select query, the it_material is blank???
So how should I define any variable/ table so that it will be present till the class object is there????
is it possible through class builder->attribute? -
Forward Declaration and "this" keyword
Consider this code:
class A {
private int i = 2 * this.j; // This will be calculated as 2 * 0 = 0
// private int i = 2 * j; //This code will not compile
private int j = 20;
}Why the "this" keyword is required for the j to be accessible? Though it is a forward declaration, what is the significance of "this" which gives visibility to the variable j. Please give some light to this.Though it is a forward declaration, what is the significance of "this" which gives
visibility to the variable jI don't think "this" alters the visibility of j: that is the instance variable j is in scope. However "Use of instance variables whose declarations appear textually after the use is sometimes restricted, even though these instance variables are in scope."
See "8.3.2.3 Restrictions on the use of Fields during Initialization" http://java.sun.com/docs/books/jls/third_edition/html/classes.html#287410
Using "this" you have a reference to the object being constructed with the j instance variable sill having its default value of zero.
Such instance initialisers would appear to be inherently less intelligible than using a constructor. -
Hi Experts,
Please let me know the use of forward declaration for a class. How to use that?
Thanks and Regards,
DebarshiHi,
Absolutely true matt...
you use forward declaration when you want to indicate that this component will be defined later but i am referring to this as of now.
so that it does not give any syntax/ run time error.
Rgds/Abhi -
Class Builder - Internal types
Hi,
I'm inside class Builder in SE80.
Is it possible to pass/declare internal types between methods inside my class.
(I don't want to put it into my data dictionary)
I would like to pass this structure between methods in my class.
types: begin of t_PriceStruct,
X_A004_MATNR type A004-MATNR,
X_A004_VTWEG type A004-VTWEG,
end of t_PriceStruct.
Any pointers ? Howto document ?
//MartinHi,
Thx for that. But I still have problem ...
Tells me that "I_PRICETAB" is not type-compatible with formal parameter "PRICE_INOUT"
I want to pass a internal table and fill it and then return it to the caller.
method GETPRICEZERO .
data: i_PriceTab type table of t_PriceStruct.
call method me->getpricecondition
exporting
vkorg_in = '3100'
date_in = sy-datum
changing
price_inout = i_PriceTab
endmethod.
LOCAL TYPE
types: begin of t_PriceStruct,
X_A004_MATNR type A004-MATNR,
X_A004_VTWEG type A004-VTWEG,
end of t_PriceStruct.
//MA -
Internal Types in Class Builder
Hi Guys,
In am trying to add an internal type to a standard class in <b>Class Builder</b>. I have created a type with Ctrl + F5, But am not sure what to do next. Could any one plz explain me what are all the steps involved?
Thanks in Advance.
Regards,
Rajesh.Hello Rahesh,
I assume you try to add a new type definition. The possibilties there depend on the release of your system.
In release 4.x - 6.20 you can only define types in the protected and private section. Any definition can be used within any method coding. The use of these types within member or method declaration is of course limitied to private or protected ones. You can refer to the types by their name (like to types defined in forms).
With release 6.40 or higher you can also define types in interfaces and the public section of classes. So they are part of the API of the class and can be also used outside. This can be done by following syntax:
data: test_Data type cl_My_Class=>ty_Char_40.
So in effect you may use an interface definition as a new kind of type-pool.
Best Regards
Klaus -
I am new to ABAP. I tried creating abstract class and found that class builder allows development of abstract final class. What is the use of such class in ABAP?
Hi,
Does not compile:
This one do:
Inheritance:
Regards. -
To use logical database PNP in class builder
Hi
Inside the class builder (SE24), i have a created a method.
Now while implementing that method, that is between method and endmethod
statement can i implement logical database PNP or PNPCE.
If 'yes' how to use it.
if 'no' what is the other way to implement authorization.
Pls help meHello,
assume that the routines GET_ITnnnn are written by yourself. For reading infotypes ABAP Objects provides us with same very helpful classes as shown below:
* define data
DATA:
gif_employee type ref to if_pt_employee,
go_employee type ref to cl_pt_employee,
gt_infotypes TYPE tim_tmw_itlist_tab,
go_control TYPE REF TO if_pt_td_control,
go_data TYPE REF TO if_pt_td_base,
go_pnnnn TYPE REF TO if_pt_td_itnnnn,
gt_p0001 TYPE TIM_P0001_TAB,
gt_p0002 TYPE TIM_P0002_TAB,
gt_p0003 TYPE TIM_P0003_TAB.
start-of-selection.
GET pernr.
<b>* Create employee instance</b>
gif_employee = cl_pt_employee=>get_employee( pernr ).
go_employee ?= gif_employee.
<b>* Get master infotypes (0001, 0002)</b>
CALL METHOD go_employee->get_master_data
EXPORTING
im_begda = id_fromdate
im_endda = id_todate
IMPORTING
* EX_I0000 =
EX_I0001 = gt_p0001
EX_I0002 = gt_p0002
* EX_I0007 =
* EX_I0008 =
<b>* Append all other required infotypes to itab</b>
APPEND '0003' TO gt_infotypes.
CALL METHOD go_employee->get_infotypes
EXPORTING
i_itlist = gt_infotypes
i_fromdate = id_fromdate " start date
i_todate = id_todate " end date
* I_FILTER =
i_noauthcheck = 'X'
IMPORTING
e_result = gt_infty_request
e_retcd = gd_retcd.
* Please see documentation of parameter e_retcd...
LOOP AT gt_infty_request INTO go_control.
go_data = go_control->data. <b>" get data object</b>
* Casting
TRY.
go_pnnnn ?= go_data.
CATCH cx_sy_move_cast_error.
CONTINUE.
ENDTRY.
<b>* Convert infotype (semi-transparent -> transparent)</b>
CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
EXPORTING
prelp = lo_pnnnn->prelp
IMPORTING
pnnnn = gs_p0003.
APPEND gs_p0027 TO gt_p0003.
ENDLOOP.
The class CL_PT_EMPLOYEE provides us already with very easy access to so-called master infotypes (000, 0001, 0002, 0007 and 0008). All other infotypes can be read using method GET_INFOTYPES.
Using these classes we have a very convenient and standardized way of accessing all kinds of infotypes.
Vasanth -
How do I troubleshoot Class Build tests?
Hi I'm new to Oracle Data Mining and I am using the SQL Developer GUI to do a few concept proofs. I was able to go through the tutorials successfully - however when I use my own data I am running into the following message on the Class Build node during the Test phase of the model build.
Message:
Test failed due to ORA-00910: specified length too long for its datatype .
Detail:
ORA-06512: at "ODMRSYS.ODMR_ENGINE_MINING", line 1643 ORA-06512: at "ODMRSYS.ODMR_ENGINE_MINING", line 1986
Any ideas what might be wrong? What's the best way to find what's causing the error?
Any assistance anyone could provide would be greatly appreciated.
Edited by: Chris Bentley on Jun 3, 2013 4:57 PMThanks Mark for responding...
I'm using
SQL Developer version 3.2.20.09 on
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
Yes the models were built successfully...I'll try to pass the models into a Apply node and score them.
Here's a describe of my input source..prior to building a Text transform on the CHIEF_COMPLAINT field.
TABLE pop_visit_info
Name Null? Type
KIDS_VISIT_ID NOT NULL NUMBER(20)
KIDS_PAT_ID NUMBER(20)
HOSP_ACCT_ID NUMBER(20)
CLINICAL_INPATIENT_YN NUMBER(1)
OUTPATIENT_YN NUMBER(1)
ED_YN NUMBER(1)
SURGICAL_YN NUMBER(1)
OBSERVATION_YN NUMBER(1)
ICU_YN NUMBER(1)
CICU_YN NUMBER(1)
PICU_YN NUMBER(1)
NICU_YN NUMBER(1)
VISIT_START_DATE NOT NULL DATE
VISIT_START_TIME NOT NULL NUMBER(4)
VISIT_STOP_DATE NOT NULL DATE
VISIT_STOP_TIME NOT NULL NUMBER(4)
LENGTH_OF_STAY_DAYS NUMBER(4)
LENGTH_OF_STAY_HRS NUMBER(8,2)
DSCH_DISPO VARCHAR2(100)
VISIT_ADDRESS_1 VARCHAR2(100)
VISIT_ADDRESS_2 VARCHAR2(100)
VISIT_CITY VARCHAR2(50)
VISIT_STATE VARCHAR2(12)
VISIT_ZIP VARCHAR2(10)
VISIT_COUNTY VARCHAR2(50)
VISIT_START_AGE_DAYS NUMBER(5)
VISIT_START_AGE_WEEKS NUMBER(4)
VISIT_START_AGE_MONTHS NUMBER(4)
VISIT_START_AGE_YEARS NUMBER(3)
VISIT_STOP_AGE_DAYS NUMBER(5)
VISIT_STOP_AGE_WEEKS NUMBER(4)
VISIT_STOP_AGE_MONTHS NUMBER(4)
VISIT_STOP_AGE_YEARS NUMBER(3)
FACILITY VARCHAR2(2)
FIRST_DEPT VARCHAR2(255)
LAST_DEPT VARCHAR2(255)
FIRST_HOSP_SVC VARCHAR2(100)
LAST_HOSP_SVC VARCHAR2(100)
PRIMARY_PAYOR VARCHAR2(50)
FIN_CLASS VARCHAR2(50)
NEXT_KIDS_VISIT_ID NUMBER(20)
PREV_KIDS_VISIT_ID NUMBER(20)
VENTILATOR_YN NUMBER(1)
CVVH_YN NUMBER(1)
CODE_YN NUMBER(1)
PEWS_GTE_6_YN NUMBER(1)
RESEARCH_STUDY_YN NUMBER(1)
ECMO_YN NUMBER(1)
DIALYSIS_YN NUMBER(1)
DECEASED_YN NUMBER(1)
VENTILATOR_DAYS NUMBER(5)
LINE_DAYS NUMBER(5)
RECORD_DELETED_YN NUMBER(1)
UPDATE_DTM DATE
VISIT_START_DTM DATE
VISIT_STOP_DTM DATE
NEXT_IP_ED_IC_KIDS_VISIT_ID NUMBER(20)
PREV_IP_ED_IC_KIDS_VISIT_ID NUMBER(20)
IMMEDIATE_CARE_YN NUMBER(1)
VISIT_SEQ NUMBER(6)
ADMISSION_SOURCE VARCHAR2(100)
TRANSFER_SOURCE VARCHAR2(100)
DISCHARGE_DESTINATION VARCHAR2(100)
CHIEF_COMPLAINT VARCHAR2(1000)
VISIT_COUNTRY VARCHAR2(50)
FINANCIAL_CLASS_GROUP VARCHAR2(50)
ED_LENGTH_OF_STAY_HRS NUMBER(8,2)
ICU_LENGTH_OF_STAY_HRS NUMBER(8,2)
INPATIENT_LENGTH_OF_STAY_HRS NUMBER(8,2)
URGENT_CARE_LENGTH_OF_STAY_HRS NUMBER(8,2)
ED_LENGTH_OF_STAY_DAYS NUMBER(6,2)
ICU_LENGTH_OF_STAY_DAYS NUMBER(6,2)
INPATIENT_LENGTH_OF_STAY_DAYS NUMBER(6,2)
URGENT_CARE_LENGTH_OF_STAY_DYS NUMBER(6,2)
CC_FEVER_YN NUMBER(1)
CC_COUGH_YN NUMBER(1)
CC_SORE_THROAT_YN NUMBER(1)
ILI_YN NUMBER(1)
NEUROSURGERY_YN NUMBER(1)
APR_DRG NUMBER(3)
APR_DRG_ASTHMA_YN NUMBER(1)
APR_DRG_SICKLE_CELL_YN NUMBER(1)
APR_DRG_DIABETES_YN NUMBER(1)
APR_DRG_VENT_SHUNTS_YN NUMBER(1)
CASE_MGT_ADM_PLANNED_YN NUMBER(1)
CASE_MGT_ADMITS_PAST_12_MONTHS VARCHAR2(30)
CASE_MGT_ADM_PAST_30_DAYS_YN NUMBER(1)
CASE_MGT_ED_VISIT_PAST_72HR_YN NUMBER(1)
HB_TOT_CHGS NUMBER(22)
APR_DRG_CHEMO_YN NUMBER(1)
APR_DRG_REHAB_YN NUMBER(1)
RETURN_PREV_KIDS_VISIT_ID NUMBER(20)
RETURN_48_HR_YN NUMBER(1)
RETURN_72_HR_YN NUMBER(1)
RETURN_7_DAY_YN NUMBER(1)
RETURN_30_DAY_YN NUMBER(1)
READMIT_PREV_KIDS_VISIT_ID NUMBER(20)
READMIT_48_HR_YN NUMBER(1)
READMIT_72_HR_YN NUMBER(1)
READMIT_7_DAY_YN NUMBER(1)
READMIT_30_DAY_YN NUMBER(1)
VISIT_REASON VARCHAR2(2000)
ED_DISPO VARCHAR2(50)
FIRST_INPATIENT_BED_DATE DATE
FIRST_INPATIENT_BED_TIME NUMBER(4)
FIRST_INPATIENT_BED_DTM DATE
DISMISSED_YN NUMBER(1)
DX_TYPE NOT NULL VARCHAR2(50)
DX_RANK NOT NULL NUMBER(3)
KIDS_DX_ID NUMBER(20)
DX_PRESENT_ON_ADMIT_YN NUMBER(1)
DX_PRESENT_ON_ADMIT_UNKNOWN_YN NUMBER(1)
DX_PRESENT_ON_ADMIT_EXEMPT_YN NUMBER(1)
DX_CODE VARCHAR2(15)
DX_NAME VARCHAR2(255)
DX_DESCRIPTION VARCHAR2(500)
DX_CODING_SYSTEM VARCHAR2(20)
EPIC_DX_ID NUMBER(10)
REASON_RANK NUMBER(3)
REASON VARCHAR2(100)
NOTE VARCHAR2(1000) -
Use of Friend class in Class builder
HI
Can someone tell me how to use a friend class In class Builder
SRidharHi,
Please check this link
http://help.sap.com/saphelp_nw04/helpdata/en/b5/693ec8185011d5969b00a0c94260a5/frameset.htm
Defining Relationships Between Object Types
http://help.sap.com/saphelp_nw04/helpdata/en/ca/c035b7a6c611d1b4790000e8a52bed/frameset.htm
Examples
http://help.sap.com/saphelp_nw04/helpdata/en/47/5f643a7c5dd813e10000000a114084/frameset.htm
Best regards,
raam
Maybe you are looking for
-
Can multiple people work on the same project at the same time with Creative Cloud for Teams?
We have a project we are working on, and since it needs to be done in record time, multiple people need to be able to access the most current version. Is there a way to work on one project concurrently, like on Google docs?
-
I'd love to offer a screen capture and save a few 1000 words. You'll see that I have numerous duplicate copies of emails being received by one account, my RegisterMe4Now address. Let's see if the captures don't speak for themselves. I would appreciat
-
Contacts app stay open after ending an incoming call. Thats annoying!
Hi, I am using factory unlocked iPhone 4 with iOS 4.1. This is what I'm facing. It is quite annoying. 1. On home screen, I press sleep button. Phone goes into sleep mode(as usual). 2. I receive an incoming call. 3. I/caller end it. 4. Phone again goe
-
Problem with t:inputText in s:subForm
Howdy, I'm using a subform within my application. It contains an input text field as well as a submit button. Submitting per submit button works fine. But when the input text field is empty and I hit enter while focused on it a wrong action is perfor
-
Hello There, I have bought a clam with a dead DC inboard (so the seller says). I have bought two dead logic boards off eBay in the hope that at least one of them has a good DC in board. Is there a way I can test the DC inboards them without having to