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: 

calling private and public methods

Former Member
0 Kudos

hai friends...

in real time.

i declared itab to retrieve values .

and where can i declare select-options.

iam attaching my simple code ..

can anybody send me simple example...

class c3 definition.

public section.

types: begin of ty_marc,

matnr type marc-matnr,

werks type marc-werks,

end of ty_marc.

data: wa_itab type ty_marc.

data: itab type table of ty_marc .

methods add .

  • private section.

  • method sub importing value(itab) ..

endclass.

class c3 implementation.

method add.

select matnr

werks

from marc into table itab." where matnr in s_matnr.

*call method sub exporting value(itab1)

loop at itab into wa_itab.

write: wa_itab-matnr,

wa_itab-werks.

endloop.

endmethod .

endclass.

start-of-selection.

data b1 type ref to c3.

create object b1 .

call method b1->add.

  • parameters: s_matnr like marc-matnr.

here where can we delcare select-options ...

an di want to use both public and private methods how can i write...

tankx in advance ..

5 REPLIES 5

former_member569226
Participant
0 Kudos

Hi,

Please find the modified code below.

Report ztest.

tables:marc.

select-options: s_matnr for marc-matnr.

class c3 definition.

public section.

types: begin of ty_marc,

matnr type marc-matnr,

werks type marc-werks,

end of ty_marc.

data: wa_itab type ty_marc.

data: itab type table of ty_marc .

data: wa_matnr type r_matnr.

methods: add.

private section.

*methods: sub.

endclass.

class c3 implementation.

method add .

select matnr

werks

from marc into table itab where matnr IN s_matnr.

loop at itab into wa_itab.

write: wa_itab-matnr,

wa_itab-werks.

endloop.

endmethod .

endclass.

start-of-selection.

data b1 type ref to c3.

create object b1 .

call method b1->add.

Edited by: mariosuresh on May 19, 2008 1:42 PM

0 Kudos

thax suresh ...

0 Kudos

Hi,

If u got answer means pls close it.

Regards,

Ragavendran K.

former_member569226
Participant
0 Kudos

Updated the above Program for using select options.

Former Member
0 Kudos

This message was moderated.