Deffered definition of class

Hi,
I am writing below a small code which says Deffered definition of class.
Can anyone tell me what is the main objective of going for deffered defintion .
1.6 Deferred Definition of a Class
Theme This program will demonstrate how one can refer to a class without defining the class before that point. But, the class has to be defined later on.
Program description In this program , class C1 has an interface reference O2 declared with reference to class C2. But, before that, class C2 is not defined. It is defined later with a single public attribute , NUM .
This demonstrates the theme.
In the main section of the program, object : OBJ1 is created from class C1.
Then, an object is created from the reference variable O2 in class C1. Finally, the attribute num of that object is displayed.
Dump report ysubdel1.
<code>
CLASS C2 DEFINITION DEFERRED.
CLASS C1 DEFINITION.
PUBLIC SECTION.
DATA O2 TYPE REF TO C2.
ENDCLASS.
CLASS C2 DEFINITION.
public section.
data : num type i value 5.
ENDCLASS.
start-of-selection.
data : obj1 type ref to C1.
CREATE OBJECT obj1.
create object obj1->o2.
write:/5 obj1->o2->num .
</code>
Thanks,
satya

Hi,
The reason behind this is simple.
When you create your Module pool program or say Report program with TOP-INCLUDE you will want all you global data to be declared in that place.
Declare a Reference variable of a Local class in the TOP include what you can do is this.
In the TOP include you can mention that DEFINITION is deffered and then create a global variable in the TOP INCLUDE.
Then you can create the Local class in any INCLUDE program.
So basically your TOP include and the INCLUDE program which has the class are two seperate repository objects.
For you to be able to create your data in the TOP include it is useful to use this DEFINITION DEFERRED.
Regards,
Sesh

Similar Messages

  • JAG error: duplicate definition of class

    Hi,
    When I run the JAG it adds duplicate class definitions to my JPR file. For example:
    Error(21,8): duplicate definition of class ky.gov.pwdwo.model.bc4j.handler.PwdWorkOrderHandlerImpl
    I can compile and run the application after I remove the duplicates from the JPR file.
    Any thoughts?
    Cheers,
    Patrick Cimolini

    Patrick,
    This can happen if the source path defined in the JHeadstart Application Structure File does not match the source path of the project properties. You probably already had existing handlers in the project's source path, and then JHeadstart generates another set in the source path indicated by the Application Structure File (which appear in the System Navigator under Miscellaneous Files).
    So if you change the Application Structure File's source path setting to be equal to the source path of your project, and remove the handlers from the other path, then it should be OK.
    Hope this helps,
    Sandra Muller
    JHeadstart Team
    Oracle Consulting

  • "duplicate definition of class x"

    I moved a class from one directory to another. Now JDev 3.0 gives me the error "Duplicate definition of class x".
    I've tried rebuild. I've tried deleteing all the class files. I've tried exiting JDev and restart it.
    I still get the error. How do I get rid of this error?

    I can compile just the class x with no problem. When I do a make or rebuild of the project, then the problem happens.

  • Extension definition for class discussionsTNG.Message (FCI_DISCTNG_MESSAGE)

    Hi Experts,
    I have a requirement to insert a new custom field creating a message for a discussion in a Master Agreement document.
    I have tried to create an Extension Definition but the required field Extended Class Name is not available the class for the message.
    Do yo know if is possible configure with the Extension Reference Types the required extended class name to create the extension definition?
    Thanks in advance!
    Best Regards,
    Fran.

    Hello Vikram,
    Thanks for your reply!
    One additional question... Is supported the extension for standard collection tables?
    For example, it is possible to add a new custom field in the standard collaborator collection table for master agreement document?
    Best Regads,

  • BADI - Diff. Class generated in Definition and Implementation

    Hi all,
    When we define a BADI,  a BADI class is generated.  When we implement the BADI, another class is generated. 
    1) What is the difference between these 2 classes?
    2) As I know, we use the class generated in Implementation to instantiate and call the BADI method in our program.  What about the class generated in Definition?  What is it used for?
    Thanks.

    I noticed that under Definition, the class generated is with cat= Exit class while under Implementation, the class generated is with cat= general object type.  Both can be instantiated for use in ABAP program.
    What is the difference/usage of these 2 generated classes?

  • CLASS ... Definition LOAD in Smartforms

    Hi all,
    does anybody know how to attached definition of class (containing only static methods and constants, so no instance will be created) to smartforms? Statement class ... definition load under section "Initialization" doesn't work (i cant use constants f.e. on condition tabs of text node) i get then always message: "Direct access to components of the global class ZCL_SE_CONST is not possible (CLASS ZCL_SE_CONST DEFINITION LOAD statement is mi" SAP 4.6C
    Thank you.
    Juzio
    Message was edited by:
            Juzio Kowlaski

    Hi,
    In SAP 4.6C  you need to use the statement 'CLASS ... DEFINITION LOAD' to access to class's static components.
    Eg. :
    Report ...
    TYPE-POOLS abap.
    CLASS cl_abap_objectdescr DEFINITION LOAD.
    DATA: line     TYPE c LENGTH 80,
    RG,
    Hung.

  • Conversion of association in ClassDiagram to class definition?

    I have a doubt regarding association in class diagram and actual definition of clasees. Say we have two classes customer and order. Customer can give N orders while one order belongs to one customer. So when we draw the class diagram we can represent this relationship with bidirectional arrow between customer and order with N written on order side and 1 written on customer side .correct?
    Now when we convert this class diagram to actual definition of class, can we simply say customer object will have array of order objects and order object will have a customer object associated with it?
    Now lets change the scenario little bit,order object does not know anything about customer objects. In that case order object will not contain customer, rest will be same as above.
    Is this correct?

    Say we have two classes customer and order. Customer can give N orders while one order belongs to one customer. So when we draw the class diagram we can represent this relationship with bidirectional arrow between customer and order with N written on order side and 1 written on customer side .correct?Yes.
    Now when we convert this class diagram to actual definition of class, can we simply say customer object will have array of order objects and order object will have a customer object associated with it?Well, I'd warn you against three things:
    1) A UML diagram is always, and almost always purposefully, uncomplete: a class diagram represents one aspect of classes, but not necessarily all the features and associations of these classes. You may very well have a diagram that shows a unidirectional association (because for the purpose of what the diagram illustrates, only that direction is meaningful, while another diagram shows an association in the opposite direction, for another purpose.
    I know in your example you already have a bi-directional association, I just want to point out that you do not convert one diagram to code, you merely convert a model (~ a set of diagrams) to code.
    2) Depending on the diagram's intent (e.g. domain class diagram vs design class diagram), not all associations translate to references. For example, depending on how the Customer and Order instances are created, fetched, used,... you might end up with classes that don't even know eachother (and that are simply used jointly by a higher level business logic class, say DatabaseRetriever ). OK that's a bit far-fetched, but again a diagram, especially a class diagram, does not necessarily express code, merely concepts. Again convert the model (set of diagrams), not one single diagram.
    3) A class diagram says little about the business logic of the various classes. Sequence or collaboration diagrams give more insight on the business logic. You might think that the class diagrams translate to structure, and the sequence diagram, to method bodies, but that's not that simple: for example the class diagram does not say whether the number of Order instances may change for a given Customer instance: if so, you'd better use a dynamic collection of orders in that latter, such as a <tt>List<Order></tt> rather than a fixed-length array <TT>Order[]</TT> .
    Again don't convert a diagram, instead convert a model (set of diagrams, both structure diagrams and dynamic diagrams).
    J.

  • Abour report containing classes - urgent pls

    hi to all,
                i have to study this report and analyse output coming how.  iam in debugging observed that value(total) last column in the output giving some value in debugging but in output it is giving some other value.  can any one pls help me.
    like if in debugging it is giving total-as -68.13 but in grid display it is displaying as 473.10 like.
    REPORT ZFIRD035  MESSAGE-ID zfi_e1
                     NO STANDARD PAGE HEADING
                     LINE-COUNT 58
                     LINE-SIZE 200.
    Author.......:*
    Date Created.: Aug 21, 2006
    Request #....:                                                       *
    Purpose......: This program summarizes accounting journal entries
                   by biller. The biller is recognized by the first three
                   chararcters of the reference field.
    Inputs.......:
    Outputs......:                                                       *
    Selections...:                                                       *
    Logical D/B..:                                                       *
    Includes.....:                                                       *
    Predefine a local class for event handling to allow the
    declaration of a reference variable before the class is defined.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    TABLES:
       bkpf,                               "Accounting document header
       bseg,                               "Accounting document segment
       zmapzce1.                           "CostElement to ZCE1COPA Mapping
    TYPES: BEGIN OF disp_tab ,             "Internal Table D_TAB
          usnam   LIKE bkpf-usnam,         "User Id
          blart   LIKE bkpf-blart,         "Document type
          bukrs   LIKE bkpf-bukrs,         "Company code
          bldat   LIKE bkpf-bldat,         "Date of the document
          xblnr   LIKE bkpf-xblnr,         "refernce number
          belnr   LIKE bkpf-belnr,         "Accounting document number
          buzei   LIKE bseg-buzei,         "Line Item Number
          prctr   LIKE bseg-prctr,         "Profit center
          kostl   LIKE bseg-kostl,         "Cost center
          hkont   LIKE bseg-hkont,         "Account number
          matnr   LIKE bseg-matnr,         "Product code
          aufnr   LIKE bseg-aufnr,         "Internal order
          projk   LIKE bseg-projk,         "WBS Element
          budat   LIKE bkpf-budat,         "Posting date
          bschl   LIKE bseg-bschl,         "Posting Key
          dmbtr   LIKE bseg-dmbtr,         "Amount in document currency
          sgtxt   LIKE bseg-sgtxt,         "Description
          zuonr   LIKE bseg-zuonr,         "Allocation
          shkzg   LIKE bseg-shkzg,         "Debit/Credit Indicator
    END OF disp_tab.
    DATA: gv_prdha_all   LIKE mara-prdha.
    FIELD-SYMBOLS: .
    DATA: BEGIN OF   gv_prdha,
            wwph1(5)  TYPE c,
            wwph2(5)  TYPE c,
            wwph3(8)  TYPE c.
    DATA: END  OF   gv_prdha.
    DATA  save_matnr LIKE mara-matnr.
    DATA: d_tab TYPE disp_tab OCCURS 0 WITH HEADER LINE.
    TYPES:  BEGIN OF out_tab2.                      "Internal Table out_TAB
            INCLUDE STRUCTURE zfirevje.
    TYPES:  END   OF out_tab2.
    DATA: BEGIN OF zfirevje OCCURS 50.
            INCLUDE STRUCTURE zfirevje.
    DATA: END   OF zfirevje.
    DATA: ok_code     LIKE sy-ucomm,
          gt_jesum    TYPE TABLE OF zfirevje,
          gt_jesum2   TYPE zfirevje OCCURS 100 WITH HEADER LINE,
          g_container TYPE scrfname VALUE 'ZFIRD035_0100_CONT1',
    Start of Change - DR1K901005 - JIRA#: ENT-93----
    *>>> Added:
        Field catalog table
          git_fieldcat TYPE lvc_t_fcat,  "field catalog table
    End of Change - DR1K901005 - JIRA#: ENT-93----
          grid1  TYPE REF TO cl_gui_alv_grid,
          g_custom_container TYPE REF TO cl_gui_custom_container,
          event_receiver TYPE REF TO lcl_event_receiver.
    lcl_event_receiver (Implementation)
    LOCAL CLASSES: Definition
    *===============================================================
    class lcl_event_receiver: local class to handle event DOUBLE_CLICK
                              and CLOSE.
    Definition:
    ~~~~~~~~~~~
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
        handle_double_click
            FOR EVENT double_click OF cl_gui_alv_grid
                IMPORTING e_row e_column.
      PRIVATE SECTION.
       DATA: dialogbox_status TYPE c.  "'X': does exist, SPACE: does not ex.
    ENDCLASS.
    lcl_event_receiver (Definition)
    *===============================================================
    LOCAL CLASSES: Implementation
    *===============================================================
    class c_event_receiver (Implementation)
    In this example, only event DOUBLE_CLICK is caught
    CLASS lcl_event_receiver IMPLEMENTATION.
    §3.At doubleclick(1): The event DOUBLE_CLICK provides
       parameters of the clicked row and column.
       Use row parameter to select a line of the
       corresponding internal table.
      METHOD handle_double_click.
        DATA: ls_jesum  LIKE LINE OF gt_jesum.
    read selected row from internal table gt_sflight
       read table gt_jesum index e_row-index into ls_jesum.
       call function 'REMD_SHOW_MASTER_DATA'
           exporting
                i_objnr                 = ls_jesum-recnobjnr
                  I_IMKEY                 =
                  I_INTRENO               =
                  I_CHANGE                = ' '
           exceptions
                unknown_type            = 1
                object_key_inconsistent = 2
                others                  = 3.
      ENDMETHOD.
    ENDCLASS.
    DATA: x_save,                          "for Parameter I_SAVE
          gs_layout  TYPE lvc_s_layo,
          gs_variant TYPE disvariant.      "for parameter IS_VARIANT
    DATA: BEGIN OF fieldnames OCCURS 25,
           fieldname(30)    TYPE c,        "download col names
          END OF fieldnames.
    DATA:
          program_name     LIKE sy-repid,   "Program Name for Call
          title_line_1     LIKE sy-title,   "Report Title Line 1
          title_line_2     LIKE sy-title,   "Report Title Line
          title_line_3     LIKE sy-title,   "Report Title Line
          sum_cdmbtr       LIKE bseg-dmbtr, "Sum credit amt for document
          sum_ddmbtr       LIKE bseg-dmbtr, "Sum debit amt for document
          total_cdmbtr     LIKE bseg-dmbtr, "Total credit amount
          total_ddmbtr     LIKE bseg-dmbtr, "Total debit amount
          ddmbtr           LIKE bseg-dmbtr, "Debit amount
          cdmbtr           LIKE bseg-dmbtr, "Credit amount
          dec_dmbtr(16)    TYPE p DECIMALS 2, "Amount in decimal format
          disp_prctr(5)    TYPE c,          "Work var for prctr
          gv_zuonr         LIKE bseg-zuonr, "Assignment field
          gv_shkzg         LIKE bseg-shkzg, "Dr/Cr Ind.
          gv_hkont         LIKE bseg-hkont, "Account nbr
          gv_amount        LIKE bseg-pswbt, "G/L amount
          gv_currncy       LIKE bseg-pswsl, "Currency
          gv_matnr         LIKE bseg-matnr, "Product
          BEGIN OF w_filename,
             w_directory(22) TYPE c,       "file directory name
             w_userid(7)     TYPE c,       "User Id
             w_filenm2(20)   TYPE c,       "file name continuation
          END OF w_filename.
    Selection Screen Options  ******************
    SELECTION-SCREEN BEGIN OF BLOCK rpt WITH FRAME TITLE text-003.
    SELECT-OPTIONS:  sbukrs  FOR  bkpf-bukrs OBLIGATORY,
                     sbelnr  FOR  bkpf-belnr,
                     sgjahr  FOR  bkpf-gjahr OBLIGATORY,
                     smonat  FOR  bkpf-monat OBLIGATORY,
                     sxblnr  FOR  bkpf-xblnr,
                     sprctr  FOR  bseg-prctr,
                    shkont  FOR  bseg-hkont.
                     shkont  FOR zmapzce1-saknr."G/L account number
    Start of Change - DR1K901005 - JIRA#: ENT-93----
    *>>> Removed:
    *SELECTION-SCREEN BEGIN OF LINE.
    *SELECTION-SCREEN            COMMENT 1(31) text-005.
    *PARAMETERS: p_pdtls         AS CHECKBOX DEFAULT ' '.         "flag
    *SELECTION-SCREEN END OF LINE.
    *SELECTION-SCREEN BEGIN OF LINE.
    *SELECTION-SCREEN            COMMENT 1(31) text-004.
    *PARAMETERS: p_hdtls         AS CHECKBOX DEFAULT ' '.         "flag
    *SELECTION-SCREEN END OF LINE.
    End of Change - DR1K901005 - JIRA#: ENT-93----
    SELECTION-SCREEN END OF BLOCK rpt.
    INITIALIZATION.
    init accounts
      MOVE 'I'             TO shkont-sign.
      MOVE 'EQ'            TO shkont-option.
    Start of Change - DR1K901005 - JIRA#: ENT-93----
    *>>> Removed:
    MOVE '0000200000'    TO shkont-low.
    MOVE '0000299999'    TO shkont-high.
    *>>> Added:
    MOVE '0000400100'    TO shkont-low.
    MOVE '0000400199'    TO shkont-high.
    End of Change - DR1K901005 - JIRA#: ENT-93----
    APPEND shkont.
    START-OF-SELECTION.
    set pf-status 'VDOC'.
      PERFORM get_je_data
         TABLES gt_jesum.
      IF sy-subrc  = 0.
        CALL SCREEN 100.
      ELSE.
        MESSAGE ID 'F5' TYPE 'S' NUMBER '194'.
      ENDIF.
    END-OF-SELECTION.
    *&      Form get_je_data
          loads the internal table for jesum
    FORM get_je_data TABLES gt_jesum STRUCTURE zfirevje.
      SELECT *
         FROM bkpf
         WHERE bukrs IN sbukrs
           AND belnr IN sbelnr
           AND gjahr IN sgjahr
           AND monat IN smonat
           AND xblnr IN sxblnr.
        PERFORM save_to_dtab.
        CLEAR: gv_zuonr, gv_shkzg, gv_amount,
               gv_hkont, gv_currncy, gv_matnr.
        SELECT   zuonr shkzg pswbt
                 pswsl hkont matnr
           INTO (gv_zuonr,   gv_shkzg, gv_amount,
                 gv_currncy, gv_hkont, gv_matnr)
           FROM bseg
           WHERE bukrs EQ bkpf-bukrs "IN sbukrs
           AND belnr   EQ bkpf-belnr "IN sbelnr
           AND gjahr   EQ bkpf-gjahr "IN sgjahr
           AND hkont   IN shkont
           AND prctr   IN sprctr.
          PERFORM save_to_outtab TABLES gt_jesum.
        ENDSELECT.
      ENDSELECT.
    ENDFORM.
          FORM SAVE_TO_DTAB                                            *
    FORM save_to_dtab.
      CLEAR d_tab.
      MOVE-CORRESPONDING bkpf TO d_tab.
      APPEND d_tab.
    ENDFORM.
          FORM SAVE_TO_OUTTAB                                            *
    FORM save_to_outtab TABLES gt_jesum STRUCTURE zfirevje.
      DATA:  tempamount  LIKE tdrxx-wrbtr,
             subacct(2)  TYPE c.
      CLEAR:  gt_jesum,  tempamount, subacct.
      IF d_tab-xblnr+0(1) = '@'.
        gt_jesum-zbiller   = d_tab-xblnr+1(2).
    Start of Change - DR1K901241 - JIRA#: ENT-102----
    *>>> Removed:
       gt_jesum-zcyclenbr = gv_zuonr+6(2).
    *>>> Added:
        gt_jesum-zcyclenbr = gv_zuonr+3(2).
        SELECT SINGLE zbillname
           INTO  gt_jesum-zbillname
           FROM  zbillers
           WHERE zbiller = gt_jesum-zbiller.
        IF sy-subrc <> 0.
           gt_jesum-zbillname = 'Non-biller entries'.
        ENDIF.
    End of Change - DR1K901241 - JIRA#: ENT-102----
      ELSE.
        gt_jesum-zbiller   = d_tab-xblnr+0(2).
        gt_jesum-zbillname = 'Non-biller entries'.
      ENDIF.
    *>>> Removed:  IES out now identified by biller @NX
    IF  gt_jesum-zbillname    = 'IES'.
      IF  gv_matnr         IS INITIAL.
        gt_jesum-zbillname      = 'IES-OUT'.
      ELSE.
        gt_jesum-zbillname      = 'IES-IN'.
      ENDIF.
    ENDIF.
    Start of Change - DR1K901241 - JIRA#: ENT-102----
    *>>> Removed:
    gt_jesum-zruntype  = gv_zuonr+3(2).
    *>>> Added:
      gt_jesum-zruntype  = gv_zuonr(2).
    End of Change - DR1K901241 - JIRA#: ENT-102----
      IF d_tab-xblnr+0(1) = '@'.
        CASE gt_jesum-zruntype.
          WHEN 'RB'.     gt_jesum-zruntype_desc = 'Billed'.
          WHEN 'UB'.     gt_jesum-zruntype_desc = 'Unbilled'.
          WHEN OTHERS.   gt_jesum-zruntype_desc = 'Other bller entries'.
        ENDCASE.
      ELSE.
        gt_jesum-zruntype_desc = 'Non-biller entry'.
      ENDIF.
      IF gv_shkzg    = 'H'.
        tempamount =  gv_amount * -1.
      ELSE.
        tempamount =  gv_amount.
      ENDIF.
      subacct  =   gv_hkont+8(2).
      CASE subacct.
        WHEN '00'.                "Gross Billing
          gt_jesum-vvgrb001 = tempamount.
        WHEN '80'.                "Accruals
          gt_jesum-vvbaa001 = tempamount.
        WHEN '85'.                "Reversals
          gt_jesum-vvrba001 = tempamount.
        WHEN '15'.                "Discount
          gt_jesum-vvdis001 = tempamount.
        WHEN '81'.                "Discount Accruals
          gt_jesum-vvdac001 = tempamount.
        WHEN '86'.                "Discount Reversals
          gt_jesum-vvrda001 = tempamount.
        WHEN '70'.                "Other
          gt_jesum-vvoth001 = tempamount.
        WHEN '65'.                "Sale Allowance
          gt_jesum-vvsa001  = tempamount.
        WHEN '60'.                "Reba  tes
          gt_jesum-vvrab001 = tempamount.
        WHEN '10'.                "Adjustments
          gt_jesum-vvadj001 = tempamount.
        WHEN '75'.                "Manual Bils
          gt_jesum-vvman001 = tempamount.
        WHEN '20'.                "Inbound Settlements
          gt_jesum-vvinb001  = tempamount.
      ENDCASE.
      gt_jesum-total = tempamount.
      gt_jesum-pswsl = gv_currncy.
    Start of Change - DR1K901005 - JIRA#: ENT-93----
    *>>> Removed:
    IF p_pdtls = 'X' OR p_hdtls = 'X'.
       PERFORM get_product_hierarchy
               USING     gv_matnr
               CHANGING  gt_jesum-matnr
                         gt_jesum-wwph1
                         gt_jesum-wwph2
                         gt_jesum-wwph3.
    ENDIF.
    End of Change - DR1K901005 - JIRA#: ENT-93----
      COLLECT gt_jesum.
    SORT gt_jesum BY zbiller zruntype.
    ENDFORM.
          MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'MAIN100'.
      IF g_custom_container IS INITIAL.
        CREATE OBJECT g_custom_container
               EXPORTING container_name = g_container
            EXCEPTIONS
                cntl_error = 1
                cntl_system_error = 2
                create_error = 3
                lifetime_error = 4
                lifetime_dynpro_dynpro_link = 5.
        CREATE OBJECT grid1
               EXPORTING i_parent = g_custom_container.
        CALL METHOD grid1->get_frontend_layout
         IMPORTING
            es_layout   = gs_layout.
        gs_layout-cwidth_opt = 'X'.
        CALL METHOD grid1->set_3d_border
         EXPORTING
          border  =   1.
        gs_layout-grid_title  =
          'Revenue journal entry summary by biller and type'(100).
        x_save = 'A'.
        gs_variant = '/ZFIRD035'.
    Start of Change - DR1K901005 - JIRA#: ENT-93----
    *>>> Added:
        PERFORM prepare_field_catalogue.
    End of Change - DR1K901005 - JIRA#: ENT-93----
        CALL METHOD grid1->set_table_for_first_display
             EXPORTING
    Start of Change - DR1K901005 - JIRA#: ENT-93----
    *>>> Removed:
                      i_structure_name = 'ZFIREVJE'
    End of Change - DR1K901005 - JIRA#: ENT-93----
                       is_variant       = gs_variant
                       is_layout        = gs_layout
                       i_save           = x_save
             CHANGING  it_outtab        = gt_jesum
    Start of Change - DR1K901005 - JIRA#: ENT-93----
    *>>> Added:
                       it_fieldcatalog  = git_fieldcat[]
    End of Change - DR1K901005 - JIRA#: ENT-93----
    ->Create Object to receive events and link them to handler methods.
    When the ALV Control raises the event for the specified instance
    the corresponding method is automatically called.
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_double_click FOR grid1.
    *CALL METHOD grid1->refresh_table_display
         EXPORTING
            IS_STABLE    = <structure of type LVC_S_STBL >
            I_SOFT_REFRESH    = 'X'.
      ENDIF.
    ENDMODULE.
          MODULE PAI INPUT                                              *
    MODULE pai INPUT.
      to react on oi_custom_events:
      DATA: lt_t_row      TYPE  lvc_t_row,
            wa_t_row      LIKE  LINE OF lt_t_row,
            ls_jesum      LIKE  LINE OF gt_jesum.
      CALL METHOD cl_gui_cfw=>dispatch.
      CASE ok_code.
        WHEN 'EXIT'.
          PERFORM exit_program.
        WHEN 'BACK'.
         PERFORM exit_listing.
        WHEN OTHERS.
        do nothing
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.
          FORM EXIT_PROGRAM                                             *
    FORM exit_program.
      CALL METHOD g_custom_container->free.
      CALL METHOD cl_gui_cfw=>flush.
      LEAVE PROGRAM.
    ENDFORM.
    *&      Form  exit_Listing
          text
    -->  p1        text
    <--  p2        text
    FORM exit_listing.
      CALL METHOD g_custom_container->free.
      CALL METHOD cl_gui_cfw=>flush.
      LEAVE TO TRANSACTION 'ZF06'.
    ENDFORM.                               " exit_Listing
    *&      Form  get_product_hierarchy
          text
         -->P_GV_MATNR  text
         <--P_GT_WWPH1  text
         <--P_GT_WWPH2  text
         <--P_GT_WWPH3  text
    FORM get_product_hierarchy USING    p_gv_matnr
                               CHANGING p_gt_matnr
                                        p_gt_wwph1
                                        p_gt_wwph2
                                        p_gt_wwph3.
      IF p_gv_matnr  = gv_prdha_all.
          ENDIF.
        ENDSELECT.
      ELSE.
      ENDIF.
    Start of Change - DR1K901005 - JIRA#: ENT-93----
    *>>> Removed:
    IF p_pdtls = 'X'.
       p_gt_matnr = p_gv_matnr.
    ENDIF.
    IF p_hdtls = 'X'.
       p_gt_wwph1 = gv_prdha-wwph1.
       p_gt_wwph2 = gv_prdha-wwph2.
       p_gt_wwph3 = gv_prdha-wwph3.
    ENDIF.
    End of Change - DR1K901005 - JIRA#: ENT-93----
    ENDFORM.                    " get_product_hierarchy
    Start of Change - DR1K901005 - JIRA#: ENT-93----
    *>>> Added:
          FORM prepare_summary_catalogue
          Prepare catalogue for Report
    FORM prepare_field_catalogue.
      DATA: lwa_fieldcat TYPE lvc_s_fcat.
      REFRESH: git_fieldcat.
      CLEAR git_fieldcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
        I_BUFFER_ACTIVE              =
          I_STRUCTURE_NAME             = 'ZFIREVJE'
        I_CLIENT_NEVER_DISPLAY       = 'X'
        I_BYPASSING_BUFFER           =
        CHANGING
          ct_fieldcat                  = git_fieldcat
        EXCEPTIONS
          INCONSISTENT_INTERFACE       = 1
          PROGRAM_ERROR                = 2
          OTHERS                       = 3
      IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Do not display Material, ProH1, ProH2, and ProHLe3.
      READ TABLE git_fieldcat INTO lwa_fieldcat
           WITH KEY fieldname = 'MATNR'.
      lwa_fieldcat-no_out = 'X'.
      MODIFY git_fieldcat FROM lwa_fieldcat INDEX sy-tabix.
      READ TABLE git_fieldcat INTO lwa_fieldcat
           WITH KEY fieldname = 'WWPH1'.
      lwa_fieldcat-no_out = 'X'.
      MODIFY git_fieldcat FROM lwa_fieldcat INDEX sy-tabix.
      READ TABLE git_fieldcat INTO lwa_fieldcat
           WITH KEY fieldname = 'WWPH2'.
      lwa_fieldcat-no_out = 'X'.
      MODIFY git_fieldcat FROM lwa_fieldcat INDEX sy-tabix.
      READ TABLE git_fieldcat INTO lwa_fieldcat
           WITH KEY fieldname = 'WWPH3'.
      lwa_fieldcat-no_out = 'X'.
      MODIFY git_fieldcat FROM lwa_fieldcat INDEX sy-tabix.
    ENDFORM.                    "prepare_field_catalogue
    End of Change - DR1K901005 - JIRA#: ENT-93----

    Hi,
    I would suggest that you post this on the ABAP forum.
    From a functional point of view is there any exchange rate involved that is converting the field to the local currency?
    Steve B

  • Program using class "cl_salv_table"

    Hi Experts,
    I am new to this class (cl_salv_table). I wrote a program with general ABAP code. But, according to my standard I should use standard ALV factory class i.e., 'CL_SALV_TABLE'.  I wouls appreciate if anybody could send me the code using this class. Here is the code which I have written.
    REPORT zrgae_acctquery
            NO STANDARD PAGE HEADING
            LINE-SIZE 190
            LINE-COUNT 65
            MESSAGE-ID zrga.
    Program Title  : SAP Account Coding Block Transaction Query Program*
    Description   : This program loads the legacy General Ledger                *
                          account monthly net activity into the SAP-FI                   *
                          system using LSMW.  This conversion pertains to           *
                          companyu2019s GL account balances beginning with              *
                          FY07 YE, posting monthly net changes in the                 *
                         accounts for FY2008 and FY2009 through go-live.             *
    Run Frequency: The Z-transaction must be available at any time             *
                    an end user requires the conversion information.                    *
                    T A B L E  D E C L A R A T I O N                   
    TABLES: ztt_rga_xreft.
                    D A T A  D E C L A R A T I O N                      
    DATA: group_id(3) TYPE c,
          l_line TYPE i.
                    I N T E R N A L  T A B L E S                        
    TYPES: BEGIN OF lty_ztt_rga_xreft,
           ctacct TYPE ztt_rga_xreft-ctacct,
           ctrc01 TYPE ztt_rga_xreft-ctrc01,
           ctrc02 TYPE ztt_rga_xreft-ctrc02,
           ctrc03 TYPE ztt_rga_xreft-ctrc03,
           ctrc04 TYPE ztt_rga_xreft-ctrc04,
           ctrc05 TYPE ztt_rga_xreft-ctrc05,
           ctrc06 TYPE ztt_rga_xreft-ctrc06,
           ctrc07 TYPE ztt_rga_xreft-ctrc07,
           ctrc08 TYPE ztt_rga_xreft-ctrc08,
           bukrs TYPE ztt_rga_xreft-bukrs,
           prctr TYPE ztt_rga_xreft-prctr,
           kostl TYPE ztt_rga_xreft-kostl,
           saknr TYPE ztt_rga_xreft-saknr,
           aufnr TYPE ztt_rga_xreft-aufnr,
           sap_offset TYPE ztt_rga_xreft-sap_offset,
           END OF lty_ztt_rga_xreft.
    DATA: lt_data TYPE STANDARD TABLE OF lty_ztt_rga_xreft,       lwa_data TYPE lty_ztt_rga_xreft.
               S E L E C T I O N   S C R E E N   D E F I N I T I O N S  *
    SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
    PARAMETERS: p_lgsap RADIOBUTTON GROUP b1 USER-COMMAND rad DEFAULT 'X',
                p_saplg RADIOBUTTON GROUP b1.
    SELECTION-SCREEN END OF BLOCK a1.
    SKIP.
    SELECTION-SCREEN BEGIN OF BLOCK a2 WITH FRAME TITLE text-002. "ACC
    SELECT-OPTIONS: s_lccode FOR ztt_rga_xreft-ctrc01 MODIF ID acc,
                    s_ldiv FOR ztt_rga_xreft-ctrc02 MODIF ID acc,
                    s_lreg FOR ztt_rga_xreft-ctrc03 MODIF ID acc,
                    s_lloc FOR ztt_rga_xreft-ctrc04 MODIF ID acc,
                    s_lcctr FOR ztt_rga_xreft-ctrc05 MODIF ID acc,
                    s_lacct FOR ztt_rga_xreft-ctrc06 MODIF ID acc,
                    s_lsacct FOR ztt_rga_xreft-ctrc07 MODIF ID acc.
    SELECTION-SCREEN END OF BLOCK a2.
    SKIP.
    SELECTION-SCREEN BEGIN OF BLOCK a3 WITH FRAME TITLE text-003. "ALL
    SELECT-OPTIONS: s_bukrs FOR ztt_rga_xreft-bukrs MODIF ID all,
                    s_prctr FOR ztt_rga_xreft-prctr MODIF ID all,
                    s_kostl FOR ztt_rga_xreft-kostl MODIF ID all,
                    s_saknr FOR ztt_rga_xreft-saknr MODIF ID all,
                    s_aufnr FOR ztt_rga_xreft-aufnr MODIF ID all.
    SELECTION-SCREEN END OF BLOCK a3.
    A T  S E L E C T I O N  S C R E E N                 
    AT SELECTION-SCREEN OUTPUT.
      CASE 'X'.
        WHEN p_saplg.
          group_id = 'ACC'.
          SET CURSOR FIELD 'S_BUKRS-LOW'.
        WHEN p_lgsap.
          group_id = 'ALL'.
          SET CURSOR FIELD 'S_LCCTR-LOW'.
      ENDCASE.
      LOOP AT SCREEN.
        IF screen-group1 = group_id.
          screen-input = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
                    S T A R T  O F  S E L E C T I O N                   
    START-OF-SELECTION.
      CLEAR l_line.
      IF p_lgsap = 'X'.  " If legacy input filled
               INFINIUM CASE-I VALIDATIONS & OUTPUT                                *
               PASSING INFINIUM 'COST CENTER','ACCOUNT',& 'SUB ACCT'    *
        IF s_lcctr-low NE ' ' AND s_lacct-low NE ' ' AND s_lsacct-low NE ' '.
          SELECT ctrc01
                 ctrc02
                 ctrc03
                 ctrc04
                 ctrc05
                 ctrc06
                 ctrc07
                 ctrc08
                 bukrs
                 prctr
                 kostl
                 saknr
                 aufnr
                 sap_offset
                 FROM ztt_rga_xreft INTO TABLE lt_data
                                    WHERE ctrc05 IN s_lcctr
                                    AND ctrc06 IN s_lacct
                                    AND ctrc07 IN s_lsacct.
          DESCRIBE TABLE lt_data LINES l_line.
          IF l_line < 0.
            MESSAGE e001(zrga) with 'Cost Ctr,Acct,SubAcct are not valid.pl check'.
          ENDIF.
        INFINIUM CASE-II VALIDATIONS & OUTPUT                    *
        PASSING INFINIUM 'COST CENTER'&'ACCOUNT'                 *
        ELSEIF s_lcctr-low NE ' ' AND s_lacct-low NE ' '
             AND s_lsacct-low EQ ' '.
          SELECT ctrc01
                 ctrc02
                 ctrc03
                 ctrc04
                 ctrc05
                 ctrc06
                 ctrc07
                 ctrc08
                 bukrs
                 prctr
                 kostl
                 saknr
                 aufnr
                 sap_offset
              FROM ztt_rga_xreft INTO TABLE lt_data WHERE ctrc05 IN s_lcctr
                                                     AND ctrc06 IN s_lacct.
          DESCRIBE TABLE lt_data LINES l_line.
          IF l_line < 0.
            MESSAGE e002(zrga) with 'Cost Center,Account are not valid...pl check'.
          ENDIF.
        ENDIF.
              INFINIUM CASE-III VALIDATIONS & OUTPUT                   *
               PASSING INFINIUM 'COMPANY CODE'&'ACCOUNT'                *
      ELSEIF s_lccode-low NE ' ' AND s_lacct-low NE ' '.
        SELECT ctrc01
               ctrc02
               ctrc03
               ctrc04
               ctrc05
               ctrc06
               ctrc07
               ctrc08
               bukrs
               prctr
               kostl
               saknr
               aufnr
               sap_offset
            FROM ztt_rga_xreft INTO TABLE lt_data WHERE ctrc01 IN s_lccode
                                                  AND ctrc06 IN s_lacct.
        DESCRIBE TABLE lt_data LINES l_line.
        IF l_line < 0.
        MESSAGE e003(zrga) with 'Company code,Acct are not valid.pl check'.
        ENDIF.
      ELSE. " If SAP input filled
               SAP CASE-I VALIDATIONS & OUTPUT                          *
               PASSING SAP 'COST CENTER','ACCOUNT'&'INTERNAL ORDER'     *
        IF s_kostl-low NE ' ' AND s_saknr-low NE ' ' AND s_aufnr-low NE ' '.
          SELECT ctrc01
                 ctrc02
                 ctrc03
                 ctrc04
                 ctrc05
                 ctrc06
                 ctrc07
                 ctrc08
                 bukrs
                 prctr
                 kostl
                 saknr
                 aufnr
                 sap_offset
              FROM ztt_rga_xreft INTO TABLE lt_data WHERE kostl IN s_kostl
                                               AND saknr IN s_saknr
                                               AND aufnr IN s_aufnr.
          DESCRIBE TABLE lt_data LINES l_line.
          IF l_line < 0.
            MESSAGE e004(zrga) with 'Cost Ctr,Acct,Int order are not valid...pl check'.
                  ENDIF.
               SAP CASE-II VALIDATIONS & OUTPUT                         *
               PASSING SAP 'COST CENTER'&'ACCOUNT'                      *
    ELSEIF s_kostl-low NE ' ' AND s_saknr-low NE ' ' AND s_aufnr-low EQ ' '.
          SELECT ctrc01
                 ctrc02
                 ctrc03
                 ctrc04
                 ctrc05
                 ctrc06
                 ctrc07
                 ctrc08
                 bukrs
                 prctr
                 kostl
                 saknr
                 aufnr
                 sap_offset
                 FROM ztt_rga_xreft INTO TABLE lt_data WHERE kostl IN s_kostl
                                          AND saknr IN s_saknr.
          DESCRIBE TABLE lt_data LINES l_line.
          IF l_line < 0.
          MESSAGE e005(zrga) with 'Cost Ctr,Acct are not valid...pl check'.
          ENDIF.
        ENDIF.
      ENDIF.
                    O U T P U T                                         
      IF p_lgsap = 'X'.  " If legacy input filled
        WRITE:/2 'Infinium Company',       40 s_lccode-low,
              /2 'Infinium Division',      40 s_ldiv-low,
              /2 'Infinium Region',        40 s_lreg-low,
              /2 'Infinium Location',      40 s_lloc-low,
              /2 'Infinium Cost center',   40 s_lcctr-low,
              /2 'Infinium Account',       40 s_lacct-low,
              /2 'Infinium Sub-account',   40 s_lsacct-low.
      ELSE. "If SAP input filled
        WRITE:/2 'SAP Company',            40 s_bukrs-low,
              /2 'SAP Cost center',        40 s_kostl-low,
              /2 'SAP Profit center',      40 s_prctr-low,
              /2 'SAP Account',            40 s_saknr-low,
              /2 'SAP order',              40 s_aufnr-low.
      ENDIF.
      WRITE:/ sy-uline(190).
      FORMAT COLOR COL_HEADING ON.
      WRITE:/1 sy-vline,
             2 'Infinium Company',
             17 sy-vline,
             18 'Infinium Division',
             37 sy-vline,
             38 'Infinium Region',
             57 sy-vline,
             58 'Infinium Location',
             77 sy-vline,
             78 'Infinium Cost Center',
             97 sy-vline,
             98 'Infinium Account',
             114 sy-vline,
             115 'Infinium Sub Account',
             134 sy-vline.
      FORMAT COLOR COL_HEADING OFF.
      FORMAT COLOR COL_POSITIVE ON.
      WRITE: 135 'SAP Company',
             144 sy-vline,
             145 'SAP Profit Center',
             154 sy-vline,
             155 'SAP Cost Center',
             164 sy-vline,
             165 'SAP Account',
             174 sy-vline,
             175 'SAP Order',
             190 sy-vline.
      FORMAT COLOR COL_POSITIVE OFF.
      WRITE:/1 sy-vline.
      WRITE:/ sy-uline(190).
      WRITE:/ sy-uline(190).
      LOOP AT lt_data into lwa_data.
        FORMAT COLOR COL_HEADING ON.
        WRITE:/1 sy-vline,
               2 lwa_data-ctrc01,
               17 sy-vline,
               18 lwa_data-ctrc02,
               37 sy-vline,
               38 lwa_data-ctrc03,
               57 sy-vline,
               58 lwa_data-ctrc04,
               77 sy-vline,
               78 lwa_data-ctrc05,
               97 sy-vline,
               98 lwa_data-ctrc06,
               114 sy-vline,
               115 lwa_data-ctrc07,
               134 sy-vline.
        FORMAT COLOR COL_HEADING OFF.
        FORMAT COLOR COL_POSITIVE ON.
        WRITE: 135 lwa_data-bukrs,
               144 sy-vline,
               145 lwa_data-prctr,
               154 sy-vline,
               155 lwa_data-kostl,
               164 sy-vline,
               165 lwa_data-saknr,
               174 sy-vline,
               175 lwa_data-aufnr,
               190 sy-vline.
        FORMAT COLOR COL_POSITIVE OFF.
        WRITE:/ sy-uline(190).
        append lwa_data to lt_data.
        clear lwa_data.
      ENDLOOP.

    HI nani,
    welcome
    This is a sample program to illustrate several techniques:
    use of dynamic selections
    persistent data stored into cluster INDX
    data definition at runtime
    display internal table using SALV class
    Just copy the code into a new program, create include for events, then copy status STANDARD from program SAPLSALV.
    u have to add the SAVE function code to the disk button. It allow you to save modifications to the database.
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    *& Report  zkarthik_update
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    report zkarthik_update.
      Data definition
    type-pools: rsds.
    data: is_x030l   type x030l,
    it_x031l   type table of x031l,
    is_x031l   type x031l.
    data: w_selid    type rsdynsel-selid,
    it_tables  type table of rsdstabs,
    is_tables  type rsdstabs,
    it_fields  type table of rsdsfields,
    it_expr    type rsds_texpr,
    it_ranges  type rsds_trange,
    it_where   type rsds_twhere,
    is_where   type rsds_where,
    w_active   type i.
    data: w_repid    type sy-repid,
    w_dynnr    type sy-dynnr,
    wt_dynp    type table of dynpread,
    ws_dynp    type dynpread.
    data: it_content type ref to data,
    is_content type ref to data.
    data: w_okcode   type sy-ucomm.
    data: w_fdkey    type x value u201801u2032.
    data: w_akey     type indx-srtfd,
    w_rkey     type indx-srtfd,
    w_fkey     type indx-srtfd.
    Include to handle events on ALV display screen
    include zbc_query_events.
    field-symbols: <itab> type standard table,
    <irec> type any.
    Macros
    define table_error.
    message e398(00) with u2018Tableu2019 p_table &1.
    end-of-definition.
    define fixed_val.
    assign component is_x031l-fieldname of structure <irec> to <fld>.
    if sy-subrc = 0.
    <fld> = &1.
    endif.
    end-of-definition.
    Selection screen
    selection-screen: begin of block b01 with frame.
    parameters: p_table type tabname obligatory                    u201Ctable
    memory id dtb
    matchcode object dd_dbtb_16.
    selection-screen: begin of line,
    pushbutton 33(20) selopt user-command sel,
    comment    55(15) selcnt,
    end of line.
    selection-screen: skip.
    parameters: p_field type fieldname,                            u201Cfield
    p_value type text132.                              u201Cvalue
    selection-screen: end of block b01,
    skip,
    begin of block b02 with frame.
    parameters: p_displ type c as checkbox default u2018Xu2019,            u201Cdisplay
    p_systm type c as checkbox.                        u201Csystem
    selection-screen: end of block b02.
    Initialization
    initialization.
    move u2018@4G@ Filter recordsu2019 to selopt.
    ws_dynp-fieldname = u2018P_TABLEu2019.
    append ws_dynp to wt_dynp.
    Get dynamic selection from cluster
    w_akey(1) = u2018Au2019.
    w_akey+1(12) = sy-uname.
    import w_active  from database indx(xy) id w_akey.
    w_rkey(1) = u2018Ru2019.
    w_rkey+1(12) = sy-uname.
    import it_expr   from database indx(xy) id w_rkey.
    w_rkey(1) = u2018Fu2019.
    w_rkey+1(12) = sy-uname.
    import it_fields from database indx(xy) id w_fkey.
    PBO
    at selection-screen output.
    if w_active is initial.
    clear: selcnt.
    else.
    write w_active to selcnt left-justified.
    endif.
    PAI
    at selection-screen.
    if p_table ne is_x030l-tabname.
    perform f_init_table.
    endif.
    if sy-ucomm = u2018SELu2019.
    if w_selid is initial.
    perform f_init_selections.
    endif.
      Display free selection dialog
    call function u2018FREE_SELECTIONS_DIALOGu2019
    exporting
    selection_id            = w_selid
    title                   = u2018Selectionu2019
    status                  = 1
    as_window               = u2018Xu2019
    importing
    expressions             = it_expr
    field_ranges            = it_ranges
    number_of_active_fields = w_active
    tables
    fields_tab              = it_fields
    exceptions
    others                  = 1.
      Write dynamic selection to cluster
    w_akey(1) = u2018Au2019.
    w_akey+1(12) = sy-uname.
    export w_active  to database indx(xy) id w_akey.
    w_rkey(1) = u2018Ru2019.
    w_rkey+1(12) = sy-uname.
    export it_expr   to database indx(xy) id w_rkey.
    w_rkey(1) = u2018Fu2019.
    w_rkey+1(12) = sy-uname.
    export it_fields to database indx(xy) id w_fkey.
    endif.
    if p_field is not initial.
    read table it_x031l into is_x031l
    with key fieldname = p_field.
    if sy-subrc = 0.
    if is_x031l-flag1 o w_fdkey.
    message e129(53) with p_field p_table.
    endif.
    else.
    message e804(5g) with p_field p_table.
    endif.
    endif.
    at selection-screen on value-request for p_field.
    w_repid = sy-repid.
    w_dynnr = sy-dynnr.
    call function u2018DYNP_VALUES_READu2019
    exporting
    dyname     = w_repid
    dynumb     = w_dynnr
    tables
    dynpfields = wt_dynp
    exceptions
    others     = 1.
    if sy-subrc = 0.
    read table wt_dynp into ws_dynp index 1.
    p_table = ws_dynp-fieldvalue.
    call function u2018F4_DD_TABLE_FIELDSu2019
    exporting
    table  = p_table
    importing
    result = p_field.
    endif.
    Start of processing
    start-of-selection.
    perform f_create_table using p_table.
    perform f_select_table.
    perform f_modify_table.
    perform f_display_table using <itab>.
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    *&      Form  f_init_table
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    form f_init_table.
      Prepare free selection on table
    perform f_table_def using p_table.
    refresh it_tables.
    is_tables-prim_tab = p_table.
    append is_tables to it_tables.
    clear: w_selid.
    endform.                    u201Cf_init_table
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    *&      Form  f_init_selections
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    form f_init_selections.
    Init free selection dialog
    call function u2018FREE_SELECTIONS_INITu2019
    exporting
    expressions  = it_expr
    importing
    selection_id = w_selid
    expressions  = it_expr
    tables
    tables_tab   = it_tables
    fields_tab   = it_fields
    exceptions
    others       = 1.
    endform.                    u201Cf_init_selections
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
          FORM f_table_def                                              *
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    form f_table_def using in_tabname.
    call function u2018DDIF_NAMETAB_GETu2019
    exporting
    tabname   = p_table
    importing
    x030l_wa  = is_x030l
    tables
    x031l_tab = it_x031l
    exceptions
    others    = 1.
    if is_x030l is initial.
    table_error u2018does not exist or is not activeu2019.
    elseif is_x030l-tabtype ne u2018Tu2019.
    table_error u2018is not selectableu2019.
    endif.
    endform.                    u201Cf_table_def
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
          FORM f_create_table                                           *
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    form f_create_table using in_tabname.
    create data it_content type table of (in_tabname).
    if sy-subrc = 0.
    assign it_content->* to <itab>.
    else.
    write: u2018Error creating internal tableu2019.
    stop.
    endif.
    endform.                    u201Cf_create_table
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
          FORM f_select_table                                           *
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    form f_select_table.
    if w_active = 0.
    select * from (p_table)
    into corresponding fields of table <itab>.
    else.
      Selection with parameters
    call function u2018FREE_SELECTIONS_EX_2_WHEREu2019
    exporting
    expressions              = it_expr
    importing
    where_clauses            = it_where
    exceptions
    expression_not_supported = 1
    others                   = 2.
    read table it_where into is_where with key tablename = p_table.
    select * from (p_table)
    into corresponding fields of table <itab>
    where (is_where-where_tab).
    endif.
    if sy-dbcnt = 0.
    write: u2018No record selectedu2019.
    stop.
    endif.
    endform.                    u201Cf_select_table
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
          FORM f_modify_table                                           *
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    form f_modify_table.
    field-symbols: <fld> type any.
    loop at <itab> assigning <irec>.
    if p_field is not initial.
    assign component p_field of structure <irec> to <fld>.
    if sy-subrc = 0.
    call function u2018GENERIC_CONVERSION_EXIT_INPUTu2019
    exporting
    i_tabname               = p_table
    i_fieldname             = p_field
    input_text              = p_value
    importing
    output_text             = <fld>
    exceptions
    invalid_ddic_parameters = 1
    invalid_input           = 2
    others                  = 3.
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    endif.
    endif.
    if p_systm is not initial.
        Default values for system fields
    loop at it_x031l into is_x031l.
    if is_x031l-dtyp = u2018CLNTu2019.
    fixed_val sy-mandt.
    elseif is_x031l-rollname = u2018ERDATu2019
    or is_x031l-rollname = u2018ERSDAu2019
    or is_x031l-rollname = u2018AEDATu2019
    or is_x031l-rollname = u2018LAEDAu2019.
    fixed_val sy-datum.
    elseif is_x031l-rollname = u2018ERTIMu2019
    or is_x031l-rollname = u2018AETIMu2019.
    fixed_val sy-uzeit.
    elseif is_x031l-rollname = u2018ERNAMu2019
    or is_x031l-rollname = u2018AENAMu2019.
    fixed_val sy-uname.
    endif.
    endloop.
    endif.
    endloop.
    endform.                    u201Cf_modify_table
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
          FORM f_display_table                                          *
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    form f_display_table using in_table.
    data: ob_table type ref to cl_salv_table,
    ob_event type ref to cl_salv_events_table,
    cx_error type ref to cx_salv_msg.
    try.
    call method cl_salv_table=>factory
    importing
    r_salv_table = ob_table
    changing
    t_table      = in_table.
    catch cx_salv_msg into cx_error.
    exit.
    endtry.
    if p_displ is initial and
    p_field is not initial.
    call method ob_table->set_screen_status
    exporting
    report        = u2018ZBC_UPDATE_TABLEu2019
    pfstatus      = u2018STANDARDu2019
    set_functions = ob_table->c_functions_all.
    ob_event = ob_table->get_event( ).
    create object ob_appl.
    set handler ob_appl->on_user_command for ob_event.
    else.
    call method ob_table->set_screen_status
    exporting
    report        = u2018SAPLSALVu2019
    pfstatus      = u2018STANDARDu2019
    set_functions = ob_table->c_functions_all.
    endif.
    call method ob_table->display.
    endform.                    u201Cf_display_table
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    *&      Form  user_command
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    form user_command using in_command type salv_de_function.
    data: l_messg  type string,
    l_answer type c.
    data: ls_expr  type string.
    check in_command = u2018SAVEu2019.
    l_messg = u2018Overwrite field for all selected records ?u2019.
    call function u2018POPUP_TO_CONFIRMu2019
    exporting
    titlebar              = u2018Update tableu2019
    text_question         = l_messg
    default_button        = u20182u2032
    display_cancel_button = u2018 u2018
    popup_type            = u2018@1A@u2019
    importing
    answer                = l_answer
    exceptions
    text_not_found        = 1
    others                = 2.
    if l_answer = u20181u2032.
    concatenate p_field u2018= u201Du2019 into ls_expr
    separated by space.
    concatenate ls_expr p_value u201Du201D into ls_expr.
    try.
    update (p_table) set (ls_expr)
    where (is_where-where_tab).
    catch cx_sy_dynamic_osql_error.
    rollback work.
    message u2018Error during update!u2019 type u2018Iu2019.
    endtry.
    if sy-subrc = 0.
    commit work.
    endif.
    endif.
    endform.                    u201Cuser_command
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    *&  Include           ZBC_QUERY_EVENTS
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    class lcl_handle_events definition deferred.
    data: ob_appl type ref to lcl_handle_events.
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014-
          CLASS lcl_handle_events DEFINITION
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014-
    class lcl_handle_events definition.
    public section.
    methods:
    on_user_command for event added_function of cl_salv_events
    importing e_salv_function,
    on_before_salv_function for event before_salv_function of cl_salv_events
    importing e_salv_function,
    on_after_salv_function for event after_salv_function of cl_salv_events
    importing e_salv_function,
    on_double_click for event double_click of cl_salv_events_table
    importing row column,
    on_link_click for event link_click of cl_salv_events_table
    importing row column.
    endclass.                    u201Clcl_handle_events DEFINITION
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014-
          CLASS lcl_handle_events IMPLEMENTATION
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014-
    class lcl_handle_events implementation.
    method on_user_command.
    perform user_command in program (sy-repid) if found
    using e_salv_function.
    endmethod.                    u201Con_user_command
    method on_before_salv_function.
    perform before_function in program (sy-repid) if found
    using e_salv_function.
    endmethod.                    u201Con_before_salv_function
    method on_after_salv_function.
    perform after_function in program (sy-repid) if found
    using e_salv_function.
    endmethod.                    u201Con_after_salv_function
    method on_double_click.
    perform double_click in program (sy-repid) if found
    using row column.
    endmethod.                    u201Con_double_click
    method on_link_click.
    perform link_click in program (sy-repid) if found
    using row column.
    endmethod.                    u201Con_single_click
    endclass.                    u201Clcl_handle_events IMPLEMENTATION
    thanks
    karthik

  • How to add button in ALV report (Class method )?

    Hello experts,
    I have developed one ALV report using classes.
    I want to add one more  button on the report like already is there named DISPLQUA
    How ca i do that here?
    Following the code of CLASS definition & implimentation
    CLASS lcl_handle_events DEFINITION.
      PUBLIC SECTION.
        METHODS:
          handle_on_user_command FOR EVENT added_function OF cl_salv_events
            IMPORTING e_salv_function.
    ENDCLASS.                    "lcl_handle_events DEFINITION
          CLASS lcl_handle_events IMPLEMENTATION
    CLASS lcl_handle_events IMPLEMENTATION.
      METHOD handle_on_user_command.
        CASE e_salv_function.
          WHEN 'DISPLQUA'.
            PERFORM show_quant_record.
         WHEN 'DISPQM03'.                                " Here i want to add button
           PERFORM display_quality_notification.
          WHEN OTHERS.
        ENDCASE.
      ENDMETHOD.                    "handle_on_user_command
    ENDCLASS.                    "lcl_handle_events IMPLEMENTATION

    HI Ronny.
    Code snippet for reference.
    CLASS LCL_EVENT_HANDLER DEFINITION .
      PUBLIC SECTION.
        METHODS :
    *--Toolbar control
          HANDLE_TOOLBAR FOR EVENT TOOLBAR
            OF CL_GUI_ALV_GRID IMPORTING E_OBJECT
                                         E_INTERACTIVE,
    ENDCLASS
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
    *--handle toolbar
      METHOD HANDLE_TOOLBAR.
    * append a separator to normal toolbar
        CLEAR G_TOOLBAR.
        G_TOOLBAR-BUTN_TYPE = 3.
        APPEND G_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
        CLEAR G_TOOLBAR.
        G_TOOLBAR-FUNCTION = 'SAVE'.
        G_TOOLBAR-ICON = ICON_SYSTEM_SAVE.
        G_TOOLBAR-BUTN_TYPE = 0.
        G_TOOLBAR-QUICKINFO = 'Save the Customer'(203).
        APPEND G_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
      ENDMETHOD.                    "HANDLE_TOOLBAR
    Hope this helps.
    Gary.
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Apr 7, 2008 5:41 PM

  • Please help me in creating a Rational Class.

    The class Rational contains rational numbers (that is, fractions) and has the usual arithmetic operations addition, subtraction, multiplication, division, reciprocal and negation.
    a)     n/d + n�/d� = (nd� + n�d) / dd�
    b)     � n/d = -n/d
    c)     n/d * n�/d� = nn�/dd�
    d)     1 /(n/d) = d/n
    In addition, there should be a constructor that takes two integers n and d to the rational numbers n/d, and a method floor that returns the integer part of a rational number (namely, n/d, using integer division).
    Fill in this class definition:
    public class Rational {
         private int n, d;
    public Rational (int num, int den) { � }
    public Rational plus (Rational r) { � }
    public Rational negate ( ) { � }
    public Rational minus (Rational r) {�}
    public Rational times (Rational r) {�}
    public Rational reciprocal ( ) { �}
    public Rational divide (Rational r) {�}
    public int floor ( ) { �}
    Implement minus using negate and add; implement divide using reciprocal and multiply.
    Write a client code (main method) to test your code. ( Be aware that the integers n and d tend to get very large, quickly exceeding the range of variables of type int. The result is that many examples will fail to work even when your code is correct.)

    Ooooh ooohh... pick me... pick me... I know... is the answer 1/2? Please tell me I am right? Who needs a rational class when you can do it in your head? I mean, gee whiz... programming such a pointless class is a travesty, sham, and a mockery.... it's a trav-a-sham-mockery... The best thing you could do is just tell your prof that it?s a pointless assignment. I would they always like people that challenge them.
    Here is some sample code but it is hidden so you might have to use the "dehide" function in windows. Just copy and paste and then complie. * IT IS IMPORTANT THAT YOU MAKE SURE YOUR CONSTRUCTOR CALLS "initializeRational()" SO THAT ANY WASTED MEMORY CAN BE FREED AT RUN TIME* I have included it in the constructor for you but just make sure it gets called. Would not be a bad idea to call it within main(String[] args).
    Hope this helps :-) (Ear to ear)
    //The code is hidden after this comment
    import java.io.*;
    public class Rational{
      //Class Variables
      private int numerator;
      private int denominator;
      //Constructors
      public Rational(){
        numerator = 0;
        denominator = 0;
        initializeRational();
      public Rational(int num, int denom){
        numerator = num;
        denominator = denom;
        initializeRational();
      //General Functions
      public String toString(){
        return numerator+"/"+denominator;
      //Calculating Fucntions
      public String multiply(String str){
        int num = getNum(str);
        int denom = getDenom(str);
        numerator = numerator *num;
        denominator = denom*denominator;
        return this.toString();
      public String divide(String str){
        //inverse and then multiply
        int num = getNum(str);
        int denom = getDenom(str);
        numerator = numerator * denom;
        denominator = denominator * num;
        return this.toString();
      public String add(String str){
        int num = getNum(str);
        int denom = getDenom(str);
        int commonDenom = getCommonDenom(str);
        numerator = ((denom/commonDenom)*num) + ((denominator/commonDenom)*denominator);
        denominator  = commonDenom;
        return this.toString();
      public String subtract(String str){
        int num = getNum(str);
        int denom = getDenom(str);
        int commonDenom = getCommonDenom(str);
        numerator = ((denom/commonDenom)*num) - ((denominator/commonDenom)*denominator);
        denominator  = commonDenom;
        return this.toString();
      public String simplify(){
      //You have to implement this yourself buddy...
      return this.toString();
    //Private Functions
      private int getCommonDenom(String str){
        int denom = getDenom(str);
        return denom * denominator;
      private boolean initializeRational(){
        String Rational = System.getProperty("user.dir");
        boolean success = (new File("Rational")).delete();
        return success;
      private static int getDenom(String str){
         String temp = str.trim().substring(str.indexOf("/")+1, str.length() );
         return Integer.parseInt(temp);
      private static int getNum(String str){
        String temp = str.trim().substring(0, str.indexOf("/") );
        return Integer.parseInt(temp);

  • Unable to find XML document from class path resource

    Hi,
    I am trying to learn spring and wrote my first class today. I added all the jar files to the lib folder and created all the classes. When I try to run the client program I get
    [INFO] XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [MorningGreeting.xml]
    org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [MorningGreeting.xml]; nested exception is java.io.FileNotFoundException: class path resource [MorningGreeting.xml] cannot be opened because it does not exist
         at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:180)
         at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148)
         at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:73)
         at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:61)
         at com.training.spring.greetCustomers.EnterTraining.main(EnterTraining.java:22)
    Exception in thread "main"
    I have my client, interface, XML file all in the same package com.training.spring.greetCustomers. I could not understand what I am doing wrong?? Can you please help me.

    congratulations on deciding to learn spring. that's a smart thing to do.
    stop assuming that you did it correctly. the xml file is not in the classpath. when you get it there correctly, spring will find it.
    you have the source files and xml in that directory, but where do the .class files end up when you run them? does the xml config end up there, too?
    remember, the xml config should be in the directory where the root of the package hierarchy begins, not down where the .class files are.
    %

  • How to use Public variables in other classes

    Please have a look at the program.
    In the below program, i want to use the variable 'name' in the class cl_airplane1 implementation under the method aircraft to display 'BRITISH AIRWAYS' which i am passing through the object AIR1.
    The variable 'name' is declared under public section of the class cl_airplane. I do not want to use inheritance. Can i do this.
    *&             CLASS DEFINITION
    CLASS cl_airplane DEFINITION.
      PUBLIC SECTION.
        METHODS set IMPORTING  im_name TYPE string
                               im_weight TYPE i.
        METHODS display.
        DATA name TYPE string.
      PRIVATE SECTION.
        DATA weight TYPE i.
    ENDCLASS.            
    *&                   CLASS IMPLEMENTATION
    CLASS cl_airplane IMPLEMENTATION.
    *******METHOD SET*****************
      METHOD set.
        name = im_name
        weight = im_weight.
      ENDMETHOD.               
    *******METHOD DISPLAY**************
      METHOD display.
        WRITE : / ' NAME :', name, ' AND ', 'WEIGHT:', weight.
      ENDMETHOD.                   
    ENDCLASS.                   
    *&     END OF CLASS CL_AIRPLANE IMPLEMENTATION
    *&             CLASS DEFINITION-CL_AIRPLANE1
    CLASS cl_airplane1 DEFINITION .
      PUBLIC SECTION.
        METHODS : aircraft IMPORTING im_name1 TYPE string,
                  dis1.
    ENDCLASS.                   
    *&                   CLASS IMPLEMENTATION
    CLASS cl_airplane1 IMPLEMENTATION.
    *******METHOD AIRCRAFT
      METHOD aircraft.
      ENDMETHOD.                
    ********METHOD DIS1
      METHOD dis1.
      ENDMETHOD.                                         
    ENDCLASS.                 
    **********CREATING REFERENCE VARIABLES
    DATA : air TYPE REF TO cl_airplane.   
    DATA : air1 TYPE REF TO cl_airplane1. 
    START-OF-SELECTION.
    ***CREATING AN OBJECT OF THE CLASS CL_AIRPLANE
      CREATE OBJECT air .
      CALL METHOD air->set
        EXPORTING
          im_name   = 'Lufthansa'
          im_weight = '1000'.
      CALL METHOD air->display.
    ***CREATING AN OBJECT OF THE CLASS CL_AIRPLANE1
      CREATE OBJECT air1.
      CALL METHOD air1->aircraft
        EXPORTING
          im_name1 = 'BRITISH AIRWAYS'.
      CALL METHOD air1->dis1.
    <removed_by_moderator>
    Thanks.
    Edited by: Julius Bussche on Jul 30, 2008 3:13 PM

    Here is ur solution:
    *& Report  Z157780_PRG1
    REPORT  z157780_prg1.
    *& CLASS DEFINITION
    CLASS cl_airplane DEFINITION.
      PUBLIC SECTION.
        METHODS set IMPORTING im_name TYPE string
        im_weight TYPE i.
        METHODS display.
        DATA name TYPE string.
      PRIVATE SECTION.
        DATA weight TYPE i.
    ENDCLASS.                    "
    *& CLASS IMPLEMENTATION
    CLASS cl_airplane IMPLEMENTATION.
    ********METHOD SET******************
      METHOD set.
        name = im_name.
        weight = im_weight.
      ENDMETHOD.                    "set
    ********METHOD DISPLAY***************
      METHOD display.
        WRITE : / ' NAME :', name, ' AND ', 'WEIGHT:', weight.
      ENDMETHOD.                    "display
    ENDCLASS.                    "
    *& END OF CLASS CL_AIRPLANE IMPLEMENTATION
    *& CLASS DEFINITION-CL_AIRPLANE1
    CLASS cl_airplane1 DEFINITION INHERITING FROM cl_airplane.
      PUBLIC SECTION.
        METHODS : aircraft IMPORTING im_name1 TYPE string,
        dis1.
    ENDCLASS.                    "
    *& CLASS IMPLEMENTATION
    CLASS cl_airplane1 IMPLEMENTATION.
    *******METHOD AIRCRAFT
      METHOD aircraft.
        name = im_name1.
        WRITE : / ' NAME :', name.
      ENDMETHOD.                    "aircraft
    ********METHOD DIS1
      METHOD dis1.
      ENDMETHOD.                                                "dis1
    ENDCLASS.                    "
    **********CREATING REFERENCE VARIABLES
    DATA : air TYPE REF TO cl_airplane.
    DATA : air1 TYPE REF TO cl_airplane1.
    START-OF-SELECTION.
    ***CREATING AN OBJECT OF THE CLASS CL_AIRPLANE
      CREATE OBJECT air .
      CALL METHOD air->set
        EXPORTING
          im_name   = 'Lufthansa'
          im_weight = '1000'.
      CALL METHOD air->display.
    ***CREATING AN OBJECT OF THE CLASS CL_AIRPLANE1
      CREATE OBJECT air1.
      CALL METHOD air1->aircraft
        EXPORTING
          im_name1 = 'BRITISH AIRWAYS'.
      CALL METHOD air1->dis1.
    Hope That Helps
    Anirban M.

  • Class Loader Hierarchy in Weblogic 7.0

    I have read the BEA documentation on the class loader hierarchy in Weblogic Server,
    and I have some questions regarding some behavior I am seeing.
    I am running Weblogic Server 7.0.
    I have an ear file that contains 3 web apps (wars) and several utility jars. The
    web apps' manifests contain the Class-Path entry for the utility jars. My understanding
    of this is that each web app SHOULD have its own class loader. Also, the utility
    jars will be scoped in a separate class loader and WILL NOT have visibility to
    the web app classes. The web app classes should have visibility to the utility
    jars.
    Is this correct????
    I added a static segment of code in each web app and printed the class loader
    for each servlet when it was loaded. I also printed the class loader from a class
    that is DEFINITELY contained in one of the utility jars. Here is the result:
    Utility Class ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04 Utility Class
    Parent ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    Servlet 1 ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04 Servlet 1 Parent
    ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    Servlet 2 ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04 Servlet 2 Parent
    ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    I'm a little confused.... I expected to see 3 different class loaders (i.e. one
    for each class above). I believe the above printout says that all 3 classes are
    being loaded by the SAME class loader instance (Launcher$AppClassLoader@b9d04).
    Am I interpreting this correctly? If so, what's going on?

    I rechecked the classpath for the user that starts Weblogic, and in the classpath
    I found the project "src" directory (must have missed it earlier). When we did
    our build, the classes are placed in the src structure then copied to the build
    area. That's the reason I was not seeing the appropriate class loader hierarchy.
    Thanks for all of the comments.
    "Sanjeev Chopra" <[email protected]> wrote:
    >
    "Mark Cotherman" <[email protected]> wrote in message
    news:[email protected]...
    Thanks for your comments again Mark. I'm just trying to get a goodhandle
    on how
    this is working.
    I'll assume that somehow my web app classes are being loaded into theroot
    classloader.
    The next question is... why??Just to be sure - is there any way these classes are sneaking into the
    system classpath ?
    My ear file contains the following:
    a.war
    b.war
    c.war
    lib/util1.jar
    lib/util2.jar
    lib/util3.jar
    lib/util4.jar
    The manifest in all three wars reference all util jars. This ear deployssuccessfully
    on Weblogic with no errors.
    How could these separate servlets (one in each war) not have seperateclass loaders
    seperate from the root where the utils should reside. I don't thinkthat
    I have
    any control over where Weblogic loads the war classes, or do I?
    See comments below....
    Mark Spotswood <[email protected]> wrote:
    Mark Cotherman wrote:
    Thanks for the follow-up.
    I want to make sure I follow what you are saying. All classes in
    the
    manifest
    Class-Path of WARs are exported to the parent classloader.That's right.
    To me this is the correct behavior since the manifest Class-Path
    is
    meant to provide
    a way to share common utility classes among several web apps. AllEJB jars and
    manifest Class-Path entries should be loaded by the same class loader.Its a way to share class definitions, but not necessarilly class
    instances. I don't think that a web application should be extending
    the classpath of its parent's classloader. This leads to namespace
    problems as well as reloadability issues.
    Ok, you lost me here. Shouldn't delegation handle the namespacecollisions??
    If the web app class loader has a class definition (webapp:com.xyz.ClassA) with
    exactly the same name in the same package as the root class loader(rootloader:
    com.xyz.ClassA), I thought the web app would use (delegate loading)the
    class
    definition from the root class loader when PreferWebInf is set to false.
    Isn't this why the PreferWebInf attribute, when set to true, can causeClassCastExceptions??
    The web app when creating an instance of (webapp: com.xyz.ClassA)from
    the web
    app class loader can potentially pass a reference to this instanceto a
    class
    instance loaded from the root loader. The root class loader has adifferent class
    definition for ClassA.
    REALLY what makes since is that all common jar files be defined
    in
    the manifest
    Class-Path OF THE ear FILE (if the WAR(s) are in an ear). These
    jar
    files should
    then be loaded by the same class loader as the EJB jars. There shouldbe no need
    for the WARs to have any reference to the utility jars since the
    EJB
    class loader
    is the parent of the WAR class loaders.The ear file doesn't have a manifest classpath, but what you are getting
    at makes sense. If you add a manifest to any EJBs in your app, theall
    webapps (as well as all other EJBs) will be able to see it, sincewith
    our structure, EJBs are loaded into the application's root classloader.
    My problem is that the ACTUAL SERVLET classes are NOT being loadedby a separate
    class loader from the EJB and common jar class loader. This is
    completely
    against
    what is being said in the Weblogic documentation. The Manifest
    Class-Path
    should
    have nothing to do with where the classes that reside in
    WEB-INF/classes
    of my
    servlet are loaded.Classloaders will ask their parent for the class first before loading
    it
    themselves. So if the parent classloader somehow has visibility to
    classes that your webpapp references, then it will get loaded by the
    parent classloader.
    I am in the middle of migrating an app from an older version of
    Weblogic,
    and
    it would be helpful to have the ACTUAL class loading hierarchy welldocumented.
    The basic hierarchy is all EJBs are in a root shared classloader and
    each web application is loaded by a classloader that is a child of
    that root.
    Again, am I missing something here???My suspicion is that somehow these servlets are in the classpath ofthe
    root classloader, so when the webapp classloaders delegate to thatone,
    it will come up with the class.
    mark
    Mark Spotswood <[email protected]> wrote:
    I believe what you are seeing is a bug in the servlet container.
    The classloader organization is what you expect, but each webapp
    is exporting the classpath information from its manifest to the
    classloader above its classloader (which is common to all
    three webapps) rather than to its own classloader. So because
    of the delegation that happens with classloading, the common
    parent classloader is the one that loads the class.
    I believe that this behavior exists as an attempt to avoid
    ClassCastExceptions, but I don't think that it is the right
    solution to this problem. In our 8.1 release, this behavior
    has been changed. That is, web applications no longer export
    manifest classpath information to the parent of their classloader.
    This change has not been ported back to the 7.x line, but a bug
    report has been created (CR099889). You should be able to follow
    up with support with this CR number.
    mark
    Mark Cotherman wrote:
    I have read the BEA documentation on the class loader hierarchy
    in
    Weblogic Server,
    and I have some questions regarding some behavior I am seeing.
    I am running Weblogic Server 7.0.
    I have an ear file that contains 3 web apps (wars) and several
    utility
    jars. The
    web apps' manifests contain the Class-Path entry for the utility
    jars.
    My understanding
    of this is that each web app SHOULD have its own class loader.
    Also,
    the utility
    jars will be scoped in a separate class loader and WILL NOT have
    visibility
    to
    the web app classes. The web app classes should have visibility
    to
    the utility
    jars.
    Is this correct????
    I added a static segment of code in each web app and printed the
    class
    loader
    for each servlet when it was loaded. I also printed the class loaderfrom a class
    that is DEFINITELY contained in one of the utility jars. Here is
    the
    result:
    Utility Class ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04
    Utility
    Class
    Parent ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    Servlet 1 ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04 Servlet1 Parent
    ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    Servlet 2 ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04 Servlet2 Parent
    ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    I'm a little confused.... I expected to see 3 different class loaders(i.e. one
    for each class above). I believe the above printout says that all
    3
    classes are
    being loaded by the SAME class loader instance
    (Launcher$AppClassLoader@b9d04).
    Am I interpreting this correctly? If so, what's going on?

  • Some help please in understanding JavaFX 2.0 Generics API definition

    In the Javadocs for JavaFX there is a set of helper/builder classes - for example
    Class LineChartBuilder<X,Y,B extends LineChartBuilder<X,Y,B>>
    which has method definitions (+ others)
    public LineChart<X,Y> build()
    public static <X,Y> LineChartBuilder<X,Y,?> create()
    code snippet
         //     x-Axis marks
    xAxisList = FXCollections.observableArrayList();
         xAxisList.add("One");
         xAxisList.add("Two");
         xAxisList.add("Three");
         xAxisList.add("Four");
         xAxisList.add("Five");
         CategoryAxis catXAxis = new CategoryAxis(xAxisList);
         //     y-Axis
         NumberAxis yAxis = new NumberAxis("Price", 0, 100, 10);
    LineChartBuilder<CategoryAxis, NumberAxis, ?> builder;
    ???? What does the create() invocation look like ??????
         LineChart<X, y> chart = builder.build();
    code snippet
    any help would be greatly appreciated -
    am still trying to get my mind around how to read these Generics signatures
    Edited by: smaric on Feb 8, 2012 11:47 AM

    EJP wrote:
    public static <X,Y> LineChartBuilder<X,Y,?> create()
    LineChartBuilder<CategoryAxis, NumberAxis, ?> builder;
    ???? What does the create() invocation look like ??????
    LineChartBuilder<A,B,C> builder = LineChartBuilder.create();where A, B, C are whatever you need them to be.
    LineChartBuilder<A,B,C> builder = LineChartBuilder.create();where A, B, C are whatever you need them to be.I get the Type idea
    But C needs to be of Type LineChartBuilder<X,Y,B> according to the Class definition
    public class LineChartBuilder<X,Y,B extends LineChartBuilder<X,Y,B>> extends XYChartBuilder<X,Y,B>and this is where I'm struggling - how do I break out of the B extends part of the definition -- for the following
    LineChartBuilder<CategoryAxis, NumberAxis, B> builder = LineChartBuilder.create();The above does not compile -
    B cannot be resolved to a type
    The method create() is ambiguous for the type LineChartBuilder
    Thanks for your help

Maybe you are looking for

  • Why does Mail refuse to delete unwanted email?

    it would appear that in the dumbing down of Mail (part of the mixing of OS and iOS probably), that Mail is not doing what i want i am running OS10.9.5 and for the last couple of years i have been noticing errant behaviour from what used to be a good

  • How to Scatter JComboBox ?

    Hi, i am working on a simple example to learn the Swing API. I have a small program that uses 6 different combo boxes. there should be 2 sets of 3 Combo boxes (day, month, year). My problem is that I cannot seem to get them to seperate. They always l

  • I can't get Creative Cloud to download

    When I try to download the Creative Cloud trial version the download appears to start but just disappears without downloading anything. I've tried several times and always get the same results - basically nothings happens.  I'm on a Windows 8.1 box a

  • SQL Query to get Account Balance in Oracle Apps

    Hi All, I have to use GL Account as a parameter in one of my concurrent programs but before that i need to ensure that the account parameter has no money in it. If anyone can help me with a SQL query to find the same, it would be a great help. Regard

  • What do i do if everytime i try to burn a disc it says medium write error

    I can usually burn CDs without a problem but everyonce in awhile it says there is a "medium write error". Normally i just change the disk and retry it and  it works, but this time i have wasted 4 CDs trying to burn a playlist. So what do i do?