Commit in Z class method

Hello friends
I am enhanching someone else's code in a method in a class.
I am trying to insert something in my z table, but it won't insert without commit. If I write commit, it gives syntax error.
"        insert zmm_intsales from ca_zmatint.
        commit. "
can anyone guide how to commit in a method of a class.
Regards
Bhavna

In debug mode check the content of SY-DBCNT field immediately after the INSERT. If it contains a non-zero value, the record(s) are getting inserted.
In that case, check the content of table structure ca_zmatint to make sure you have populated the fields correctly.

Similar Messages

  • Automatic commit work after class method?

    Hi guys,
    after calling a class method, is there an automatic commit work? Or do I have to insert a commit work into the class method?
    At which points, a commit work is automatically called?
    Regards,
    Basti

    Hi,
    there is so much confusion about commit, commit work and rollback:
    1. At the end of LUW and at every interruption (screen display including message issued, RFC calls,...)  an implicit database commit occurs.
    2. COMMIT WORK will trigger all update task processes that have been registered before (call function in update task, perform on commit). Most BAPI functions use perform on commit. An implicit database commit ist not a COMMIT WORK.
    3. Rollback work will delete all pending update tasks inclusing all database updates not yet commited.
    4. Only the 'Master'of any process should rule the COMMIT WORK because COMMIT WORK means that ALL pending update tasks are executed. So only the caller on top of the hierarchy should issue the COMMIT WORK because a later ROLLBACK is not possible - ROLLBACK only works if not y<et committed.
    These rules work independent of programming feature used - nothing different in oo.
    Regards
    Clemens

  • In webdynpro ,Passing field symbols as values to class methods

    Hi
    Please tell me the ways of accessing database in webdynpro abap(not directly). I am calling Class method for accessing database. As currently I am directly accessing database in my webdynpro application. I have created a class and method for the same.
    In my method I want to use select statement which will return table with values to webdynpro application. So for select statement(Calling Method) I need to use my field symbol values as where in clause .
    Could anyone please help with example code?
    Thanks,
    Ujjwal

    data: in_line type ref to data.
    CREATE DATA in_line LIKE LINE OF <dyn_tab>.
      ASSIGN in_line->* TO <dyn_wa>.
    You can create a data reference and assign it to a field symbol and change the values. direclty passing field symbols is not possible.
    Abhi

  • Need Help with command line arguments for a class method

    Hey guys,
    I'm fairly new to programming in java.
    I want to a write a class method that adds up its command line arguments which are numbers. For example, if the input was .... 5 2 3....then the output would be 10.
    I have been told to use the Convert to convert a string to a double. I'm ok for writing the class method but I have no idea how to use Convert and why I need it in the method.
    Can anybody help please?

    Hey guys,
    I'm fairly new to programming in java.
    I want to a write a class method that adds up its
    command line arguments which are numbers. For
    example, if the input was .... 5 2 3....then the
    output would be 10.Okay. So you would receive the numbers to add as the String[] argument to a main method. The steps are simple:
    1) declare a variable for the count
    2) for each String in the array:
    2.1) extract the value as a double
    2.2) add this to the count
    3) output the resulting count
    I have been told to use the Convert to convert a
    string to a double.
    I'm ok for writing the class
    method but I have no idea how to use ConvertThere is no class Convert in the Java API.
    and why
    I need it in the method. Do you understand you need to somehow convert each String to a double (step 2.1)? Since Convert is unknown to me, maybe you should just take a look at class Double. It can help you do step 2.1, the rest should be trivial enough.
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Double.html
    Give it a go and feel free to post back with a specific problem you are having, accurately described if you please :-)

  • Whats the difference between a class method and a instance method.

    I have a quiz pretty soon and one of the questions will be: "How does an instance method differ from a class method." I've tried looking this up but they gave me really complicated explanations. I know what a instance method is but not really sure what a class one is. Can someone post an example of a class method and try to explain what makes it so special?
    Edited by: tetris on Jan 30, 2008 10:45 PM

    Just have a look:
    http://forum.java.sun.com/thread.jspa?threadID=603042&messageID=3246191

  • How to find out which class/method is calling System.gc

    Hi
    I am seeing frequent FULL GC and not able to locate which particular class/method is calling the System.gc(). I have disabled it using -XX:DisableExplicitGC and performance issues have been resolved. Also, I noticed that it does not happen periodically, so it is not RMI GC. How to find out who exactly is doing this? Does any of of the profilers like Optimizeit/Jprobe help find out this.
    Thanks

    Hi
    I am seeing frequent FULL GC This is because you are creating and destroying objects VERY frequently. Try to look at your design and see where you can reuse objects (i.e. object pooling) if possible, that is if this is adversely affecting performance.
    and not able to locate
    which particular class/method is calling the
    System.gc(). Classes don't call GC. The VM handles that automagically.
    I have disabled it using
    -XX:DisableExplicitGC and performance issues have
    been resolved. Also, I noticed that it does not
    happen periodically, so it is not RMI GC. How to find
    out who exactly is doing this? Does any of of the
    profilers like Optimizeit/Jprobe help find out this.OptimizeIt will tell you everything you need to know. However, NetBeans offers a free profiler now!

  • How to call inner class method in one java file from another java file?

    hello guyz, i m tryin to access an inner class method defined in one class from another class... i m posting the code too wit error. plz help me out.
    // test1.java
    public class test1
         public test1()
              test t = new test();
         public class test
              test()
              public int geti()
                   int i=10;
                   return i;
    // test2.java
    class test2
         public static void main(String[] args)
              test1 t1 = new test1();
              System.out.println(t1.t.i);
    i m getting error as
    test2.java:7: cannot resolve symbol
    symbol : variable t
    location: class test1
              System.out.println(t1.t.geti());
    ^

    There are various ways to define and use nested classes. Here is a common pattern. The inner class is private but implements an interface visible to the client. The enclosing class provides a factory method to create instances of the inner class.
    interface I {
        void method();
    class Outer {
        private String name;
        public Outer(String name) {
            this.name = name;
        public I createInner() {
            return new Inner();
        private class Inner implements I {
            public void method() {
                System.out.format("Enclosing object's name is %s%n", name);
    public class Demo {
        public static void main(String[] args) {
            Outer outer = new Outer("Otto");
            I junior = outer.createInner();
            junior.method();
    }

  • How to get a int value from another class method?

    Hi,
    how can I get a value of another class method variable value.
    example,
    class elist
            int a;
         ArrayList<Event> eventArray;
         void addEvent(Event e);
         Event getEvent(int index);
         void removeEvent(int index);
         void orderEventByTime();
    interface Event
         void Command();
    class servo implements Event
         String ip;
         int time = 10;
         void Command();
    class servo_2 implements Event
         String ip;
         int time = 20;
         void Command();
    [\code]
    I want to get the time value in elist variable a; 
    and want to compare each class time?.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi,
    1) this foum provides means to format/tag code, no need to manually add -tags
    2) by default, classname start with a capital letter, method names with a lower case letter
    3) where do you want to get the time value to Elist.a? During addEvent()?
    4) what do you want to do with the time value of each event? Sum all values up to make a an overall sum?
    5) where do you want to compare the time value(s)?
    To put it in one sentence: please be more specific with your description and answer.
    Bye.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Calling the super class method from the subclass

    Hi all,
    I have a question about inheritence and redefinition of methods. Is it possible to call the superclass implementation of a method which is redefined in the subclass in another method of the subclass?There are possbilities like creation of an explicit super class instance or delegating the super class method implementation to another method which is also protected etc. What i mean is, is there a direct way of calling it?We have ,me,   as the reference for the instance we have(which is the subclass instance in this case), is there also a way of pointing the superclass implementation(with super we can reference in the subclass redefinition, my question is if we have such a parameter in other methods of the subclass too)
    Thanks in advance
    Sukru

    Hi,
    The super reference can only be used in redefined methods to call superclass implementation . So probably what you can do is use upcasting and access the required superclass implementation. I can think of only this way...;-)
    Ex data lr_super type ref to cl_superclass
    lr_super = lr_subclass.
    lr_super->method().
    ~Piyush Patil

  • A function module or class/method to look up repository objects?

    Hi,
    Does anyone know of a class/method or a function module that returns back objects of a namespace in the integration repository.
    For example, I would like to be able to retrieve all the message interfaces of a particular namespace.
    Thanks in advance,
    Duke

    Hi Duke,
    I am not sure about the function module. But you can look up all the objects with their IDs using transaction sxi_cache.
    Regards,
    Ramesh P

  • Can't navigate to a page when using a class method

    I am working on windows phone 8.1 universal app where I have created a class method and placed it in the NavigationHelper_LoadState method of one of the  pages in my app. My navigation is as follows, I click on a link on my Mainpage and that takes me
    to the page in question,  where I have placed the class method in LoadState.
    The class method checks the authentication state of the user. If the user is not logged in, it is supposed to take him to a separate login page (SHDSignIn from the snippet below).
    The problem I am running into is that when I hit that part of the code in my class method, it just steps through the redirect code but doesn't take me to the login page but rather takes me to the  page that was clicked from mainpage.
    From the troubleshooting I have done up to this point seems like an issue probably because I am calling the method from NavigationHelper_LoadState and the system doesn't like it?? Can someone please explain and also provide a workaround for this?
    Here is my code for the class function:
    public async void SHDAuthState(string errormessage, ProgressBar myprogressbar, TextBlock mytextblock, TextBlock myservernetworkerror)
    //Get the values for the userID and password from the settings....
    string shdLoggedInValue = (string)appRoamingSettings.Values["shdLoggedIn"];
    //If not logged in, redirect to the SHD sign in page...
    if (shdLoggedInValue != "Yes")
    this.rootFrame.Navigate(typeof(SHDSignIn));
    //Getting the cookie if it has expired..
    else
    //Get the cookie value...
    string myCookieValue = (string)appRoamingSettings.Values["MyCookie"];
    //Get the original cookie obtain time....
    long CookieObtainedTimeValue = (long)appRoamingSettings.Values["CookieObtainedTime"];
    //Convertig date/time back to DateTime object....
    origCookieObtainedTime = DateTime.FromBinary(CookieObtainedTimeValue);
    currentDateTime = DateTime.Now;
    //Check to see if cookie has expired....
    cookieTimeElasped = currentDateTime - origCookieObtainedTime;
    cookieTimeElapsedMins = cookieTimeElasped.TotalMinutes;
    // 2 days = 2880 mins but we give a margin of 1 minute
    //Get a new cookie if it has expired and save to settings
    if (cookieTimeElapsedMins >= 2879)
    // Start showing the progress bar...
    mycontrols.progressbarShow(myprogressbar, mytextblock);
    //Get the values for the userID and password from the settings....
    string UserIDValue = (string)appRoamingSettings.Values["UserID"];
    string PasswordValue = (string)appRoamingSettings.Values["Password"];
    //Update the requestData string before sending.....
    requestData = "{" + string.Format(RegisterRequestData, UserIDValue, PasswordValue) + "}";
    string registerResults = await SHDAPI(registerUrl, requestData, errormessage);
    if (registerResults != null)
    // Get the cookie and the time and save it to settings
    var shdCookie = JsonConvert.DeserializeObject<SHDHelper.SHDObject>(registerResults).RegistrationCookie;
    //Save cookie to the app settings
    appRoamingSettings.Values["MyCookie"] = shdCookie;
    // build the UI
    // Stop showing the progress bar...
    mycontrols.progressbarNoShow(myprogressbar, mytextblock);
    else
    // Stop showing the progress bar...
    mycontrols.progressbarNoShow(myprogressbar, mytextblock);
    //Show the error message...
    myservernetworkerror.Visibility = Windows.UI.Xaml.Visibility.Visible;
    Also, I have the rootFrame defined as follows in my class:
    Frame rootFrame = Window.Current.Content as Frame;
    I am calling the class method from the LoadState method as follows
    SHD_helper.SHDAuthState(errorMessage, pgbar, pgText, ServerNetworkError);
    thanks
    mujno

    that is correct.  I wanted to keep the login page redirect inside my class method so that I could do the check every time someone came to pages that require authentication. I wanted it in the LoadState method so I can do a check there, redirect
    them to login page or just get a cookie and then pass that cookie to page to build the UI for the page
    I can do what you are suggesting and have actually tried it but then I have to track which page to take the user to after they log in...
    I have multiple clicks in the appbar  and pages from where the user can come to these authentication-bound pages..
    Suggestions?
    Also, what am I doing wrong in my class method that it doesn't navigate to the login page in the LoadState method?
    Thanks 
    mujno

  • Class method for XI data into R/3????

    Hi Experts,
    I have a very big problem..please help me!!!!
    We need to create a program that will call data from XI interface and populate the internal table in R/3?
    Can any1 of u give me the steps to go forward with it?
    I read some documents and found that we need to use Class METHOD.. but I am new to OOPS and dont know anything in it.
    Its about server proxies I guess!!!
    I need to finish this in 1 day...
    Please help.. answers will be rewarded with points...

    Hi, Thanks for the reply. I cannot use IDOC.
    I have data in XI interface in form of XML data and i want to populate internal table in R/3 with this XML data(From XI).
    If anybody can give me the steps to do the same, it will be very helpful.
    my mail id is [email protected]
    please try to send me the steps with an example...

  • Is it possible to call a class method using pattern in ABAP editor.

    Hi,
         Is it possible to call a class method using pattern in ABAP editor.
    Thank U for Ur time.
    Cheers,
    Sam

    Yes,
    Click patterns.
    Then choose Abap objects patterns.
    Click on the Tick
    It will give a new screen
    Here Give the name of the class first.
    Then the object (instance of the calss)
    And finally the method ..
    it will give you the pattern
    Hope this helps.

  • Invoking Derived Class Method

    Hi pls go through the below code, can any one give me solution how to access the Derived class method in this Point.
    Note: In the below code , only in runtime we will come to know which Derived class method is going to invoke(So in runtime we will get Derived class name in the form of String). So Iam trying to Use Class.forName("Clas name") to create the instance of the Derived class and then type casting to base class.
    Why iam casting to base class is , since only in the run time we are geting the Derived class name.
    Result : iam geting the compiletime error says that no valid method fond in Mybase though it contains the reference of derived.
    abstract class MyBase
    public void display(int i)
    System.out.println(" Base class Method");
    class MyDerived extends MyBase
    public void display(String str)
    System.out.println("Derived class Mthode");
    class MyMain
    public static void main(String arg[])
    String DrivObj=arg[0];
    MyBase baseObj=(MyBase) Class.forName("DrivObj").newInstance();
    baseObj.display("SomeString"); }
    }

    The problem is, can not have subclass reference bcoz
    iam geting the subclass name only in the runtime and
    one more thing is cant touch my base and subclass to
    do changes as u said Your design is then definately very bad.
    , is there any other way to do
    it.Yes, you can use reflection to invoke the method.
    Kaj

  • Code to call friends class method

    Hello,
    Please can someone help me with friends class method call. in global classes
    Thanks
    Megh
    Moderator message: please search for available information/documentation before asking.
    Edited by: Thomas Zloch on Nov 2, 2010 5:29 PM

    What is your exact problem?
    The class whose private and protected section you want to use, needs declaration of its friends. You do it in Friends tabstrip. All these classes are allowed then to access these "hiden" sections from outside of the class. Below example how it works with local classes. For global ones the principle stays the same
    CLASS lcl_main DEFINITION DEFERRED.
    CLASS lcl_other DEFINITION FRIENDS lcl_main. "only LCL_MAIN can use may hiden sections
      PROTECTED SECTION.
        METHODS prot_meth.
      PRIVATE SECTION.
        METHODS priv_meth.
    ENDCLASS.                  
    CLASS lcl_other IMPLEMENTATION.
      METHOD prot_meth.
        WRITE / 'This is protected method of class lcl_other'.
      ENDMETHOD.                    "prot_meth
      METHOD priv_meth.
        WRITE / 'This is private method of class lcl_other'.
      ENDMETHOD.                    "priv_meth
    ENDCLASS.                   
    CLASS lcl_main DEFINITION.
      PUBLIC SECTION.
        METHODS call_friends_methods.
      PRIVATE SECTION.
        DATA mr_my_friend TYPE REF TO lcl_other.
    ENDCLASS.                  
    CLASS lcl_main IMPLEMENTATION.
      METHOD call_friends_methods.
        CREATE OBJECT mr_my_friend.
        mr_my_friend->prot_meth( ).
        mr_my_friend->priv_meth( ).
      ENDMETHOD.                   
    ENDCLASS.           
    START-OF-SELECTION.
      DATA gr_main TYPE REF TO lcl_main.
      CREATE OBJECT gr_main.
      gr_main->call_friends_methods( ).
    Regards
    Marcin

Maybe you are looking for