Why do we use cl_gui_cfw= flush method in Object Oriented ALV programming

Dear Friends,
Please solve my query regarding control framework. Why do we use cl_gui_cfw=>flush method in Object Oriented ALV programming. I studied and found that this method transfers automation queue to Front end.  But I could not find any further update on this.
Thanks & Regards
Amit Sharma

Generally this is to restrict the traffic b/w frontend and backend. This means that every operation in Control Framework should be first buffered in the backend and synchronized with the frontend at certain points (one of this point is calling synchronization method cl_gui_cfw=>flush ). This explicit order of synchronization is due to RFC call needed for every communication b/w front/back end. So to avoid to many RFC calls we do it only at certain time.
Please refer [Automation Queue|http://help.sap.com/saphelp_wp/helpdata/en/9b/d080ba9fc111d2bd68080009b4534c/frameset.htm]. I think it explains the concept quite well.
Regards
Marcin

Similar Messages

  • How to capture index/row no of row in table using object oriented alv.

    i have a table with many fields. i have an alv grid table displayed using object oriented alv. when i double click on a record, i call another screen. there i want to display the record number. eg, if i doubleclick on the third row, i will go to next screen and display 3 there.
    please let me know how it is done as it is urgent.
    thanks in advance.

    Hi,
    Use the following code to get rowno.
    CLASS lcl_grid_events DEFINITION DEFERRED.
    DATA:
      grid1_events      TYPE REF TO lcl_grid_events.
    CLASS lcl_grid_events DEFINITION.
      PUBLIC SECTION.
        METHODS:
          dbclk
           FOR EVENT double_click  OF cl_gui_alv_grid
           IMPORTING e_row
                     e_column
                     es_row_no.
    ENDCLASS.                    "lcl_grid_events DEFINITION
    CLASS lcl_grid_events IMPLEMENTATION.
      METHOD dbclk.
    *access e_row variable, which contains the record no.
      ENDMETHOD.                    "dbclk
    ENDCLASS.                    "lcl_grid
    write the following code after method call of set_table_for_first_display
        CREATE OBJECT grid1_events.
        SET HANDLER grid1_events->dbclk
                    FOR grid1.
    reward point if useful.

  • How to display horizontal line in top-of-page by using object oriented ALV?

    How to display horizontal line in top-of-page by using object oriented ALV.
    I am created top-of-page in object oriented alv.
    But not be successes in showing horizontal line in it.
    Can any one pls give solution for this..
    Thanks and regards..

    Hi
    Try like this
    data: gt_list_top_of_page type slis_t_listheader. " Top of page text. 
    Initialization. 
    perform comment_build using gt_list_top_of_page[]. 
    form top_of_page. 
    * Note to self: the gif must be loaded into transaction OAOR with 
    * classname 'PICTURES' AND TYPE 'OT' to work with ALV GRID Functions. 
    * I Loaded NOVALOGO2 into system. 
    call function 'REUSE_ALV_COMMENTARY_WRITE' 
         exporting 
    * I_LOGO = 'NOVALOGO2' 
    * i_logo = 'ENJOYSAP_LOGO' 
             it_list_commentary = gt_list_top_of_page. 
    endform. " TOP_OF_PAGE 
    form comment_build using e04_lt_top_of_page type slis_t_listheader. 
    data: ls_line type slis_listheader. 
          clear ls_line. 
          ls_line-typ = 'A'. 
          ls_line-info = 'Special'(001). 
          fgrant = xgrant. 
          concatenate ls_line-info fgrant 
          'Stock Option Report to the board'(002) 
                 into ls_line-info separated by space. 
                        condense ls_line-info. 
          append ls_line to e04_lt_top_of_page. 
    endform. " COMMENT_BUILD
    Use following syntex for footer print in alv:
    * For End of Page
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    *  For End of Report
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    check this link
    http://abapprogramming.blogspot.com/
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5dc3e690-0201-0010-1ebf-b85b3bed962d
    Changing width of a custom container dynamically
    Display Page numbers in ALV
    Insert picture in selection screen.
    Logo in OO ALV Grid
    Reward all helpfull answers
    Regards
    Pavan

  • How to use LDB PNP with ABAP objects in a program

    Hello,
    I am wondering if anybody has used the HR logical database(LDB) PNP with user defined ABAP objects in a program? I am using the FM- <b>LDB_PROCESS</b> but its not working. Also assigning PNP in the attributes section of the program -- so that I can use predefined fields from the LDB and then invoking the FM doesn't work -- throwing 'Logical database already active' error.
    I suppose even with the ABAP objects and the new FM -- I should still be able to utilize the pre-defined fields of the PNP database -- and also the built in authorizations. I cannot use GET PERNR and REJECT as they give errors. I understand that the use of HR-macros (RP-PROVIDE-FROM-LAST and et al.) are not allowed as they use the table work area -- which is not allowed in ABAP-OOPS.
    I would really appreciate if anyone could show me some insight regarding this. Thank you.
    Kshitij R. Devre

    Hi Kshitij
    It would be really good if we could use both together. But as I know, it is not possible. "GET pernr." is an event-like loop statement and so cannot be used in OO context. And I guess, the same restriction holds for the "LDB_PROCESS" since it uses LDB-specific processing.
    What I suggest you is to use standard and BAPI functions.
    Sorry for giving bad news...
    *--Serdar

  • Using APT ActiveX methods to create a labview program for BPC 203 3 channel Benchtop Piezo controller

    Hi Everyone,
                      I am really very new to Labview and i am in great need for some help.I am assigned a task where i am supposed to create a labview program to control or moniter a BPC203 3 channel benchtop  Piezo controller. I created a program with the help of the instructions provided in the APT-Labview guide provided by Thorlabs.But th program doesnt run . Whenever i try to run it i get the same error which says that "Control HW Communications disabled".I have attached a snapshot of the error message.So i tried to create a small program in labview which would read the volage output.Even there i got the same error message.I suppose there is some mistake on my part which i am not able to correct due to the lack of proper knowledge.Could anyone please help me to solve this problem.A slight elaboration would be highly appreciated.Also i think the error lies in the use of invoke node with the get Voltage output method. I am not sure whether the parameters i have provided to the invoke node are correct.Any help of any sort would be highly appreciated.
    Attachments:
    Front Panel with error message.PNG ‏202 KB
    Block diagram.PNG ‏101 KB

    Hi
    I had the same problem today. However, I noticed that the piezo controller has 3 channels with separate slots and they are packaged in the same box. Therefore the whole box has a serial number, probably something like 71822280, and this is written with large letter. Now, in order to communicate with any of the channels, this does not help, but one needs to communicate directly with the interested channel and they have thier OWN SERIAL NUMBERS.
    For example channel 1 (my X direction in the nanoMax stage) has serial 91822281, Y has 91822282 and Z has 91822283. So try looking if you have the right serial number Hopefully you found out this yourself but this might help others, I took me3 hours to get this thing working when I started to plug-in the cables and everything.
    Lasse

  • Why do i need to declate methods two times for this program work

    Hi,
    why should i have to declare 2 times the methods
    public void mouseClicked(MouseEvent e) {    }
    public void mousePressed(MouseEvent e) {    }
    public void mouseReleased(MouseEvent e) {    }
    public void mouseEntered(MouseEvent e) { }
    public void mouseExited(MouseEvent e) {  }
    to make this program work? why when i declate 1 time this program doesn't work good?
    import java.awt.*;*
    import javax.swing.;
    import java.awt.datatransfer.*;
    import java.io.FileReader;
    import java.io.IOException;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseEvent;
    public class Main extends JPanel implements MouseListener {
    public Main() {
    super(new GridLayout(2,2));
    final JTextArea jt= new JTextArea("dear test :) ",5,20);
    FileReader reader = null;
    System.err.println("Error closing reader");
    exception.printStackTrace();
    JButton bu = new JButton("copiar");
    final Clipboard clipboard = getToolkit().getSystemClipboard();
    //new add
    add(nn);
    add(tt);
    bu.addMouseListener(new MouseListener() {
    public void mouseEntered(MouseEvent e) {
    StringSelection data = new StringSelection(jt.getText());
    clipboard.setContents(data, data);
    public void mouseClicked(MouseEvent e) {
    public void mousePressed(MouseEvent e) {
    public void mouseReleased(MouseEvent e) {
    public void mouseExited(MouseEvent e) {
    private static void createAndShowGUI() {
    //Create and set up the window.
    JFrame frame = new JFrame("TextDemo");
    public static void main(String[] args) {
    //Schedule a job for the event dispatch thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    public void mouseClicked(MouseEvent e) {    }
    public void mousePressed(MouseEvent e) {    }
    public void mouseReleased(MouseEvent e) {    }
    public void mouseEntered(MouseEvent e) { }
    public void mouseExited(MouseEvent e) {  }
    }

    import java.awt.;
    import javax.swing.;
    import java.awt.datatransfer.*;
    import java.io.FileReader;
    import java.io.IOException;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseEvent;
    public class Main extends JPanel implements MouseListener {
    public Main() {
    super(new GridLayout(2,2));
    final JTextArea jt= new JTextArea("dear test :) ",5,20);
    FileReader reader = null;
    System.err.println("Error closing reader");
    exception.printStackTrace();
    JButton bu = new JButton("copiar");
    final Clipboard clipboard = getToolkit().getSystemClipboard();
    //new add
    add(nn);
    add(tt);
    bu.addMouseListener(new MouseListener() {
    public void mouseEntered(MouseEvent e) {
    StringSelection data = new StringSelection(jt.getText());
    clipboard.setContents(data, data);
    public void mouseClicked(MouseEvent e) { }
    public void mousePressed(MouseEvent e) { }
    public void mouseReleased(MouseEvent e) {}
    public void mouseExited(MouseEvent e) { }
    private static void createAndShowGUI() {
    //Create and set up the window.
    JFrame frame = new JFrame("TextDemo");
    public static void main(String[] args) {
    //Schedule a job for the event dispatch thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    public void mouseClicked(MouseEvent e) { }
    public void mousePressed(MouseEvent e) { }
    public void mouseReleased(MouseEvent e) { }
    public void mouseEntered(MouseEvent e) { }
    public void mouseExited(MouseEvent e) { }
    } the problem is this line bu.addMouseListener(new MouseListener() {
    if i change this to bu.addMouseListener(this() {
    it gives error saying expected ')'
    and then doesn't compile.
    i just don't know why , although the program runs when i declare the methods two times,
    but i think it's better java code , if i learn it why is this error and correct it

  • Work area Inside a method in Object Oriented Programming

    Hi all,
    Can anyone look at the below code in the method meth1 and tell me is there any better method rather than declaring the workarea wa_itab  using t_mara.
    I can use field symbols but can i use access one field like if i say <fs>-matnr it doesnot let me do that
    I don't want to declare struture t_mara just to declare work area wa_itab. i know i can declare using field symbols like
    FIELD-SYMBOLS:<fs> type any. but how do i acess an individual field
    CLASS cls DEFINITION.
    PUBLIC SECTION.
    TYPES:BEGIN OF T_MARA,
         MATNR TYPE MARA-MATNR,
         meins TYPE MARA-meins,
    END OF T_MARA.
    data : WA_ITAB TYPE T_MARA.
    METHODS:meth1 importing itab type any table.
    ENDCLASS.
    CLASS cls IMPLEMENTATION.
    METHOD meth1.
    *FIELD-SYMBOLS:<fs> type itab."any.
    loop at itab into wa_itab. "assigning <fs>.
    write:/ wa_itab-matnr,wa_itab-meins.
    endloop.
    ENDMETHOD.
    ENDCLASS.
    START-OF-SELECTION.
    DATA:obj TYPE REF TO cls.
    CREATE OBJECT obj.
    TYPES:BEGIN OF T_MARA1,
         MATNR TYPE MARA-MATNR,
         meins TYPE MARA-meins,
    END OF T_MARA1.
    DATA:ITAB1 TYPE STANDARD TABLE OF T_MARA1,
             WA_ITAB1 TYPE T_MARA1.
    SELECT matnr meins FROM mara into TABLE itab1 up to 10 rows.
    CALL METHOD obj->meth1 exporting itab = itab1.
    Thanks

    I rewrote your code.
    Instead of declaring type again in the Program, I have created a table type and a public attribute IT_MARA which I have used to select the data and passed to my method to write the data.
    *       CLASS cls DEFINITION
    CLASS CLS DEFINITION.
      PUBLIC SECTION.
        TYPES:BEGIN OF T_MARA,
              MATNR TYPE MARA-MATNR,
              MEINS TYPE MARA-MEINS,
              END OF T_MARA.
        TYPES: TY_T_MARA TYPE STANDARD TABLE OF T_MARA.  " <<
        DATA: IT_MARA TYPE TY_T_MARA.   " <<
        METHODS:METH1
          IMPORTING
            ITAB TYPE TY_T_MARA.  "<<
    ENDCLASS.                    "cls DEFINITION
    *       CLASS cls IMPLEMENTATION
    CLASS CLS IMPLEMENTATION.
      METHOD METH1.
        DATA: LA_ITAB LIKE LINE OF ITAB.
        LOOP AT ITAB INTO LA_ITAB.
          WRITE:/ LA_ITAB-MATNR,LA_ITAB-MEINS.
        ENDLOOP.
      ENDMETHOD.                                                "meth1
    ENDCLASS.                    "cls IMPLEMENTATION
    START-OF-SELECTION.
      DATA:OBJ TYPE REF TO CLS.
      CREATE OBJECT OBJ.
      SELECT MATNR MEINS
        FROM MARA
        INTO TABLE OBJ->IT_MARA UP TO 10 ROWS.
      CALL METHOD OBJ->METH1
        EXPORTING
          ITAB = OBJ->IT_MARA.
    Regards,
    Naimesh Patel

  • When to syncronize automation queue (calling cl_gui_cfw= flush)

    Hello,
    I'm using OO ALV (using cl_gui_alv_grid class), with checkboxes and user interaction, and it all seems to work OK. But i'm not calling class method cl_gui_cfw=>flush in any point at my program, because I don't clearly understand what's the method's use and need.
    Could you please explain this to me? I've already read some SAP help about control framework, automation queue and all but still don't get it (so please try to explain instead of simply pasting SAP help links).
    Many thanks

    Ok, from your last post i deduce that for every control class (i.e. cl_gui_alv_grid), there's a proxy class in the application server. All that is transparent to the programmer.
    But could you give some example of when the necessity arises to use the flush method explicitly?
    My ALV code in this case isn't much complicated, i just call the check_changed_data method to detect changes in checkboxes and then call refresh_table_display. But would like to understand this fully so I can be prepared for any case.
    EDIT: I guess the need depends on the context of the program being developed. But I understood the concept so I'm closing the thread.
    Edited by: Alejandro Bindi on Aug 7, 2008 11:28 PM

  • Hi, why do we use the break and continue structure?

    Hi, I was wondering why do we use the break and continue structure in some program such as:
    for ( int i = 1; i <= 10; i++ ) {
    if ( i == 5 )
    break;
    So, now why do we use those codes, instead of achiving the same results by not using the if structure.
    I am new in java so I can be totaly wrong that is why my question come to you guys.
    I will appriciate if you let me understand more.

    I may not completely understand your question, but - imagine the following scenario:
    // Looking for some value in a long, unsorted list
    Object target = null;
    int index = -1;
    for (int i = 0; i < list.size(); i++) {
        Object curObject = list.get(i);
        if (curObject.equals(source)) {
            target = source;
            index = i;
    if (target != null){
        System.out.println("Found it at " + index);
    }You will always run through the entire long list, even if the thing you are looking for is the first thing in the list. By inserting a break statement as:
    // Looking for some value in a long, unsorted list
    Object target = null;
    int index = -1;
    for (int i = 0; i < list.size(); i++) {
        Object curObject = list.get(i);
        if (curObject.equals(source)) {
            target = source;
            index = i;
            break;
    if (target != null){
        System.out.println("Found it at " + index);
    }You can skip whatever's left in the list.
    As for continue, yes, I suppose you could use a big if, but that can get burdensome - you end up with code like:
    for (int i = 0; i < list.size(); i++) {
        Object curObject = list.get(i);
        // you want to do the rest only if some condition holds
        if (someCondition) {
            // do some stuff -
            // And you end up with lots of code
            // all in this if statement thing
            // which is ok, I suppose
            // but harder to read, in my opinion, than the
            // alternative
    }instead of
    for (int i = 0; i < list.size(); i++) {
        Object curObject = list.get(i);
        // you want to do the rest only if some condition holds
        if (!someCondition) {
            continue;
        // do some stuff -
        // And you end up with lots of code
        // all outside of any if statement thing
        // which is easier to read, in my opinion, than the
        // alternative
    }Hope that helped
    Lee

  • Java is pure object oriented programing language or not why?

    please clear
    java is pure object oriented programing language or not why?

    And there is some concepts of object orientation that
    Java not implements like: Operator
    Overloading and Multiple Heritage. But, i think
    that we can live without those features.
    And the sucess of Java is a proof of this.I don't believe that operator overloading and multiple inheritance are required aspects of object programming.

  • What is the functionality CALL METHOD CL_GUI_CFW= FLUSH

    Hi,
    What is the functionality of method "FLUSH" in class CL_GUI_CFW
    Should it be used after every call method CL_GUI_FRONTEND_SERVICES=>......
    What is the purpose of using it? What happens if we don't use it?

    hi
    good
    The class CL_GUI_CFW contains static methods that apply to all instantiated custom controls when you call them.
    You can force a synchronization point in your program by calling a method that is not buffered, or by calling the static method FLUSH.
    CLASS event_handler IMPLEMENTATION.
      METHOD handle_f1.
        DATA row TYPE i.
        MESSAGE i888(sabapdocu) WITH text-003.
        CALL METHOD sender->get_selection_pos
             IMPORTING from_line = row.
        CALL METHOD sender->get_line_text
             EXPORTING line_number = row
             IMPORTING text = field.
        CALL METHOD cl_gui_cfw=>set_new_ok_code 
             EXPORTING new_code = 'F1'.         
        CALL METHOD cl_gui_cfw=>flush.
      ENDMETHOD.
    thanks
    mrutyun^

  • Use of cl_gui_cfw= flush

    Hi all,
    what is the use of the class cl_gui_cfw=>flush. in alv object?
    Thanks
    ANUPAM

    Hi,
    Use this method to synchronize the automation queue. The buffered operations are sent to the frontend using GUI RFC. At the frontend, the automation queue is processed in the sequence in which you filled it.
    If an error occurs, an exception is triggered. You must catch and handle this error. Since it is not possible to identify the cause of the error from the exception itself, there are tools available in the Debugger and the SAPgui to enable you to do so.
    Debugger: Select the option Automation Controller: Always process requests synchronously. The system then automatically calls the method cl_gui_cfw=>flush after each method called by the Automation Controller.
    SAPGUI: In the SAPgui settings, under Trace, select Automation. The communication between the application server and the Automation Controller is then logged in a trace file that you can analyze at a later date.
    CALL METHOD cl_gui_cfw=>flush
                   EXCEPTIONS CNTL_SYSTEM_ERROR = 1
                             CNTL_ERROR = 2.
    AWARD IF USEFUL

  • Why do we use ejbCreate() method? what does it returns?

    why do we use ejbCreate() method? what does it returns?

    People think its easier to get answers handed tothem
    instead of looking...I do my best to disabuse them of that notion.I've given up on that idea, too much hard work.
    Instead I've just written off the entire current generation of schoolkids as useless, good only for (at most) menial labour.

  • Why do we use init() method instead of constructor to initialize a servlet?

    Why do we use init() method instead of constructor to initialize a servlet?

    I suspect the reasons are partly historical. A servlet is loaded dynamically, by class name and, once you've loaded the Class, it's easier to to a newInstance, using the default construtor than it is to search for a particular matching constructor and invoke it.

  • Why can't I use rs.deleteRow() method to delete a record?

    the code as such�F
    <%
    String sql="select id,name from test";
    ResultSet rs = jconst.executeQuery(sql);
    rs.next();
    out.print(rs.getInt("id"));
    try
    rs.deleteRow();
    catch (SQLException e)
    out.print("can't delete record");
    return;
    out.print("success");
    %>
    the result is "can't delete record" ,why? I use mysql database�C"jconst" is the bean of connect to mysql database! In the "jconst" bean , I use such method to return Resultset :
    public ResultSet executeQuery(String sql)
    rs = null;
    try
    conn = DriverManager.getConnection(ConnStr);
    Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
    rs = stmt.executeQuery(sql);
    catch(SQLException ex)
    System.err.println("aq.executeQuery: " + ex.getMessage());
    return rs;

    It's again the problem with not commiting the changes to databse. In order to commit changes to the database, you need to call the commit() of Connection explicitly or simply close the Statement and Connection objects in your bean.
    After rs.deleteRow() in your jsp you call another method of your bean jconst.saveChanges(); and add this method in your bean.
    public void saveChanges() {
    try {
    stmt.close();
    conn.close()
    } catch(SQLException sqle) {
    //handle the exception
    I hope this will work.
    Sudha
    PS: It's not a good practice to manipulate the database from your JSP. JSP is meant for presentation. You can do all these operations from bean itself.

Maybe you are looking for