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

calling private and public methods

Former Member
0 Likes
661

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 ..

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
Read only

Former Member
0 Likes
623

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

Read only

0 Likes
623

thax suresh ...

Read only

0 Likes
623

Hi,

If u got answer means pls close it.

Regards,

Ragavendran K.

Read only

Former Member
0 Likes
623

Updated the above Program for using select options.

Read only

Former Member
0 Likes
623

This message was moderated.