Static const int attributes and template functions

The following does not link with CC on Solaris9. From what I can glean from the standards committee's notes it looks like it should and it compiles and links fine with g++. If I use a cast in the function call: ("foo((int)B::X)") then it links. If I move the static initialization out of the class definition then it works as well. Should we expect this to work or not?
#include <iostream>
class B
public:
static const int X = 42;
template< typename T > void foo( const T& t ) { std::cout << t << std::endl;}
int main()
foo(B::X);
}

The C++ rule (C++ Standard, section 9.4.2 paragraph 4) is that a static const data member of integral type can have an in-class initializer, and the value can be used in integral constant expressions. But if the data member is used, it must be defined outside the class without an initializer. If gcc allows the code, it is by accident. Some other compilers (apart from Sun C++) do not.
Add the line
const int B::X;
somewhere at global scope (or at namespace scope if B is in a namespace) after the declaration of class B. But you can't put this definition in a header file. The entire program must have exactly one definition of the static member.

Similar Messages

  • Bid Invitation attributes and weighting function

    Attributes are transferring to Weighting section. This did not haqppen in the past.    
    During bid invitation creation the dynamic attributes that are used are
    automatically transferred to the weighting function. Along with this
    there is a message that is displayed "Specify the parameters of
    weighting function". This never happened in the past before
    implementing ECC 6 Enhancement pack 5, SAP_BASIS Component: Support
    Pack 7 for 7.02, and SAP Kernel: 720 patch 115.
    I found note 1662288 but it is applicable to server 701 and 702. Our
    server is 550.

    Hi,
    1. make sure email set up is done as per note 455140. To send e-mails after bid is published  for the bid invitation transaction 'BID' attach relevant event schema. This will take care of sending mails whenver bid invitation is published or changed.
    2. Provide the role  BBP_EC_SUS_BIDDER to the bidders to enable them to see bid invitaions and send bids from SUS portal.  For this you also need to enable SSO (single sign on) between  EBP and SUS. Please refer the below link for further information.
    sending RFQs from SRM EBP to SRM SUS
    3. It is possible to down load the Bid invitation. Further update the mail  id of the bidder with your id so that you can receive the bid invitation smartform. This you can take a print out and send it to bidders. You can make config setting in SPRO 'define actions for document output' to send the   bid invitation smartform.
    Hope this clarifies all your doubts here.
    rgds,
    RRK

  • Oracle proc Pro*C, g++/c++ compile error due to static const unsigned int sqlctx

    I'm using Oracle 8.1.6 for Linux, and 7.3.4 on HP-UX. Compiler is gcc/g++ 2.95.2
    In working with the Oracle precompiler on both HPUX and Linux, I've found a problem with the way that the Linux precompiler generates the sqlctx variable.
    On linux, the following is generated when you run the precompiler:
    static const unsigned int sqlctx = 1;
    However, on HPUX, this is the corresponding code:
    static unsigned long sqlctx = 10673468;
    When you compile the Linux version with g++/c++ or aCC, you get fatal errors of this nature:
    SQLSubsystem.cpp:562: passing `const unsigned int *' as argument 2 of `sqlcxt(void **, unsigned int *, sqlexd *, const sqlcxp *)' discards qualifiers
    Is there a way to force the output of proc to leave off the const?
    If you view the binary file proc, you can find the static unsigned int string listed. So I think it may be an option. However, I can't seem to turn it on.
    Thanks-
    Matt Wright

    As for sqlctx:
    sqlctx is a module identifier variable. i.e. if your project consists of multiple modules, each sqlctx should have different value.
    I have seen this error only on Linux Pro*C starting of 8.1.5 version (have not tested 8.0.5 nor 8.1.6).
    Anyway, I really can not understand why this error is not patched already.
    As for constness:
    I can not tell if there is an option which would solve such issue. I can only advise not to use -Werror option of gcc. It generates about 4-5 warnings per module, but it works ;-))

  • Excel function and ev function not working in static column key

    I have created a evdre report and I notice that  when I tried to use any excel function and ev functions in the static column key cell to get the value for that cell, it's not working.
    e.g I have Col key define as:
    ColKeyRange  Sheet!&$J$12:$N$14
    In K13 which is key id for time. I define is as = $K$10 where K10 is the time value from current view, it not working,the value is still K13 = $K$10. then I tried to use EVCVW function to replace K10, it also not working, but I use the same function in the description of the ID underneath, both of the are working, Any thought?
    Edited by: DFW on Feb 9, 2010 7:33 PM

    Hi,
    That was exactly what I meant. They just dont work on the green ID areas or the yellow data region. Few days back even I tried that, but didnt work. So, I followed the different approach. I dont remember about the dynamic templates. Are you sure that the functions were written in the green ID region?
    I remember this used to work fine in the MS version. However, in the NW version, even I am not able to make them work.
    Edited by: nilanjan chatterjee on Feb 9, 2010 9:38 PM

  • Function module to get attribute and value from organisation model

    Hi
    I need a function module to get the attribute and its corresponding values set on the sales org stucture.The export parameter will be the Sales Org Id.
    Please reply ASAP.
    Edited by: prem kumar on Apr 16, 2009 9:37 AM

    Hi Prem,
    If it helps, we use FM RHGA_READ_ATTRIBUTES for that in version 4.
    Kind regards,
    Garcia

  • NVL Function and Truncate Function in Template Builder

    Hi Guys,
    How would I use NVL function and Truncate function in the Word Template Builder.
    These functions do not work in the Query Builder when i use SQL Query as the Dataset while creating a report.
    I could not find examples in the Publisher Guide either.
    Thanks
    rkingmdu

    Hi
    How can you not use the functions in your query? Does the builder return an error? ow about just pasting your query into the report definition does the nvl/trunc work then ?
    Regards
    Tim
    http://blogs.oracle.com/xmlpublisher

  • Region Attributes and Region Header on Tab Template. Apex 5

    All,
    In order to have my pages not scroll, but instead have a region scroll I would do an overflow on the region header and attributes in apex 4.
    When using this same method on a tab template, all of the reports within the tab templates get shown one after another.
    eg;
    region attribute......style="width:350px;height:758px;"
    region header..... <div style="overflow: auto; width: 350; height: 700px;">
    it does make the region scrollable, but the tabs stop working and instead are displayed one after another.
    Does anyone know of a fix / workaround?

    Hi gianpagi,
    gianpagi wrote:
    i would like to know how to have an horizontal scrollbar for an interactive report (5.0) after making a pivot from the user interface; i have a lot of columns and without the pivot the horizontal scrollbar appears . After it doesn't appear.
    I tried with the Region Header <div style="overflow:auto;"> and Region Footer </div>  but without success.
         Please mention the theme and template you are using for the Interactive Report.
         Can you re-produce the issue on apex.oracle.com and share the workspace credentials, so that can have closer look at the issue?
    Regards,
    Kiran

  • Final attributes and local variables - performance ??

    Hi all,
    I and a colleague have done some performance testing regarding the use of final attributes and final local variables, e.g.
    with final:
    public class MyClass {
      private final int i;
      public final void myMethod() {
        final int j = 5;
        // do something with i and j
    }vs. non-final:
    public class MyClass {
      private int i;
      public final void myMethod() {
        int j = 5;
        // do something with i and j
    }I couldn't find any speed differences in a small test program, but my colleague did so in his application. Who is right ??
    Still, I will have do some formal testing next week and I will post the results.
    I'd prefer the version using final anyway because I find it better readable, but the issue I am having is whether I'll spend 2-3 days going through the program making everything final or not.

    I made some tests with final arguments to a method: I could not find any difference between final and non-final arguments. code is posted below
    import java.io.*;
    import java.net.*;
    import java.rmi.*;
    import java.util.*;
    import javax.ejb.*;
    import javax.naming.*;
    import javax.rmi.PortableRemoteObject;
    import junit.framework.*;
    import junit.extensions.*;
    public final class FinalVariablesTest extends TestCase /* from junit */ {
         * Constructors
        public FinalVariablesTest(String name) {
            super(name);
         * helper methods/classes
        protected void setUp() throws Exception {
            super.setUp();
        protected void tearDown() throws Exception {
            super.tearDown();
         * Test Suite
        public static void main(String[] args) {
         junit.textui.TestRunner.run(suite());
        public static Test suite() {
            return new TestSuite(FinalVariablesTest.class);
         * Test Cases
        /** tests the effect of passing an (final or non-final) int parameter
         to a method which uses the variable in a for loop.
         <p>
         Linux System:
         cat /proc/cpuinfo
         processor       : 0
         vendor_id       : GenuineIntel
         cpu family      : 6
         model           : 8
         model name      : Pentium III (Coppermine)
         stepping        : 1
         cpu MHz         : 501.146
         cache size      : 256 KB
         fdiv_bug        : no
         hlt_bug         : no
         sep_bug         : no
         f00f_bug        : no
         coma_bug        : no
         fpu             : yes
         fpu_exception   : yes
         cpuid level     : 2
         wp              : yes
         flags           : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 mmx fxsr xmm
         bogomips        : 999.42
         </pre>
         <p>
         Results:
         <pre>
         java version "1.4.0"
         Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
         Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
         final     non-final
         498     500
         491     494
         491     493
         491     494
         534     494
         492     494
         491     494
         492     493
         491     494
         495     494
         4966     4944 (Totals)
         </pre>
        public final void testIntParametersToForLoop() {
         final int RUNS = 10;
         final int INNER = 1000000;
         final int OUTER = 10;
         System.out.println("-----------------------");
         System.out.println("testIntParametersToForLoop");
         for(int i=0; i<RUNS; i++) {
             outerFinalIntParametersToForLoop(INNER, OUTER);
             outerNonFinalIntParametersToForLoop(INNER, OUTER);
        private final void outerFinalIntParametersToForLoop(final int INNER,
                                       final int OUTER) {
         // with final var in for loop
         long start0 = System.currentTimeMillis();
         for(int i=0; i<OUTER; i++) {
             innerFinalIntParametersToForLoop(INNER * i);
         long end0 = System.currentTimeMillis();
         System.out.println("      final:       " +
                      ( end0 - start0 ) + " milliseconds");
        private final void outerNonFinalIntParametersToForLoop(final int INNER,
                                          final int OUTER) {
         // with non-final var in for loop
         long start1 = System.currentTimeMillis();
         for(int i=0; i<OUTER; i++) {
             innerNonFinalIntParametersToForLoop(INNER * i);
         long end1 = System.currentTimeMillis();
         System.out.println("  non final: " +
                      ( end1 - start1 ) + "       milliseconds");
        private final void innerFinalIntParametersToForLoop(final int INNER) {
         for(int i=0; i<INNER; i++) {
             int testVar = i * INNER;
        private final void innerNonFinalIntParametersToForLoop(int loops) {
         for(int i=0; i<loops; i++) {
             int testVar = i * loops;

  • Advanced functions,UDF's and node function

    Dear all,
    Can you kindly let me know about Advanced functions,UDF's and node function.Differences and Uses.
    Also Let me know about the advantages,Disadvantages of Graphical,XSLT,Java,ABAP and ABAP XSLT mappings.
    Thanks,
    Srini

    Hi,
    The term Mapping means:
    1. The transformation process, and/or
    2. The transformation rules.
    Independently from XI, you can distinguish two different mappings
    • Structure mappings transform entire message structures.
    • Value mappings transform values within messages.
    Mapping Programs to Map Messages :
    Message Mapping
    Designed by using the graphical mapping editor of Integration Builder
    Result: Generated Java Code.
    Imported Archives
    Import externally defined mapping programs into repository
    Java mapping:
    Implemented by using a specific interface
    XSLT mapping:
    Runtime supports XSLT processor
    Java methods can be called from within a Style Sheet
    ABAP Mapping
    You can execute mapping programs in a sequence
    The exchange infrastructure supports three types of mappings:
    Message mappings that can be designed using a graphical mapping editor in the Integration Builder. As a result, Java code is generated from the graphical representation that is compiled before it can be executed on the integration server.
    You can implement your own Java mapping by implementing a specific interface of the mapping API.
    You can implement an XSLT mapping
    For the latter two, there is no tool support in XI. It is expected that they are developed using external development tools. To make them available for the integration server, they have to be imported into the integration repository as JAR
    files before (JAR: Java Archives).
    Developers can even decide to combine the different mapping technologies:
    Message mappings, XSLT mappings and Java mappings can be combined in a sequence by means of an interface mapping.
    XSLT mappings can use java functions
    Message mappings support user-defined functions that can use imported java packages of the same namespace.
    In SAP XI, there is 3 types of mappings. Namely
    XSLT Mapping
    Java Mapping
    ABAP Mapping
    Here is the details of each mapping.
    XSLT Mappings (ABAP Engine)
    Interface descriptions are in the form of XML documents. XSL Transformation (XSLT) is a member of the XML family of languages. It describes how an XML structure is transformed into another XML structure.
    Customers can develop an XSLT mapping by using the Transformation Editor of the ABAP Workbench. Such XSLT mappings are executed at runtime on the ABAP Engine of the Integration Server.
    To simplify matters, this section refers to XSLT mappings of the ABAP Engine as transformation programs to differentiate them from XSLT mappings from imported archives that are executed on the J2EE Engine.
    Features
    XPath and <xsl:include>
    You can define mappings using XSLT together with XPath. XPath is also a specification of the XML family. Using XPath you can address any node in an XML document. XSLT implements XPath expressions to select substructures of an XML document. Using templates in XSLT you can define the mapping rules for the selected substructures.
    You can use the XSLT tags <xsl:include> and <xsl:import> to include predefined templates for substructures in a complete mapping definition. In this way, you can reuse mappings for data types.
    Java Mapping
    You can implement mapping programs in Java. To process XML documents, use Java API for XML Processing (JAXP), for example. The JAXP supports the Document Object Model (DOM) and the Simple API for XML (SAX). This gives you great flexibility for mapping definitions with Java.
    Implementation Considerations
    Java mapping programs are not permitted to be stateful. You are therefore not permitted to perform actions such as writing data to a database table during a Java mapping. The Integration Server cannot track such side effects. Therefore, if an attempt is made to resend a message that has not been received by the receiver, the data may inadvertently be written to the database twice in a Java mapping.
    If you use JRE classes in your Java mapping programs then the same program restrictions apply as for Enterprise Java Beans (EJBs). For a detailed description of these restrictions, see the relevant EJB specification. It is important that you also refer to the information under Scope of Functions in Runtime Environment (Java Mappings).
    The runtime environment for Java mappings has an mapping API. To use Java mapping, you must define a Java class that implements the Java interface com.sap.aii.mapping.api.StreamTransformation. This interface has two methods:
    &#9679; public void execute(java.io.InputStream in, java.io.OutputStream out)
    At runtime, the Integration Engine calls this method to execute a mapping. This method contains an input stream for the source document and an output stream for the target document as parameters. These streams are usually XML documents. You can import the substructures to be converted from the input stream and output the converted target document in the output stream.
    &#9679; public void setParameter(java.util.Map param)
    The Integration Engine transfers parameters to the mapping program with this method. It evaluates these parameters at runtime in the method execute(). This enables you to control the process flow of the mapping.
    The transferred object that implements the Java interface java.util.Map contains seven key/value pairs as parameters. These correspond to corresponding fields in the message header. Apart from the MAPPING_TRACE constant, the value objects are of type java.lang.String. The key objects are defined in the class com.sap.aii.mapping.api.StreamTransformationConstants
    ABAP Mappings
    ABAP mappings are mapping programs in ABAP objects that customers can implement using the ABAP Workbench.
    Features
    An ABAP mapping comprises an ABAP class that implements the interface IF_MAPPING in the package SAI_MAPPING.
    Exception: CX_MAPPING_FAULT
    Applications can decide themselves in the method EXECUTE how to import and change the source XML document. If you want to use the XSLT processor of SAP Web AS, you can use the ABAP Workbench to develop a stylesheet directly (see XSLT Mappings (ABAP Engine)) rather than using ABAP mappings.
    Runtime Constants
    In ABAP mapping you can read access message header fields. To do this, an object of type IF_MAPPING_PARAM is transferred to the EXECUTE method. The interface has constants for the names of the available parameters and a method GET, which returns the respective value for the parameter name. The constants are the same as in Java mappings, although the constant MAPPING_TRACE does not exist for ABAP mappings. Instead, the trace object is transferred directly using the parameter TRACE of the method IF_MAPPING~EXECUTE
    Example: Accessing a Runtime Constant
    Method IF_MAPPING~EXECUTE.
    Get mapping constant SENDER_SERVICE
    data: l_sender_service type string.
    l_sender_service = param->get( IF_MAPPING_PARAM=>SENDER_SERVICE ).
    ENDMETHOD.
    These r excellent websites which contain PPT & PDF documents on mapping:
    Excellent PDF Document on Mapping
    http://help.sap.com/bp_bpmv130/Documentation/Operation/MappingXI30.pdf
    Mapping Development with the ABAP Workbench
    http://help.sap.com/saphelp_nw04/helpdata/en/10/5abb2d9df242f6a62e22e027a6c382/content.htm
    ABAP Mappings
    http://help.sap.com/saphelp_nw04/helpdata/en/ba/e18b1a0fc14f1faf884ae50cece51b/content.htm
    how to create a flat file out of an IDoc-XML by means of an ABAP mapping program and the J2EE File Adapter.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a
    How to Use ABAP Mapping in XI 3.0
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e3ead790-0201-0010-64bb-9e4d67a466b4
    Hope this will help you, and don't forget to close this thread.
    Regards
    Aashish Sinha
    PS : reward points if helpful

  • What is the Java equivalent of Visual BAsic ASC() and MID() functions

    Hello all! I just would like to ask if you have any idea on how to convert the VB ASC() and MID() functions into java. Where:
    1. ASC( ) Function - Returns the ANSI value for the leftmost character in a character expression.
    2. MID() Function - The Mid method extracts a substring of length nCount characters from a CHString string, starting at position nFirst (zero-based). The method returns a copy of the extracted substring.
    I would really appreciate your help. Thanx!

    ah yeah! sorry typo error. see, I am converting a VB method that encrypts password:
    Function EncryptText(ByVal stDecryptedText As String)
    Dim stText As String, lngCounter As Long
    Dim iTemp As Integer, lngNumber As Long
    lngCounter = 1
    lngNumber = 8
    Do Until lngCounter = Len(stDecryptedText) + 1
    iTemp = Asc(Mid(stDecryptedText, lngCounter, 1))
    If lngCounter Mod 2 = 0 Then
    iTemp = iTemp - lngNumber
    Else
    iTemp = iTemp + lngNumber
    End If
    iTemp = iTemp Xor (10 - lngNumber)
    stText = stText & Chr$(iTemp)
    lngCounter = lngCounter + 1
    Loop
    EncryptText = stText
    End Function
    I converted this function into this:
    public static String encryptPass(String password) {
    String encpwd = "";
    int iTemp = 0;
    final int lngNumber = 8;
    String stText = "";
    for ( int i = 0; i < password.length() ; i++ ) {
         iTemp = Character.getNumericValue(password.charAt(i));
         if ( i % 2 == 0 ) {
         iTemp = iTemp - lngNumber;
         } else {
         iTemp = iTemp + lngNumber;
         iTemp = iTemp ^ (10 - lngNumber);
         char c = Character.forDigit(iTemp,Character.MAX_RADIX);
         encpwd = encpwd + String.valueOf(c);
         return encpwd;
    But I'm having trouble with the encryption because it returns a different set of characters. Did I convert it right? thanx.

  • Static __thread member : class vs. template

    Hello,
    I am observing a kind of mismatch between simple class declaration and
    class template instantiation.
    ----- working.cpp ---------
    class A {
    static __thread int a;
    __thread int A::a;
    ----- failing.cpp ---------
    template<typename TT> class TA {
    typedef TT TA_type;
    static __thread TT a;
    typedef TA<int> A;
    template<> __thread A::TA_type A::a;
    Why does sunCC 5.10 tells me that in the 2nd case __thread
    is not allowed here? (gcc for example insists of __thread being
    specified here).
    Thanks!
    --L
    Edited by: Landmann on Nov 27, 2008 7:12 AM
    Edited by: Landmann on Nov 27, 2008 7:18 AM

    The bug number is 6779114, and you can track its status at [http://bugs.sun.com]
    If you have a service contract with Sun, you can have the bug escalated to get a fix sooner, and also get a pre-release version of a patch with the bug fix.

  • Problem - Class containing template functions

    Hi everyone,
    I've written a simple class (not template), containing one template functions, like te following one:
    class MyClass
    public:
    template <typename T>
    typename T::_ptr_type DoSomeThing(int a, int b);
    When I am within a function and I need to call DoSomeThing, I have no problems if I declare a local variable of class MyClass, but I get the following compilation error:
    Error: Unexpected type name "ThirdClass" encountered
    when I use a pointer or a reference to MyClass that is declared elsewhere in the code.
    The following is a sample code that returns me an error:
    int OtherClass::MyFunc()
    m_pMyClass->DoSomeThing<ThirdClass>(10, 20);
    In the above function m_pMyClass is a member variable of OtherClass pointing to an instance of MyClass and ThirdClass is a valid class name (visible to the function).
    Does anyone know why I got the error ?
    Thank you,
    Massimo

    You need to use the syntax:
    m_pMyClass->template DoSomeThing<ThirdClass>(10, 20);
    Really, exactly like I wrote it ;)
    Josh

  • Here's how to do ALV (OO) with dynamic fcat, int table and editable data

    Hi everybody
    Here's a more useful approach to ALV grid with OO using dynamic table, data NOT from DDIC, dynamic FCAT and how to get changed lines from the grid when ENTER key is pressed.
    It's really not too dificult but I think this is more useful than the ever present SFLIGHT methods from the demos.
    This also defines a subclass of cl_gui_alv_grid so you can access the protected attributes / methods of that class.
    You don't need to add the class via SE24 -- done fron this ABAP.
    When you run it click Edit for the first time.
    After editing data press ENTER and the break point should bring you into the relevant method.
    Code developed on NW2004S trial version but also works on rel 6.40 on a "Real" system.
    The code should work without any changes on any system >=6.40.
    All you need to do is to create a blank screen 100 via SE51  with a custom container on it called CCONTAINER1.
    The rest of the code can just be uploaded into your system using the SE38 upload facility.
    When running the program click on the EDIT button to enable the edit functionality of the grid.
    Change your data and when you press ENTER you should get the break-point where you can see the original table and changed rows.
    This program is actually quite general as it covers Dynamic tables, building a dynamic fcat where your table fields are NOT in the DDIC, intercepting the ENTER key via using an event, and accessing the protected attributes of the cl_gui_alv_grid by defining a subclass of this class in the abap.
    I've seen various questions relating to all these functions but none in my view ever answers the questions in a simple manner. I hope this simple program will answer all these and show how using OO ALV is actually quite easy and people shouldn't be scared of using OO.
    Have fun and award points if useful.
    Cheers
    Jimbo.
    <b>PROGRAM zdynfieldcat.
    Simple test of dynamic ITAB with user defined (not ddic) fields
    Build dynamic fcat
    use ALV grid to display and edit.
    *When edit mode set to 1 toolbar gives possibility of adding and
    *deleting rows.
    *Define subclass of cl_gui_alv_grid so we can use protected attributes
    *and methods.
    Add event handler to intercept user entering data and pressing the
    *ENTER key.
    When enter key is pressed get actual value of NEW table (all rows)
    rather than just the changed data.
    *use new RTTI functionality to retrieve internal table structure
    *details.
    Create a blank screen 100  with a custom container called CCONTAINER1.
    James Hawthorne
    include <icon>.
    define  any old internal structure  NOT in DDIC
    types: begin of s_elements,
           anyfield1(20) type c,
           anyfield2(20) type c,
           anyfield3(20) type c,
           anyfield4(20) type c,
           anyfield5(11) type n,
           end of s_elements.
    types:  lt_rows  type lvc_t_roid.
    Note new RTTI functionality allows field detail retrieval
    at runtime for dynamic tables.
    data:   wa_element type s_elements ,
            wa_data type s_elements,
            c_index type sy-index,
            c_dec2 type s_elements-anyfield5,
            wa_it_fldcat type lvc_s_fcat,
            it_fldcat type lvc_t_fcat,
            lr_rtti_struc TYPE REF TO cl_abap_structdescr,    "RTTI
            lt_comp TYPE cl_abap_structdescr=>component_table,"RTTI
            ls_comp LIKE LINE OF lt_comp,                     "RTTI
            zog  like line of lr_rtti_struc->components,      "RTTI
            struct_grid_lset type lvc_s_layo,
            l_valid  type c,
            new_table type ref to data.
    field-symbols: <dyn_table> type standard table,
                   <actual_tab> type standard table,
                   <fs1> type ANY,
                   <FS2> TYPE TABLE.
    data: grid_container1 type ref to cl_gui_custom_container.
    class lcl_grid_event_receiver definition deferred.
    data: g_event_receiver type ref to lcl_grid_event_receiver.
    data: ls_modcell type LVC_S_MODI,
          stab type ref to data,
          sdog type  s_elements.      .
    class lcl_grid_event_receiver definition.
      public section.
        methods:
        handle_data_changed
             for event data_changed of cl_gui_alv_grid
                 importing er_data_changed,
           toolbar for event toolbar of cl_gui_alv_grid
                     importing e_object
                               e_interactive,
          user_command for event user_command of cl_gui_alv_grid
                     importing e_ucomm.
    endclass.
    *implementation of Grid event-handler class
    class lcl_grid_event_receiver implementation.
    method handle_data_changed.
    code whatever required after data entry.
    various possibilites here as you can get back Cell(s) changed
    columns or the entire updated table.
    Data validation is also possible here.
    perform check_data using er_data_changed.
    endmethod.
    Method for handling all creation/modification calls to the toolbar
      method toolbar.
        data : ls_toolbar type stb_button.
    Define Custom Button in the toolbar
        clear ls_toolbar.
        move 0 to ls_toolbar-butn_type.
        move 'EDIT' to ls_toolbar-function.
        move space to ls_toolbar-disabled.
        move 'Edit' to ls_toolbar-text.
        move icon_change_text to ls_toolbar-icon.
        move 'Click2Edit' to ls_toolbar-quickinfo.
        append ls_toolbar to e_object->mt_toolbar.
        clear ls_toolbar.
        move 0 to ls_toolbar-butn_type.
        move 'UPDA' to ls_toolbar-function.
        move space to ls_toolbar-disabled.
        move 'Update' to ls_toolbar-text.
        move icon_system_save to ls_toolbar-icon.
        move 'Click2Update' to ls_toolbar-quickinfo.
        append ls_toolbar to e_object->mt_toolbar.
        clear ls_toolbar.
        move 0 to ls_toolbar-butn_type.
        move 'EXIT' to ls_toolbar-function.
        move space to ls_toolbar-disabled.
        move 'Exit' to ls_toolbar-text.
        move icon_system_end to ls_toolbar-icon.
        move 'Click2Exit' to ls_toolbar-quickinfo.
        append ls_toolbar to e_object->mt_toolbar.
      endmethod.
      method user_command.
        case e_ucomm .
          when 'EDIT'.          "From Tool bar
            perform set_input.
             perform init_grid.
          when 'UPDA'.          "From Tool bar
            perform refresh_disp.
            perform update_table.
          when 'EXIT'.          "From Tool bar
            leave program.
        endcase.
      endmethod.
    endclass.
    class zcltest definition inheriting from  cl_gui_alv_grid.
    define this as a subclass so we can access the protected attributes
    of the superclass cl_gui_alv_grid
    public section.
    methods: constructor, disp_tab.
    endclass.
    need this now to instantiate object
    as we are using subclass rather than the main cl_gui_alv_grid.
    class zcltest implementation.
    METHOD constructor.
    CALL METHOD super->constructor
            exporting i_appl_events = 'X'
               i_parent = grid_container1.
    endmethod.
    method disp_tab.
    FIELD-SYMBOLS: <outtab> TYPE STANDARD TABLE.
    break-point 1.
    mt_outtab is the data table held as a protected attribute
    in class cl_gui_alv_grid.
    ASSIGN me->mt_outtab->* TO <outtab>.  "Original data
    do whatever you want with <outtab>
    contains data BEFORE changes each time.
    Note that NEW (Changed) table has been obtained already by
    call to form check_data USING P_ER_DATA_CHANGED
             TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.
    Entered data is in table defined by <fs2>
    In this method you can compare original and changed data.
    Easier than messing around with individual cells.
    do what you want with data in <fs2>  validate / update / merge etc
    endmethod.
    endclass.
    data :
        ok_code like sy-ucomm,
        save_ok like sy-ucomm,
        i4 type int4,
    Container Object [grid_container]
    now created via method constructor
    in the subclass zcltest.
    Control Object [grid]
    grid1 type ref to zcltest,
    Event-Handler Object [grid_handler]
    grid_handler type ref to lcl_grid_event_receiver.
    start-of-selection.
    call screen 100.
    module status_0100 output.
    now display it as grid
    if grid_container1 is initial.
        create object grid_container1
            exporting
              container_name = 'CCONTAINER1'.
        create object grid1.
         break-point 1.
        create object grid_handler.
        set handler:
           grid_handler->user_command for grid1,
           grid_handler->toolbar for grid1,
           grid_handler->handle_data_changed for grid1.
    perform create_dynamic_fcat.
    perform create_dynamic_itab.
    perform populate_dynamic_itab.
    perform init_grid.
    perform register_enter_event.
    set off ready for input initially
    i4 = 0.
      call method grid1->set_ready_for_input
             exporting
               i_ready_for_input = i4.
    endif.
    endmodule.
    module user_command_0100 input.
    *PAI not needed in OO ALV anymore as User Commands are handled as events
    *in method user_command.
    *we can also get control if the Data entered and the ENTER is pressed by
    *raising an event.
    Control then returns to method handle_data_changed.
    endmodule.
    form create_dynamic_fcat.
    get structure of our user table for building field catalog
    Use the RTTI functionality
    lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( wa_data ).
    Build field catalog just use basic data here
    colour specific columns as well
    loop at lr_rtti_struc->components into zog.
    c_index = c_index + 1.
    clear wa_it_fldcat.
      wa_it_fldcat-fieldname = zog-name .
      wa_it_fldcat-datatype =  zog-type_kind.
      wa_it_fldcat-inttype =   zog-type_kind.
      wa_it_fldcat-intlen =    zog-length.
      wa_it_fldcat-decimals =  zog-decimals.
      wa_it_fldcat-lowercase = 'X'.
      if c_index eq 2.
      wa_it_fldcat-emphasize = 'C411'.
         endif.
        if c_index eq 3.
      wa_it_fldcat-emphasize = 'C511'.
       endif.
      append wa_it_fldcat to it_fldcat .
    endloop.
    endform.
    form create_dynamic_itab.
    Create dynamic internal table and assign to field sysmbol.
    Use dynamic field catalog just built.
    call method cl_alv_table_create=>create_dynamic_table
                 exporting
                    it_fieldcatalog = it_fldcat
                 importing
                    ep_table        = new_table.
    assign new_table->* to <dyn_table>.
    endform.
    form populate_dynamic_itab.
    load up a line of the dynamic table
    c_dec2 = c_dec2 + 11.
    wa_element-anyfield1 = 'Tabbies'.
    wa_element-anyfield2 = 'ger.shepards'.
    wa_element-anyfield3  = 'White mice'.
    wa_element-anyfield4 =  'Any old text'.
    wa_element-anyfield5 =  c_dec2.
    append  wa_element to <dyn_table>.
    endform.
    form check_data USING P_ER_DATA_CHANGED
               TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.
    Get altered data back
      ASSIGN   p_er_data_changed->mp_mod_rows TO <FS1>.
    stab =       p_er_data_changed->mp_mod_rows.
    ASSIGN STAB->* TO <FS2>.
    LOOP AT <FS2> INTO sdog.
    ALV grid display with altered data is now in <fs2>.
    do any extra processing you want here
    endloop.
    now display new table
    call method grid1->disp_tab.
    endform.
    form exit_program.
      call method grid_container1->free.
      call method cl_gui_cfw=>flush.
      leave program.
    endform.
    form refresh_disp.
      call method grid1->refresh_table_display.
    endform.
    form update_table.
    The dynamic table here is the changed table read from the grid
    after user has changed it
    Data can be saved to DB or whatever.
    loop at <dyn_table> into wa_element.
    do what you want with the data here
    endloop.
    switch off edit mode again for next function
    i4 = 0.
      call method grid1->set_ready_for_input
          exporting
              i_ready_for_input = i4.
    endform.
    form set_input.
    i4 = 1.
      call method grid1->set_ready_for_input
         exporting
           i_ready_for_input = i4.
    endform.
    form switch_input.
    if i4 = 1.
    i4 = 0.
    else.
    i4 = 1.
    endif.
      call method grid1->set_ready_for_input
         exporting
           i_ready_for_input = i4.
    endform.
    form init_grid.
    Enabling the grid to edit mode,
         struct_grid_lset-edit = 'X'. "To enable editing in ALV
         struct_grid_lset-grid_title  = 'Jimbos Test'.
         call method grid1->set_table_for_first_display
           exporting
             is_layout           = struct_grid_lset
           changing
             it_outtab             =  <dyn_table>
             it_fieldcatalog       =  it_fldcat.
    endform.
    form register_enter_event.
    call method grid1->register_edit_event
                   exporting
                      i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    Instantiate the event or it won't work.
    create object g_event_receiver.
    set handler g_event_receiver->handle_data_changed for grid1.
    endform.</b>

    Hi there
    IE7 doesn't give me the add new page option and I get 404 error when trying to access the "How to contribute" section.
    I'll load up Firefox later (this browser usually works when IE7 doesn't always work properly).
    I'll copy the stuff to the wiki when I've got the browser sorted out.
    Cheers
    jimbp

  • Old Purchase orders and template - Price Information not taken into account

    Hi experts,
    In MDM catalog, I have a product with 'Price Information' and with 'Contract price'. I create a shopping cart with the 'Price Information'.
    Then, I create another shopping cart using the anterior througth the functionality 'Old Purchase orders and template'.
    The price taken into account is the 'Contract Price'
    Is this the standard procedure?
    Thanks in advance,
    R Silva

    as far as i know the price preference is in this order
    1. Contract price
    2. Purchase Info record
    3. list price
    so in that case - this is standard procedure
    you can confirm - by doing the same process for an item that  has ONLY price information (list price) and see if that price is copied from old to new SC
    thanks
    -Adrivit

  • Display Like and Share functionality in SharePoint 2013 search result

    Hello Experts,
    I dont Know whether i am asking a good question or bad one . but i am not very much expert in search.
    I have to display No of Likes , Share functionality in SharePoint Search Results. 
    i know little basic about how display templates works. i want to implement these like and share functionality as actions  in Item_common_hoverpanel_Actions template. show that i can see in preview.
    please if any body can help me . i will be highly thankful to you.
    Mukesh

    This will be difficult. The number of likes has a managed property called LikesCount but it is not populated by the search crawler. So your JavaScript will have to read the "LikesCount" field of the corresponding list item. That would be a
    lot of code to execute in the item display template just to display the number of likes. You could have a button that displayed a callout that would get the information and display it. The Sharing could be done via JavaScript in your item display template
    using a REST call. You can see an example of code to do that here:
    http://sharepointfieldnotes.blogspot.com/2014/09/sharing-documents-with-sharepoint-rest.html?showComment=1428595550241#c3227376854590814312
    Just remember the user must have permission to share these documents, so your code will have to handle this.
    Blog | SharePoint Field Notes Dev Tools |
    SPFastDeploy | SPRemoteAPIExplorer

Maybe you are looking for