Classes & Methods

Hi Experts,
                      Please see the following requirement in Classes & Methods, which I have to develop.I need this logic , Please send me the logic based up on old logic which i had given below.  
The following needs to be created once, after which, the call to the method should be inserted in all related outputs.
I have to create this 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.
This is the example method which they had given me to see it and do the same to that method with suitable changes,
[See e.g. method IS_GENOSYS_ITEM below from class ZCL_CONFIGURABLE_ITEM.
For this e.g. Method logic is defined.
**(METHOD is_genosys_item.
  STATICS: l_gen_cats TYPE z_pstyv_tt.
  DATA:    l_gen_cat_line TYPE zpstyv_line.
  IF l_gen_cats[] IS INITIAL.
    CALL METHOD zcl_configurable_item=>get_gen_valid_item_cats
      IMPORTING
        itemcats_range_all_out   = l_gen_cats
      EXCEPTIONS
        no_item_categories_found = 1
        OTHERS                   = 2.
    IF sy-subrc <> 0.
      is_genosys_item = space.
      RETURN.
    ENDIF.
  ENDIF.
  IF item_cat_in IN l_gen_cats
    AND NOT l_gen_cats[] IS INITIAL.
    is_genosys_item = c_checked.
  ELSE.
    is_genosys_item = space.
  ENDIF.
ENDMETHOD.)**]
For our Method ‘IS_SEQUENCE_NOT_TO_PRINT’
,we have to  Include the following logic :
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 Bill to 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.
See e.g. in method GET_GEN_VALID_PRICE_CONDS of class ZCL_CONFIGURABLE_ITEM
[**(Method GET_GEN_VALID_PRICE_CONDS.
  data: l_zliteral_tab type ZLITERAL_TAB_TYPE,
        l_zliteral type zliteral,
        l_kscha type zkscha_line.
  select *
    from zliteral
    into table l_zliteral_tab
    where zkey1 = zliteral_key1_in
      and zkey2 = zliteral_key2_in.
  if sy-subrc = 0.
    loop at l_zliteral_tab into l_zliteral.
      clear l_kscha.
      l_kscha-sign = l_zliteral-zvalue1.
      l_kscha-option = l_zliteral-zvalue2.
      l_kscha-low = l_zliteral-zvalue3.
      append l_kscha to condtype_range_out.
    endloop.
  else.
    raise no_pricing_conds_found.
  endif.
endmethod.)**]
Declare a range R_KATR6_1 in the program and load range from internal table L_ZLITERAL_TAB.
Check if stored field W_ KATR6 (i.e. first character of KNA1-KATR6) is in the range not to print R_KATR6_1.
If the value in the stored field is in the range not to print R_KATR6_1, set the returning parameter to ‘X’ using attribute c_checked.  If not, it means that the sequence should be printed.  So the value method should return the value ‘ ‘ – initial. 
In the print program, call the value method once while processing the header section and store the value in a work field.  This field can be used later when processing each item.  It is not necessary to call the method for each item.  Once is fine, as the data is at header level.
How to call the value method:
W_NO_SEQUENCE_PRINT = zcl_configurable_item=> IS_SEQUENCE_NOT_TO_PRINT (VBDKR).
Add “ IF STATEMENT “ as seen below:
IF W_NO_SEQUENCE_PRINT IS INITIAL.
  IF wgen-bulk_item <> 'X'.
    IF wgen-prfid = c_oligo.
      PERFORM write_oligo_sequence.
    ELSEIF wgen-prfid CS c_peptide.  "
      PERFORM write_peptide_sequence.
    ENDIF.
  ENDIF.
ENDIF.

Hi,
try the online tutorial, which you can access via the Documentation/Tutorials link on the left side. Work on the examples given there and read the explainations carefully - first, try to understand, what is said there, then look at the examples and think about that, what every statement does and why it is there. Next step - try to reproduce the given example by yourself - do not look in the code of this example and do not copy parts of it - try to do it really by yourself - this way, you will learn, what the methods, you use, are for.
greetings Marsian

Similar Messages

  • 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

  • Class-data versus data and methods versus class-methods in OO ABAP

    Hi
    I was going thorugh following OO ABAP code.
    CLASS vessel DEFINITION.
      PUBLIC SECTION.
        METHODS: constructor,
                 drive IMPORTING speed_up TYPE i,
                 get_id RETURNING value(id) TYPE i.
        CLASS-METHODS: start,
                       objects,
                       inheritance,
                       interfaces,
                       events.
      PROTECTED SECTION.
        DATA: speed TYPE i,
              max_speed TYPE i VALUE 100.
      PRIVATE SECTION.
        CLASS-DATA object_count TYPE i.
        DATA id TYPE i.
    ENDCLASS.
    Whats is difference between methods and class-methods ?
    What is the difference between data and class-data ?

    Hi Rajesh,
    There are two types of componenets in a class
    1)Static components
    2) Instance components
    Instance components exist for every instance of the class, while static exist only once for any number of instances of the class.
    Components of the class are methods, attributes, events etc.
    static attributes are represented by CLASS-DATA and instance attributes are represented by DATA.
    static methods hence are done by CLASS-METHODS and can access only static attributes.
    Instance methods are done by METHODS and can access any attribute.
    For eg: supposing that in a class, there is a static attribute. Suppose after one instance is created, we are setting this static attribute value as 10. Now we are creating another instance of the same class. Now when you try to display the value of this attribute, it will be 10.ie. it needs to be initialized once and can be shared between instances.
    Just go through this document..You will get nice info from this.
    http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    If you want to go deeper, like object persistence and all, just refer this document.
    http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    Regards,
    SP.

  • Getting problem with DOMImplementation classes method getFeature() method

    hi
    getting problem with DOMImplementation classes method getFeature() method
    Error is cannot find symbol getFeature()
    code snippet is like...
    private void saveXml(Document document, String path) throws IOException {
    DOMImplementation implementation = document.getImplementation();
    DOMImplementationLS implementationLS = (DOMImplementationLS) (implementation.getFeature("LS", "3.0"));
    LSSerializer serializer = implementationLS.createLSSerializer();
    LSOutput output = implementationLS.createLSOutput();
    FileOutputStream stream = new FileOutputStream(path);
    output.setByteStream(stream);
    serializer.write(document, output);
    stream.close();
    problem with getFeature() method

    You are probably using an implementation of DOM which does not implement DOM level-3.

Maybe you are looking for

  • Apex Listener authentication.

    I want to use Apex Listener for my pl/sql web application (now I use mod_plsql). How can I implement authentication in order to protect pages from unauthorized use (like OWA_CUSTOM does in nod_plsql)? Tks Tullio

  • Is there a fix for the iPad2/iOS7 WiFi dropping issue yet?

    After searching through Many threads regarding iPad2 Wi-Fi issues, I have found a lot of different "solutions" and I've tried them ALL but my Wi-Fi is STILL dropping out on me all the time. My iPad is running iOS version 7.1.2. I am constantly gettin

  • How to move license to new PC?

    hi, I had Captivate 6 in a PC which is now broken, so I can not deactivate license there. How can I install captivate again in the new computer? thanks

  • Planning : migration security of business rules

    Hello, Unfortunetly the migrator for business rules (v. 9.2.0.3) don't migrate the security. Do somebody have a solution to migrate the securtiy with the business rules ? And, is there a solution to associate the BR with the forms automatically ? Tha

  • How to open Excel FIles

    I am a novice When I open excel file  I found some problems. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; usi