Method declaration in Class

Hi Experts,
         In Classes and Methods i got one requirement like this , Please respond it.
I have to create the method , where class is already defined(ZCL_CONFIGURABLE_ITEM )
Create Method:  IS_SEQUENCE_NOT_TO_PRINT .
Class name :ZCL_CONFIGURABLE_ITEM
They had given me example logic also. But iam not able to do this because i have no idea on classes and methods.
Please see this example and respond me .
Create Method:  IS_SEQUENCE_NOT_TO_PRINT .  This must be a value method in class ZCL_CONFIGURABLE_ITEM , passing document number VBDKR-VBELN that returns a parameter value: X = True, Blank = false.
GET BILLTO_PARTNER customer number for the document (reading VBPA where VBELN = document number VBDKR-VBELN and partner PARVW = ‘RE’ / ‘BP’)Read table KNA1 to get field KNA1-KATR6 where KUNNR equals Billto partner, and fields VBDKR-VKORG, VBDKR-VTWEG, VBDKR-SPART, Store first character of field KNA1-KATR6 in a work field e.g. W_ KATR6.
Add the entry below to the ZLITERAL table in all clients
Read the records from ZLITERAL table (reading key1 = C_ZLIT_GENOSYS_KEY, and key2 = C_KATR6_1) where C_KATR6_1 = attribute on class, with value = KATR6_1 .  You must add this attribute on the class.  Populate the internal table L_ZLITERAL_TAB type ZLITERAL_TAB_TYPE.

Hi,
    You can create the method from the CLASS BUILDER. SE24. There navigate to methods tab and enter you method name. Then select visibility public or private.
Then click on the parameters button to add parameters to the method. Selec IMPORT, EXPORT or RETURNING parameter for the function.
Regards,
Sesh

Similar Messages

  • What's "!" in method declaration in class?

    See the excerption below, what's the meaning of "!"?
    protected section.
      methods CALC
        importing
          !IV_PROC_TYPE type STRING optional
          !IV_PROC_NAME type STRING optional
          !IV_PROC_CLASS type STRING optional .
    Thanks in advance

    hi,
    the exclamation mark is nothing more than a hint to the ABAP compiler. It is required when you want use keywords like export, exceptions and so on as formal / actual argument.
    In the given scenario it is no must. But maybe the code is produced by some generator. For a generator not smart enough to no all rules, it is good advice to use exclamation marks for any parameter.
    Regards,
    anver
    <i>
    if hlped pls mark points</i>

  • Help with Declaring a Class with a Method and Instantiating an Object

    hello all i am having trouble understanding and completing a lab tutorial again!
    im supposed to compile an run this code then save work to understand how to declare aclass with a method an instantiate an object of the class with the following code
    // Program 1: GradeBook.java
    // Class declaration with one method.
    public class GradeBook
    // display a welcome message to the GradeBook user
    public void displayMessage()
    System.out.println( "Welcome to the Grade Book!" );
    } // end method displayMessage
    } // end class GradeBook
    // Program 2: GradeBookTest4.java
    // Create a GradeBook object and call its displayMessage method.
    public class GradeBookTest
    // main method begins program execution
    public static void main( String args[] )
    // create a GradeBook object and assign it to myGradeBook
    GradeBook myGradeBook = new GradeBook();
    // call myGradeBook's displayMessage method
    myGradeBook.displayMessage();
    } // end main
    } // end class GradeBookTest4
    i saved above code as shown to working directory filename GradeBookTest4.java
    C:\Program Files\Java\jdk1.6.0_11\bin but recieved error message
    C:\Program Files\Java\jdk1.6.0_11\bin>javac GradeBook4a.java GradeBookTest4.java
    GradeBookTest4.java:2: class, interface, or enum expected
    ^
    GradeBookTest4.java:27: reached end of file while parsing
    ^
    2 errors
    can someone tell me where the errors are because for class or interface expected message i found a solution which says 'class? or 'interface' expected is because there is a missing { somewhere much earlier in the code. i dont know what "java:51: reached end of file while parsing " means or what to do to fix ,any ideas a re appreciated                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Doesn't solve your problem, but this works for me...
    public class GradeBook
      public void displayMessage() {
        System.out.println( "Welcome to the Grade Book!" );
      public static void main( String args[] ) {
        try {
          GradeBook gradeBook = new GradeBook();
          gradeBook.displayMessage();
        } catch (Exception e) {
          e.printStackTrace();
    }

  • Error in using method get_event of class cl_htmlb_manager.

    Hi All,
    i am trying to get the event details in a particular method as follows;
    data: event type ref to cl_htmlb_event .
    event = cl_htmlb_manager=>get_event( runtime->              server-  >request ).
    i am getting an error
    field RUNTIME is unknown , it is neither in one of the specified tables nor defined by DATA statement. DATA statement. DATA statement.
    Where am i going wrong?
    plz help.
    BR,
    Annu.

    Hi Jorge,
    I am trying to use it in the method GET_LIST of class CL_SUS_M_ORDER_LIST .
    If i use
    event = cl_htmlb_manager=>get_event_ex( request ).
    again i get the error  Field REQUEST is unknown .
    and if i dont declare event using data statement
    data: event type ref to cl_htmlb_event .
    then i get the error that Field EVENT is unknown.
    My application is MVC pattern.
    So is there anyother way of geting the EVENT details when RUNTIME / REQUEST are not available ?
    Thaknks for the reply.

  • Calling method from another class

    Got the below code for the Bank class with a log in system, Want i need is a While loop for
    "While ValidUser = True, Do method in Accounts class."
    package bank;
    import javax.swing.*;
    import java.lang.*;
    public class Bank {
                  /*User Arrays */
        public  String Customer[]= new String[4];
        public  String Pin[] = new String[4];
                 /* User Tryed details */
            String User;
          String PinAuth;
    Boolean ValidUser;
    public Bank ()
                  /*Customers */
              Customer[0]="John";
        Customer[1]="Alan";
        Customer[2]="Lisa";
        Customer[3]="Liam";
        Pin[0]="1234";
        Pin[1]="1982";
        Pin[2]="4321";
        Pin[3]="5678";
    public Bank(String CustAtt, String PinAtt)
         User = CustAtt;
         PinAuth = PinAtt;
    public String getUser()
        return User;
    public String getPin()
        return PinAuth;
    public void setUser(String CustAtt)
        User = CustAtt;
    public void setPin(String PinAtt)
        PinAuth = PinAtt;
      public static void main    (String args[] ){
    System.out.println("Welcome to The Bank of Scotland");
          String User;
          String PinAtt;
        boolean ValidUser;
          /* Get User Details */
         User =
                JOptionPane.showInputDialog("Please Enter Your Name");
        /* Get User pin */
         PinAtt =
                JOptionPane.showInputDialog("Enter your Pin");
    /* Print USer Details */
         System.out.println(User);
         System.out.println(PinAtt);
    /* Authorise Customer */
    Bank newBank = new Bank();
    for(int i=0; i<4;i++)
    if(User.equals(newBank.Customer) && PinAtt.equals(newBank.Pin[i]))
    ValidUser=true;
    else
    ValidUser=false;
    if(ValidUser=true)
    System.out.println("Auth");
    else if(ValidUser=false)
    System.out.println("Log in details are in correct");
    while(ValidUser=true)
    Account Class, in this class i need options for selecting withdraw deposit  and close account, not sure if i could do this in the Current account class though.
    Any advice will be great package bank;
    import javax.swing.*;
    import java.lang.*;
    public class Account {
    private String AccountNo;
    private int Balance;
    private int Deposit;
    String AccountUsed;
    public Account () {
    public String getAccountNo ()
    return AccountNo;
    public void setAccountNo (int val) {
    AccountUsed = AccountNo;
    public int getBalance () {
    return Balance;
    public void setBalance (int val) {
    this.Balance = val;
    public int getDeposit ()
    return Deposit;
    public void setDeposit (int val)
    this.Deposit = val;
    this.Balance=this.Balance+this.Deposit;
    public void setWithdrawl (int val)
    this.Balance=this.Balance-val;
    public static void account (String args[] ){
    String Deposit = new String();
    String Withdraw = new String() ;
    System.out.println("Deposit - Withdraw");
    Account newAccount = new Account();
    Deposit =
    JOptionPane.showInputDialog("Enter the ammount you wish to deposit");
    Withdraw =
    JOptionPane.showInputDialog("Enter the amount you wish to Withdraw");
    System.out.println(Deposit);
    System.out.println(Withdraw);
    Account custAccount =new Account();
    custAccount.setDeposit(Integer.parseInt(Deposit));
    custAccount.setWithdrawl(Integer.parseInt(Withdraw));
    System.out.println(custAccount.getBalance());

    Maxideon wrote:
    All of these are valid,
    while(validUser == true) {
    while(validUser) {
    //I prefer this one
    if(validUser == true) {
    if(validUser) {
    //I prefer this one
    } What you have,
    if(validUser = true) {
    if(validUser = false) {
    }is different. I have two equal signs, while you have one. What do you think one equal sign does?
    P.S. All your variable names are screwed up. They should begin with a lower case letter.
    Edit
    Some other anomalies: you declared ValidUser as a Boolean and you imported java.lang. .... Why?
    Edit
    Another weird thing.
    String Deposit = new String();
    String Withdraw = new String();?I Am fairly new to java, I have things "working" to an extent, and i am aware of the naming conventions over the variable names,

  • Calling a non-static method from another Class

    Hello forum experts:
    Please excuse me for my poor Java vocabulary. I am a newbie and requesting for help. So please bear with me! I am listing below the program flow to enable the experts understand the problem and guide me towards a solution.
    1. ClassA instantiates ClassB to create an object instance, say ObjB1 that
        populates a JTable.
    2. User selects a row in the table and then clicks a button on the icon toolbar
        which is part of UIMenu class.
    3. This user action is to invoke a method UpdateDatabase() of object ObjB1. Now I want to call this method from UIMenu class.
    (a). I could create a new instance ObjB2 of ClassB and call UpdateDatabase(),
                                      == OR ==
    (b). I could declare UpdateDatabase() as static and call this method without
         creating a new instance of ClassB.With option (a), I will be looking at two different object instances.The UpdateDatabase() method manipulates
    object specific data.
    With option (b), if I declare the method as static, the variables used in the method would also have to be static.
    The variables, in which case, would not be object specific.
    Is there a way or technique in Java that will allow me to reference the UpdateDatabase() method of the existing
    object ObjB1 without requiring me to use static variables? In other words, call non-static methods in a static
    way?
    Any ideas or thoughts will be of tremendous help. Thanks in advance.

    Hello Forum:
    Danny_From_Tower, Encephalatic: Thank you both for your responses.
    Here is what I have done so far. I have a button called "btnAccept" created in the class MyMenu.
    and declared as public.
    public class MyMenu {
        public JButton btnAccept;
         //Constructor
         public MyMenu()     {
              btnAccept = new JButton("Accept");
    }     I instantiate an object for MyMenu class in the main application class MyApp.
    public class MyApp {
         private     MyMenu menu;
         //Constructor     
         public MyApp(){
              menu = new MyMenu();     
         public void openOrder(){
               MyGUI MyIntFrame = new MyGUI(menu.btnAccept);          
    }I pass this button all the way down to the class detail02. Now I want to set up a listener for this
    button in the class detail02. I am not able to do this.
    public class MyGUI {
         private JButton acceptButton;
         private detail02 dtl1 = new detail02(acceptButton);
         //Constructor
         public AppGUI(JButton iButton){
         acceptButton = iButton;
    public class detail02{
        private JButton acceptButton;
        //Constructor
        public detail02(JButton iButton){
          acceptButton = iButton;
          acceptButton.addActionListener(new acceptListener());               
       //method
        private void acceptListener_actionPerformed(ActionEvent e){
           System.out.println("Menu item [" + e.getActionCommand(  ) + "] was pressed.");
        class acceptListener implements ActionListener {       
            public void actionPerformed(ActionEvent e) {
                   acceptListener_actionPerformed(e);
    }  I am not able to get the button Listener to work. I get NullPointerException at this line
              acceptButton.addActionListener(new acceptListener());in the class detail02.
    Is this the right way? Or is there a better way of accomplishing my objective?
    Please help. Your inputs are precious! Thank you very much for your time!

  • To access a method frm a class derived frm a base class with the same name

    Here' s an example:-
    class TestA {
    public void start() {
    System.out.println("TestA");
    class TestB extends TestA {
    public void start() {
    System.out.println("TestB");
    }In main method I do this:-
    TestA testA = new TestA();
    TestB testB = new TestB();
    ((TestA)testB).start();Output :-
    TestB.
    Now when i define the method as static :-
    class TestA {
    public static void start() {
    System.out.println("TestA");
    class TestB extends TestA {
    public static void start() {
    System.out.println("TestB");
    }Then output is :-
    TestA.
    Can anyone let me know that when i say ((TestA)testB).start(); i.e i am type casting TestB obect to it base call then TestA should be printed but it doesn't print but when i declare method as static is does print TestA.
    Thanks,
    Heena

    >
    >
    Secondly, when i say ((TestA).testB).start(); output is TestB. But when i define start() method as static output is TestA. I need clarity for the same.In the static case, all that the compiler is interested in is the class of the expression before the ".". Because you've put in an explicit cast the type of expression is assumed to be TestA the compiler doesn't know what kind of object will actually be referenced at runtime. In the static case which method is called is determined at compile time.
    In the instance method case what determines the method called is determined the class of the actual, run time, value of the expression, and despite your cast, the actual value is still a reference to a TestB instance, so the TestB method is called. In the instance case which method called is determined at run time.

  • Invalid method declaration

    Hi there,
    I have a problem to compile below sentences.
    import java.awt.* ;
    import javax.swing.* ;
    import java.awt.event.* ;
    public class p662 extends JFrame
    public ShowColors()
    ** invalid method declariration for ShowColors ****
    super ("Using colors") ;
    Please help me.
    Best regards

    What the diddley?
    Your class name is p662 (what the heck is that?).
    The declaration public ShowColors looks like a constructor. You call super in it with a String argument, which looks like you want to invoke a JFrame ctor.
    You can't invoke a super class constructor in any method except a class constructor. The class constructors must have the same name as the class. The class must go in a file whose name is the same as the public class inside.
    You should follow the Sun coding standards for naming:
    http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html
    What are you doing here? This is unintelligible. - MOD

  • Synchronisation methods in same class

    I have three methods in same class A,B,C IN which A,B synchronised and c not.
    my question is if one thread is in A.another thread cann access B OR C?

    jverd wrote:
    Syncing a block on the object pointed to by X
    synchronized (X) { /* do stuff */}simply waits until no other thread is synced on that object, and then enters the block.
    Declaring a non-static method synchronized is the same as doing synchronized (this) { /* do stuff */ }Calling a non-synced method or executing a non-synced block or statement does not wait for the lock.Duke-wh0ring?? :)

  • How to call a method in IMPL class from one context node

    Hi, I´ve been only study the posibility to access a method in the IMPL class  from one context node class...CN## without using events, is there a way to call it ??? I don´t have it as requierement just learning thanks !.

    Hi,
    Try this by following this you can get the custom controller instacne in the view context nodes, for your requirement you can keep the view implementation class instance instead of cuco..
    To get the custom controller instance in Context node getter/setter method:
    1. Declare Cuco instance reference variable in ctxt class..
    2. Set this cuco ref. in the Create context node method of ctxt class:
    try.
    gr_cucoadminh ?= owner->get_custom_controller( 'ICCMP_BTSHEAD/cucoadminh' ). "#EC NOTEXT
    catch cx_root.
    endtry.
    you can avoid this step as this is not needed in case of view isntance
    3. Assign this instance to the respective context node Create method using:
    BTStatusH->gr_cuco ?= gr_cucoadminh.  " here assign the view implementation ref. " me" instead of gr_cucoadminh
    Here gr_cuco is the ref. variable of custom controller in the respective context node for eg. BtstatusH
    Sample implementation of this can be found in
    ICCMP_BTSHEAD/BTSHeader ->context node BTACTIVITYH-> attr ->GR_CUCO(instance of cuco)
    Cheers,
    Sumit Mittal

  • Exporting parameter of type table in Method of a Class

    Hi Experts,
    I want to pass an internal table from my method in ABAP class to a workflow.
    For thi spurpose i have cretaed a parameter of type table in the method.
    My problem is that i am not able to bind this to a workflow/task  container.
    I can see all the other parameters of the method in thw workflow while binding except for the parameter of type table ( i.e internal table ).
    Any idea ?
    Thanks,
    Radhika.

    Assuming that you are trying to export the internal table from class method to task conatiner.
    I have cretaed a Structure 'zemails' in se11
    Already you have created a Structure in the SE11 , why don't you just create one Table Type of ZEMAILS in SE11. Once you hvae created in DDIC then in the class signature declare the ltmails of type the tabale type that you create. and then in the task conatiner also try to declare the container element with the same name and same table type.
    In the class method declare the lt_mails as Exporting. save and actiavte. And one more thing if that element is not present in the Task conatiner then as soon as you try to open in the change mode and click on the binding button of the task it will prompt you asking whether you want to trnasfer the mssing elements if you clcik Yes then the same element which you have declared in the class will created with the same type. but make sure in the task conatiner you delcare the lt_mails as IMport export element.

  • Apply static method requirements on class (Static interface methods)?

    I have a set of classes where is class is identified with a unique ID number. So each class has a public static int getId() method. Each class also has either a constructor that takes a byte array or a static factory method that takes a byte array.
    I would like to maintain a hashmap of these classes keyed to the ID's however I am not sure how to have some interface of abstract parent class that requires each of these classes to implement these static methods.
    What I was hoping to do was something like this>>>
         public interface MyClasses{
              static MyClasses createInstance(byte[] data);
         HashMap<Integer, MyClasses> map;
         public void init() {
              map = new HashMap<Integer, MyClasses>();
              map.put(Class1.getId(), Class1.class);
              map.put(Class2.getId(), Class2.class);
         public void createInstance (int id, byte[] data) {
              map.get(id).createInstance(data);
         }Is there some way I could do this?

    What about something like this?
    public interface Initializable
         public void initialize(byte[] data);
    public class Factory
         private final Map<Integer, Initializable> map = new HashMap<Integer, Initializable>();
            public void registerClass(int id, Class klass)
                    if (! Initializable.class.isAssignableFrom(klass))
                             // you may also want to ensure the class declares a parameterless constructor
                             throw new IllegalArgumentException("duff class");
                    if (this.map.keySet().contains(id))
                             throw new IllegalArgumentException("duff id");
              this.map.put(id, klass);
         public Initializable createInstance(int id, byte[] data)
                    // need some exception handling of course
              Initializable i = map.get(id).newInstance();
                    i.initialize(data);
                    return i;
    }

  • Static methods in startup class

    I have declared few static methods in startup class. What will happen
              once startup class is executed in cluster environment, will the access
              to those static methods be clustered and replicated across the
              clusters. How exactly the startup class behaves in clustered
              environment.
              I will appreciate an urgent response.
              Thanks,
              SidShar .
              

    SidShar,
              > I have declared few static methods in startup class. What will
              > happen once startup class is executed in cluster environment,
              > will the access to those static methods be clustered and
              > replicated across the clusters.
              No.
              > How exactly the startup class behaves in clustered environment.
              It is run on each server that it is configured to run on. The method calls
              to the startup class will all be local unless you do some special work to
              force it to be otherwise.
              If you want to have something done once and only once in the cluster, or
              coordinate stuff like that, then either use a shared resource (such as the
              database) to coordinate it all, or use Coherence, which lets you share and
              coordinate access to data among all the servers in the app tier.
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com/coherence.jsp
              Tangosol Coherence: Clustered Replicated Cache for Weblogic
              "sidshar" <[email protected]> wrote in message
              news:[email protected]..
              >
              

  • BOR method "Returnparameter" on class

    Hi all,
    on the BOR object method, there is an option for "Resultparameter" so the method returns a value which can be used in the outgoing payments of a workflowtask.
    How can I achieve this using a method of a class?
    Regards
    Robert

    What about something like this?
    public interface Initializable
         public void initialize(byte[] data);
    public class Factory
         private final Map<Integer, Initializable> map = new HashMap<Integer, Initializable>();
            public void registerClass(int id, Class klass)
                    if (! Initializable.class.isAssignableFrom(klass))
                             // you may also want to ensure the class declares a parameterless constructor
                             throw new IllegalArgumentException("duff class");
                    if (this.map.keySet().contains(id))
                             throw new IllegalArgumentException("duff id");
              this.map.put(id, klass);
         public Initializable createInstance(int id, byte[] data)
                    // need some exception handling of course
              Initializable i = map.get(id).newInstance();
                    i.initialize(data);
                    return i;
    }

  • Method declaration of an interface

    Hi,
    Here's an interface definition.
    public interface Foo {
    public Object getSomeObject(Object param);
    What i want to find out is,
    why do we need to specify a variable reference in the interface?
    public interface Foo {
    public Object getSomeObject(Object);//throws error.
    Thank you.

    Hi,
    Here's an interface definition.
    public interface Foo {
    public Object getSomeObject(Object param);
    What i want to find out is,
    why do we need to specify a variable reference inthe
    interface?
    public interface Foo {
    public Object getSomeObject(Object);//throwserror.
    Thank you.The interface method is just a signature that all
    classes implementing the interface must follow. Its
    syntax requires that the variable reference is
    included. There is no other reason. Its like the word
    "bought" is spelt the way it is..It could have also
    been splet as "bot" but that is incorrect.!!!
    That is right.
    It is just a signature. Also, it allows the compiler to perform its actions consistently, most of all, thereby not offering any special privileges to an interface method declaration. As we all know that the byte code representation of an 'interface type' is also a class.

Maybe you are looking for

  • I tried downloading icloud on my pc with windows 8 and it stalls at 99%

    I am having trouble downloading iCloud on my Toshiba PC with Windows 8 it stalls at 99%.  Can anyone help me please?

  • FCP files will not open after data recovery

    We have a TV tech lab in our high school of 15 Apple editing workstations and we archive the completed projects to external firewire drives. Well, wouldn't you know it, one of the drives crashed with all of the previous school years senior projects.

  • Using videos in Photoshop CS5 32 bit

    Have reviewed a number of new vid tuts on doing things with video files in Photoshop CS5.  I've tried it but every time I try to bring in a video file into CS5 Photoshop 32bit, PS stops working and shuts down.  I also see I do not have a "Video" work

  • Why does iphone use cellular data to contact internet when wifi is available?

    If I leave Mobile Data (or Cellular Data) enabled on my iphone, I find that the phone uses my carrier phone service to access the internet about 10 times per day. The accesses tend to be mostly very small data transfers (say about 10KB). I have no id

  • Dont want Spotify free

    Dont want to pay each month for my spotify free? Its not easy to make this!!! Only upgrade to spotify premium all the time.Anyone who can help me??????