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

creating class & methods

Former Member
0 Likes
4,602

Hello all,

How to create a class..

Please send me the sample steps.

7 REPLIES 7
Read only

Former Member
0 Likes
2,964

Hi

Class is created in SE24.

This is the link to the tutorial for Class Builder -

http://help.sap.com/saphelp_47x200/helpdata/en/ca/c035baa6c611d1b4790000e8a52bed/frameset.htm

Also see the below link its good for you..

https://www.sdn.sap.com/sdn/weblogs.sdn?blog=/pub/wlg/680. [original link is broken] [original link is broken] [original link is broken] [original link is broken]

Mark if helpful

Regards

Tushar Mundlik

Read only

Former Member
0 Likes
2,964

Hi,

Goto SE24 class builder.

enter the class name and create a usual ABAP class with Final checkbox unchecked.

define the attributes, level and visibility

define the method-enter method name, define its paramters, exceptions and its definition

define event, if any.

activate the class.

Check any sample class for example starting with CL_*.

Hope this helps.

Regards,

Richa

Read only

Former Member
0 Likes
2,964

hi,

We can create class by using these simple steps.

class has declaration step, in this we can define call componets like

methods, attributes,evnts..

*<b>local class creation</b>

CLASS <class> DEFINITION.

METHOD <meth>. "for defining methods.

...

ENDMETHOD.

...

ENDCLASS.

class has implementation section, in this section we can provide implementations to all the definitions which are declared in class declaration section.

CLASS <class> IMPLEMENTATION.

...

ENDCLASS.

<b>simple example;</b>

CLASS C_COUNTER DEFINITION.

  PUBLIC SECTION.  " here declare public components
    METHODS: SET_COUNTER IMPORTING VALUE(SET_VALUE) TYPE I,
             INCREMENT_COUNTER,
             GET_COUNTER EXPORTING VALUE(GET_VALUE) TYPE I.

  PRIVATE SECTION.         "here declare local components
    DATA COUNT TYPE I.

ENDCLASS.

CLASS C_COUNTER IMPLEMENTATION.

  METHOD SET_COUNTER.                " method implemetation
    COUNT = SET_VALUE.
  ENDMETHOD.

  METHOD INCREMENT_COUNTER.
    ADD 1 TO COUNT.
  ENDMETHOD.

  METHOD GET_COUNTER.
    GET_VALUE = COUNT.
  ENDMETHOD.

ENDCLASS.

Follow these steps to declare object to class.

data: obj type ref to <name of the class>. "here refarence variable is created

CREATE OBJECT obj. "here object is created

<b>*global class creation</b>

we can create global class in CLASS BUILDER, for that one we work with SE24.

<b>follow this link for class builder.</b>

http://help.sap.com/saphelp_nw2004s/helpdata/en/ee/e440a670a111d1b44c0000e8a52bed/content.htm

<b>follow this link for knowing types of classes and types of class components.</b>

http://www.erpgenie.com/abap/OO/syntax.htm

http://help.sap.com/saphelp_nw04/helpdata/en/b3/f4b1406fecef0fe10000000a1550b0/content.htm

regards,

Ashokreddy.

Read only

Former Member
0 Likes
2,964

hi,

GLOBAL CLASS

to create a global class goto Se24 -> give object name -> create -> continue -> save -> local object -> give required attributes, methods in screen opened for u -> activate run.

LOCAL CLASS

in se38 -> pattern -> select abap objects -> in the displayed window select object or class or interface -> give details ->ok.

code for that selected object is displayed for u.

if helpful reward some points.

with regards,

suresh.

Read only

former_member770121
Participant
0 Likes
2,964

My Question is : In Workflow to add the field from other table like (EKPO). I have make the customize copy of (ZBUS2012) and further what will we do next ?? about method ? Where from we can add the coding to read the net price against the PO in sending email from CFO?
Kindly recommend any method or solution step by step

Read only

0 Likes
2,964

Your question need to be asked in a new thread and not use an old one

Read only

0 Likes
2,964

Hi Haya,

As Frederic mentioned, I recommend raising your question again as a new question and follow our rules of engagement: https://community.sap.com/resources/rules-of-engagement. The author of the original question is no longer active in the community and won't receive your query. Feel free to take our Q&A tutorial at: https://developers.sap.com/tutorials/community-qa.html.

Questions on how to draw responses from members? Check out this discussion on how to improve questions. https://groups.community.sap.com/t5/welcome-corner-discussions/advice-from-sap-champions-questions-a.... With these tips you'll be able to prepare questions that draw responses from our members.


Thanks!