How to model ABAP classes in a correct manner?

Hi,
I'm creating a conceptual design for an ABAP Objects program. The program should collect some data from standard tables like VBAK, VBAP, etc. (SD environment) in one flat structure/table, calculate some characteristic numbers for each dataset and finally write the datasets to my own flat DDIC table.
This program should run every day as a planned job. There are some hundred up to 5000 datasets to be collected by my program every day...
Now the question: Is it an usual manner to model a ABAP class representing one dataset. Every collected dataset would be represented by its own object at running time...
I hope there are no performance issues!!
Regards,
Benjamin

Creating "good" OO classes (I mean reusable, easily extendable, simple to use) is not so simple when you have to deal with a complex model. The only solution is first to read many documentations (http://www.sdn.sap.com/irj/scn/advancedsearch?query=ooProgrammingwithABAPObjects) and then experiment by oneself.
This last is important, because even documentation does not provide exact inputs to all scenarios, and to the limits of the used OOP languages.
Note: I already saw people create "bad" OO classes: simple to use and understand in the initial program, but can't be reused or extended at all. In fact, OO programs can be written as badly as a bad procedural program (I mean without OO), and a procedural program can be written as good as a good OO program (yes it's possible!)
I remember I had rewritten complex classes (there was like inheritance from multiple classes) because my initial choice was not the right one, subclasses became standalone classes with delegation to the old parent class, and things like that. If I had initially released my classes in the first version (to be used by other developers), I probably should have duplicated them (more or less) to implement the new functions.
An existing example of classes that you can't reuse for a slightly different goal, are the tree classes (cl_gui_alv_tree, cl_treemodel*, etc.), if you want to handle trees in memory in background (it dumps if you try to use these classes), that you need to duplicate and adapt. It could be used to handle sets (GS01 transaction), menus, workbench objects where-used lists, file system, etc. Even XML tree classes can't really be used to handle non-XML trees. Currently, you have to create your own code to work with trees in memory in background (by creating our own generic tree class, for building and traversing). I feel SAP might have created such a class and used it in all its tree classes (and we could have benefit from it!)
Edited by: Sandra Rossi on May 5, 2010 2:08 PM GMT+1
(Last chapter corrected a little bit)

Similar Messages

  • How to use ABAP Class to modify Web Query Result ??

    Hi all !
    We are using Web Templates to display our Query.
    What I would like to do ( and seems a really important issue for our users! ) is to have a "PAGE BREAK" everytime the value of a charateristics change in the report
    For Example :
    -Page 1-
    Division     Project
       A               1
                        2
                        3
    -Page 2-
    Division     Project
       B               1
                        2
                        3
    and so on....
    I read threads about using ABAP CLASS but no example what so ever...
    We are presently under BW 3.1 but are considering upgrading to 7.0 by the end of the year so if there is a solution to my problem on either version i'd like to know.
    If anyone has any information about how I can do this it would be most appreciated
    Thx
    JB.

    Hi Yong,
    Ravi is right, first check the blogs by Jocelyn, and if you still have specific questions you can ask them. I have used ABAP classes in workflow and I know Mike Pokraka tries to use classes exclusively.
    Regards,
    Martin

  • ABAP class in a Webtemplate

    Hi SDN,
    How to Use ABAP class in a Webtemplate.
    Thanks,
    Pilli

    Hi
    Please find the steps below for the process on how to go
    1. Open your Web template that contains the Web item Table and/or Generic Navigation Block in the BEx Web Application Designer.
    Use the HTML tab page to switch to the HTML view of the Web Application Designer.
      2.      Navigate to the Object Tag of the Web Item Table and/or the Web Item Generic Navigation Block (CL_RSR_WW_ITEM_GRID and/or CL_RSR_WWW_ITEM_NAV_BLOCK) and insert the following parameter line into the HTML:
    <object>u2026
    <param name=u201CMODIFY_CLASSu201C value=u201DYourClassNameu201D/>
    u2026</object>
    <object>u2026
    <param name=u201CMODIFY_CLASSu201C value=u201DZCL_RSR_WWW_MODIFY_TABLEu201D/>
    u2026</object>
       3.      Save the changes.
       4.      Execute the Web template in the browser.
    Many thanks
    kiran
    Edited by: Kirun k on Jul 3, 2009 11:24 AM

  • Create model from abap class

    Hi, I have a problem, I want create a model from an abap class.
    It is possible?, if the answer is yes, ¿how can i do it?

    As Menon said, even I think that it may not be possible to create a model from an abap class. But if it is a requirement to use an abap class in webdynpro I think you can do a work around:
    1.  Create a RFC function module which will contain the instance variable of required abap class.
    2.  This RFC can be imported, and using the variable in the RFC module u can call its methods.
    I haven't worked as such.  But, this may be one way. I am not sure abt it.
    Regards,
    Aparna .P

  • How to use abap memory in global class

    Hi experts,
                     I want to  know how to use abap memory in global class. when i try write export and import statement its showing
    error is export statement does not support in object oriented concept.
    Thanks
    Ramesh Manoharan

    Hi Ramesh,
    Export and import statements were not allowed to use in  classes. Create a global variable in public section of that class of type of  export parameter.Then pass value to the global variable of class  by calling that class.
    by
    Prasad GVK.

  • How to create a model access class ???

    HI,
          Can somebody tell me how to create a Model Access Class. In the Application Set, i can find the Model Access folder, but it has a list of application sets which is already created and the system asks to select a Application set. I need to create a new application set. Please help.
    Regards,
    Shiny

    Hi Shiny,
    I would suggest you not to create a new application set.
    If you are enhancing a standard PCUI application, i would suggest you to create new model access classes and assign them to the same application set which is assigned with the standard model access class for that application.
    Creating a model access class can be done through the transaction SE24(like any other Z-class).
    Go to transaction CRMC_BLUEPRINT_C and you could assign this newly created Model access class to the standard application set. This can be done under Application Element->Application Set->MOdel Access Class.
    If you still feel the need to create a new application set altogether, it can be done from Trx CRMC_BLUEPRINT_C->Layout of PCUI-> Application Element->Application set.
    I hope it helps.
    Cheers,
    Gyan.

  • How to auto refresh planning application -- using ABAP Class?

    Hi
    I have written few planning functions and attached them in one single planning sequence. One of the planning function in this sequence is de-activate data slice checkmark in planning modeler. If I execute this planning function indiviually then it works great however when I use this function in sequence then second function in row doesnot identify changes made by first function(data slice inactivate) and thus throws errors.
    At the same time, if I refresh my planning session and re-execute the planning sequence then it does works as REFRESH activates the changes done by first function (de-activate data slice).
    I am wondering if there is any ABAP class that can trigger this auto refresh in background else some other method to do this auto refresh ?
    Please let me know if you have any thoughts on this one.
    Thanks and happy holidays
    Al
    Edited by: Al Gon on Dec 21, 2007 3:56 AM

    Hi Al,
    The planning fn to deactivate was ineffective in a sequence was because the sequence which executes the functions does it on the data in the buffer and not actually on saved data, while your deactivation would work on the data after its saved.
    You could perhaps run that function separately from the others in the sequence and save the data first and then perform your "deactivation" function.
    Merry Christmas
    Aby

  • Urgent: how to import or transport abap class from dev to q

    How to import/transport custom abap class from dev to q.
    Any suggestions points will be awarded.
    Thanks in advance.
    MK

    hi M K,
    try SE24, your class, and go to menu 'Go to' -> object directory entry,
    click pencil icon and give your package name, will raise request.
    SE10 to release and STMS from prod to import.
    hope this helps.

  • How to Programmatically Create and Activate an ABAP Class

    Hi,
    I have a requirement to programmatically create and activate an ABAP class that implements a 'pre-defined' interface.
    Do you have any ideas how this can be done?
    Thanks,
    Shreevathsa S

    Hi,
       Try if GENRATE SUBROUTINE POOL keyword can be of your help.
    See the below example,
    DATA itab  TYPE TABLE OF string.
    DATA prog  TYPE string.
    DATA class TYPE string.
    APPEND `program.`                     TO itab.
    APPEND `class main definition.`       TO itab.
    APPEND `  public section.`            TO itab.
    APPEND `    class-methods meth.`      TO itab.
    APPEND `endclass.`                    TO itab.
    APPEND `class main implementation.`   TO itab.
    APPEND `  method meth.`               TO itab.
    APPEND `    message 'Test' type 'I'.` TO itab.
    APPEND `  endmethod.`                 TO itab.
    APPEND `endclass.`                    TO itab.
    GENERATE SUBROUTINE POOL itab NAME prog.
    CONCATENATE `\PROGRAM=` prog `\CLASS=MAIN` INTO class.
    CALL METHOD (class)=>meth.
    Regards,
    Sesh

  • How to create internal table storing instances of ABAP class

    Hi experts, any one knows how to create internal table storing instances of ABAP class or alternative to implement such function?

    Hi
    Please see below example from ABAPDOCU, this might help you.
    Internal Table cnt_tab is used to store class objects.
    Regards,
    Vishal
    REPORT demo_objects_references.
    CLASS counter DEFINITION.
      PUBLIC SECTION.
        METHODS: set IMPORTING value(set_value) TYPE i,
                 increment,
                 get EXPORTING value(get_value) TYPE i.
      PRIVATE SECTION.
        DATA count TYPE i.
    ENDCLASS.
    CLASS counter IMPLEMENTATION.
      METHOD set.
        count = set_value.
      ENDMETHOD.
      METHOD increment.
        ADD 1 TO count.
      ENDMETHOD.
      METHOD get.
        get_value = count.
      ENDMETHOD.
    ENDCLASS.
    DATA: cnt_1 TYPE REF TO counter,
          cnt_2 TYPE REF TO counter,
          cnt_3 TYPE REF TO counter,
          cnt_tab TYPE TABLE OF REF TO counter.
    DATA number TYPE i.
    START-OF-SELECTION.
      CREATE OBJECT: cnt_1,
                     cnt_2.
      MOVE cnt_2 TO cnt_3.
      CLEAR cnt_2.
      cnt_3 = cnt_1.
      CLEAR cnt_3.
      APPEND cnt_1 TO cnt_tab.
      CREATE OBJECT: cnt_2,
                     cnt_3.
      APPEND: cnt_2 TO cnt_tab,
              cnt_3 TO cnt_tab.
      CALL METHOD cnt_1->set EXPORTING set_value = 1.
      CALL METHOD cnt_2->set EXPORTING set_value = 10.
      CALL METHOD cnt_3->set EXPORTING set_value = 100.
      DO 3 TIMES.
        CALL METHOD: cnt_1->increment,
                     cnt_2->increment,
                     cnt_3->increment.
      ENDDO.
      LOOP AT cnt_tab INTO cnt_1.
        CALL METHOD cnt_1->get IMPORTING get_value = number.
        WRITE / number.
      ENDLOOP.

  • How to assign a class to the material through ABAP code

    Hi,
    I am working on a transaction in ABAP which takes material name, material description and a class from the user. Now, after this much input I create the material, its configuration profile through the ABAP code. For this I know I have to make relevant entries in tables MARA, MAKT, CUCO.. and also check for the existence of the class in the table KLAH.
    Now the point where I am stuck is that I am not able to get how to assign the class to the material through the code. I am able to get the internal class id from the table KLAH but I am not able to figure how the internal material number is being generated in the table INOB and i need this number as well as the internal class id number to insert a record in the table KSSK to show proper assignment.
    Can anyone please suggest me some solutions?
    Thanks....

    Hi,
    I tried using BAPI_OBJCL_CREATE. In order to understand it functioning better I created a material and class (of type 300) through transactions MM01 and cl01 respectively. Then i  created a report and called the FM BAPI_OBJCL_CREATE, gave the material name as the material above, table as MARA, class as the one i created above and class type 300. I even analysed the message of the table return (return-message) after executing the report. The messahe said assignment done. But when I checked mnaually in cl20n there was no assignment done to the required material. There was also no entry for the required material in the table INOB which I need.
    Can anyoene tell me that where am i going wrong? Please do help.

  • How to find one pipeline service's corresponding ABAP class ?

    Hello guru,
    I am in t-code: SXMB_ADM, then go to "Display Pipeline Definition", for example, I choose "SAP_CENTRAL" and try to investigate the pipeline steps in "SAP_CENTRAL" pipeline, and I find these pipeline steps:
    Receiver Identification is for "Receiver Determination" step, and its' pipeline service" PLSRV_RECEIVER_DETERMINATION", but when I find this Class in SE24, I find nothing with name "PLSRV_RECEIVER_DETERMINATION".
    Please tell me how to find the corresponding ABAP class of a pipeline service.
    Thanks in advance.

    Chen,
    Are u looking for this class -CL_XMS_PLSRV_IE_ADAPTER ? Go to SE80 choose class Interface give SRV and click the down arrow icon, it will give u some list of classes. I don't know if it's useful or not, just do a seach..
    raj.

  • How to Handle Business Object event in ABAP class

    Hello Everybody,
    I wanted to know if it was possible to reference BOR objects in ABAP class and handle BOR events in ABAP Objects.
    Thanks in advance.

    Hi,
    Catch the et_VALIDATE event, when InnerEvent = False and ItemChanged = True.
                If pVal.EventType = BoEventTypes.et_VALIDATE Then
                    If pVal.InnerEvent = False And pVal.ItemChanged Then
                        'TODO Your code here...
                    End If
                End If
    Regards,
    Vítor Vieira

  • How to write ABAP HR reports in ABAP web dynapro

    Hi All,
    How  to write ABAP HR reports in ABAP web dynapro? We can add HR REPORT CATEGORY in ABAP HR using logical database like PNP.How to add HR REPORT CATEGORY in ABAP Webdynapro ?
    Thanks.

    You can't use legacy concepts like logical databases directly in Web Dynpro ABAP.  Even if you could do so, you shouldn't.  Web Dynpro ABAP should always follow MVC - meaning that your business logic (the model) should be separated from WD as much as possible. This means calling function modules or class methods to consume the business logic and data.  So in general there should be no difference between building HR reports or any other type of report in WDA - since from the WDA side you are calling other objects to consume the data. 
    This probably does mean that you will need to create classes to expose the HR data that you want in your WDA.

  • Calling Portal event from ABAP class

    Hi Experts,
    I need a following clarificatrion, Please help,
    1. Is it possible to call a webdynpro method from a normal ABAP class?
    2. If no, we need a functionality of a class 'CL_WDR_HTTP_EXT_MIME_HANDLER' having method 'DO_DOMAIN_RELAX_HTML'.
    Is there any alternative method which can be used in ABAP having the same functionality.
    3. Is there any ways with which we can call portal event from ABAP class?
    Thanks,
    Shabir

    >1. Is it possible to call a webdynpro method from a normal ABAP class?
    I wouldn't necessarily recommend this approach. You shouldn't try to trigger events or any of the standard WDDO* methods from outside the WD Component itself.  That said, you can pass the object reference (like the WD_COMP_CONTROLLER object reference or the View Object Reference) into methods of normal classes.  Be careful if you are finding yourself calling a lot of your added methods from outside WD.  This is probably a sign that these methods should be in the Assistance Class or some other Class functioning as a Model Object.
    >2. If no, we need a functionality of a class 'CL_WDR_HTTP_EXT_MIME_HANDLER' having method 'DO_DOMAIN_RELAX_HTML'.
    Is there any alternative method which can be used in ABAP having the same functionality.
    What exactly do you want to do here?  Do you just want to get the relaxation script?  For what purpose?  You should never need to inject the relaxation script into WDA. 
    >3. Is there any ways with which we can call portal event from ABAP class?
    To what purpose.  Do you just want to delegate the triggering of the event that is inside WD Component to be called from a class?  If so you can pass the portal API object reference into a class from the WD Component.  However this only works while running within WD.
    How is this class used?  Are you running in WD?  Are you trying to generate some HTML code that runs in the portal independent of WD?

Maybe you are looking for