How can I call functionality of ALV Grid by event of button outside grid?

Hello,
How can I call functionality of ALV Grid by event of button located outside ALV Grid? For example how to fire printing of this ALV Grid by button click elsewhere on the screen (not in toolbar of ALV Grid).
Best regards,
Josef Motl

hi Motl,
these are steps to create a button in ALV and trigger an event from it..
1.Use the parameter i_callback_pf_status_set in the function module REUSE_ALV_GRID_DISPLAY
i_callback_program = gd_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
form set_pf_status using rt_extab type slis_t_extab.
set pf-status 'NEWALVSTATUS'.
endform.
You have to copy the standard ALV pf stauts to 'NEWALVSTATUS' and add your button.
2.You have to do the following to process the new button click.
i_callback_user_command = 'USER_COMMAND'
form user_command using i_ucomm like sy-ucomm
is_selfield type slis_selfield.
case i_ucomm.
3. to copy the standard pf status to a new one.go to the ALV screen and take the menu System -> Status.  Then look for the standard pf status. Copy this to Z range and then add your new button.
reward points if helpful
regards
satesh

Similar Messages

  • How does the SORT function in ALV grid work?

    Hi,
    I have a report for which the o/p is displayed in ALV grid format.There is one column in the O/p strcuture which is "No of days".Based on certain conditions,i need to display the value for some of the days as Negative e.g. " - 45".Becasuse of this,I have declared the field for the "No of days" of the type "CHAR".
    Now when i sort(using ALV grid SORT function) the list on basis of this column,it doesnt give me the correct o/p.
    CAN anyone tell me how do i handle this?I want the list to be sorted correctly on basis of the "No of days" column.
    Thanks!

    This is your Fourth Cross Posting in last three days on same issue!!
    CHAR type column doesnt work for SORT function in ALV grid!
    How to sort a column of type CHAR
    I dont,ve link for your Fourth Thread on same,though i'm short memory loss.

  • How can we use the saved alv grid layout in a report?

    I have a requirement where I go to se16n transaction and select a few fields of a table and extract the data of the table. Again I re-arrange the columns in the report and save it as a variant along with this new layout. Now how to call this variant in a report wherein I want only the re arranged positions of the column(fields) of the field catalog? Is there any function module available?

    hi,
    you can have selection screen field : "parameters : p_disvar like disvariant-variant."  and at event selection scree you can call the below function and select the variant create for the report.
    "at selection-screen on value-request for p_disvar.
      call function 'REUSE_ALV_VARIANT_F4'
           exporting
                is_variant          = g_variant
              I_TABNAME_HEADER    =
              I_TABNAME_ITEM      =
              IT_DEFAULT_FIELDCAT =
                i_save              = g_variant_save
           importing
                e_exit              = h_exit
                es_variant          = gx_variant
            exceptions
                not_found           = 1
                program_error       = 2
                others              = 3.
      if sy-subrc is initial and h_exit is initial.
        g_variant-variant = gx_variant-variant.
        p_disvar          = gx_variant-variant.
      else.
        message id sy-msgid type 'S'
                     number sy-msgno
                     with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    Atul

  • How can I call functions in packages using flash builder?

    a new guy in flash developnet, I need to find out a way to import multiple packages into frames and call functions. I know how to import packages, but an error occurs error 1120 : access of undefined property. How can ı solve them?
    Is there any easy way to add Mediapomise object to the stage form the package? "addChild(loader);" does not work? or ı do not know whether it works or not, ı could not see the photo that ı took from camerauı object in android.
    thank you 

    I need to find out a way to import multiple packages into frames
    Usually, no matter where you use any classes of any package, the imports happen always in the beginning.
    If you have a specific problem with flashbuilder you should post in this forum:
    http://forums.adobe.com/community/flash_builder

  • How can i show details in ALV GRID with double click in a row?

    Hello, ich try to show the details of a row with double click in the line,
    but it doesn't work!?
    I have a eventhandler for doubleclick and the program run this code, but what i have to do, to show the details!?
    I try it with some methods like cl_gui_cfw=>set_new_ok_code, ...
    i think about the methods cl_gui_alv_grid->show_detail, but this method is private,
    i can create a class with inheritance of the cl_gui_alv_grid class and try this method!?
    Have anybody any ideas!?

    Hello Lars
    The following sample reports shows an ALV list with company codes. Double-clicking on any company code will open a second ALV list displaying all customers.
    *& Report  ZUS_SDN_ALVGRID_EVENTS_1
    REPORT  zus_sdn_alvgrid_events_1.
    DATA:
      gd_okcode        TYPE ui_func,
      gt_fcat          TYPE lvc_t_fcat,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_docking2      TYPE REF TO cl_gui_docking_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid,
      go_grid2         TYPE REF TO cl_gui_alv_grid.
    DATA:
      gt_t001          TYPE STANDARD TABLE OF t001,
      gt_knb1          TYPE STANDARD TABLE OF knb1.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING
              e_row
              e_column
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_double_click.
    *   define local data
        DATA:
          ls_t001     TYPE t001,
          ls_col_id   TYPE lvc_s_col.
        CHECK ( sender = go_grid1 ).
        READ TABLE gt_t001 INTO ls_t001 INDEX e_row-index.
        CHECK ( ls_t001-bukrs IS NOT INITIAL ).
        SELECT * FROM knb1 INTO TABLE gt_knb1
          WHERE bukrs = ls_t001-bukrs.
        IF ( syst-subrc NE 0 ).
          MESSAGE 'No customers found' TYPE 'S'.
        ELSE.
    *     Trigger PAI of dynpro '0100' and set new ok-code
          CALL METHOD cl_gui_cfw=>set_new_ok_code( 'CALL_SCREEN_0200' ).
        ENDIF.
      ENDMETHOD.                    "handle_hotspot_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT * FROM t001 INTO TABLE gt_t001.
      REFRESH: gt_knb1.
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          OTHERS                      = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT go_docking2
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          OTHERS                      = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Create ALV grid
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_docking
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT go_grid2
        EXPORTING
          i_parent          = go_docking2
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Set event handler
      SET HANDLER:
        lcl_eventhandler=>handle_double_click FOR go_grid1.
    * Display data
      CALL METHOD go_grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = 'T001'
        CHANGING
          it_outtab        = gt_t001
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL METHOD go_grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNB1'
        CHANGING
          it_outtab        = gt_knb1
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL METHOD go_docking2->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0200'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN 'CALL_SCREEN_0200'.
          go_grid2->refresh_table_display( ).  " necessary
          CALL SCREEN '0200'.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Regards
      Uwe

  • How can use  CALL FUNCTION   READ_TEXT

    Dear SAP Expert,
    I am working in Journal Voucher of smart form.  I want to show Long Text in SF. 
    So i am  using  the READ_TEXT function module to read SAP long text. and use Range of Clear Doc. in driver program.
    i have one ITAB which have 20 rows.
    problem is that CALL FUNCTION   READ_TEXT is not working properly ...........
    i WANT  store Long text   clear Doc. no. wise in my ITAB .
    DATA: FORMNAME TYPE     TDSFNAME VALUE 'ZFI_S_JOUR_VOUCHER'.
      DATA: FM_NAME  TYPE     RS38L_FNAM.
    lv_name = ITAB-BELNR.            
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
          id        = c_id
          language  = 'E'
          name      = lv_name
          object    = c_object
        TABLES
          lines     = lt_lines
        EXCEPTIONS
          id        = 1
          language  = 2
          name      = 3
          not_found = 4
          object    = 5.
        IF sy-subrc = 0.
        ELSE.
          LOOP AT lt_lines INTO wa_lines.
            CONCATENATE ld_text wa_lines-tdline INTO ld_text.
          ENDLOOP.
        ENDIF.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          FORMNAME = FORMNAME
        IMPORTING
          FM_NAME  = FM_NAME.
      DATA: V_PRCTR LIKE BSIS-PRCTR.
      CALL FUNCTION FM_NAME
    EXPORTING
        V_TYPE_DES                 = V_TYPE_DES
        P_BUKRS                    = P_BUKRS
    TABLES
          IT_BKPF                    = IT_BKPF
          ITAB                    = Itab
          TY_BSIS                    = TY_BSIS.
      IF SY-SUBRC <> 0.
      ENDIF.
    ENDFORM.                    " call_sm

    hI [See this |http://wiki.sdn.sap.com/wiki/display/BOBJ/FunctionExampleREAD_TEXTABAPwrapper+function]
    Check out the wiki session .
    FUNCTION Z_AW_READ_TEXT_ALL.
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(ID) TYPE  THEAD-TDID
    *"     REFERENCE(LANGUAGE) TYPE  THEAD-TDSPRAS
    *"     REFERENCE(NAME) TYPE  THEAD-TDNAME
    *"     REFERENCE(OBJECT) TYPE  THEAD-TDOBJECT
    *"  EXPORTING
    *"     REFERENCE(TEXT) TYPE  CHAR2000
    DATA BEGIN OF TEXTHEADER.
            INCLUDE STRUCTURE THEAD.
    DATA END OF TEXTHEADER.
    DATA BEGIN OF TEXTLINES OCCURS 10.
            INCLUDE STRUCTURE TLINE.
    DATA END OF TEXTLINES.
    CLEAR TEXTHEADER.
    data: l_name type TDOBNAME."TR
    l_name = name."TR
    CALL FUNCTION 'READ_TEXT'
           EXPORTING
                OBJECT                  = OBJECT
                ID                      = ID
                LANGUAGE                = LANGUAGE
                NAME                    = l_NAME "TR
           IMPORTING
                HEADER                  = TEXTHEADER
           TABLES
                LINES                   = TEXTLINES
           EXCEPTIONS
                ID                      = 1
                LANGUAGE                = 2
                NAME                    = 3
                NOT_FOUND               = 4
                OBJECT                  = 5
                REFERENCE_CHECK         = 6
                WRONG_ACCESS_TO_ARCHIVE = 7
                OTHERS                  = 8.
    LOOP AT TEXTLINES.
       CONCATENATE TEXT TEXTLINES into TEXT SEPARATED BY space.
    ENDLOOP.
    ENDFUNCTION.
    Regards,
    koolspy.

  • How can I call functions from a SWF loaded in to another SWF?

    Hi there,
    Please excuse my ignorance, I am very new to actionscript and flash.
    I have 2 SWF's - a.swf and b.swf.
    I load b.swf into a.swf with the following code:
    var swfLoader:MovieClipLoader = new MovieClipLoader();
    swfLoader.loadClip("b.swf", container_mc);
    Now in b.swf, I have a function as follows:
    public function sendData(){
      trace("I ran the function!");
    So I have done a lot of reading, from what I can tell I should be able to run the sendData() function from the code in a.swf, by typing:
    container_mc.sendData();
    but its not working. What am I doing wrong?
    Thanks in advance,
    Adam

    Thanks heaps mate, after a bit of trial and error it works! Here is the code that I added:
    var loadingListener:Object = new Object();
    swfLoader.addListener(loadingListener);
    loadingListener.onLoadStart = function(container:MovieClip):Void  {
        trace("The MovieClip "+container+" started loading");
    loadingListener.onLoadInit = function(container:MovieClip):Void
        trace("The MovieClip " + container + " has been initialized");
      container_mc.test();
    Marked your answer as correct :-)
    Thanks again, I really appreciate your help.
    Cheers
    Adam

  • How can we call the method of used controller?

    Hi All,
       i created two WDA Applications.( like YWDA1,YWDA2 ) . i am using the component WDA2 in WDA 1.and displaying the one view of WDA2 as popup window in WDA1 on action of one of the input element in the view of WDA1 by using the method l_window_manager->create_window_for_cmp_usage
    I have a button on the view of WDA2 which has appear in the popup window...how can i call the method which has binded to that button....and where should i code that...and i need to assign selected value in the popup window to input elemetn of view  WDA1
    Please help me to resolve this....
    Regards,
    Ravi

    You can not directly call view's event handler from other component.
    create a method in component controller of the second component and in the button click call the component controller method. ( also make the method as interface so that you can call it from other components )
    Now, you can call the interfacecontroller's method
    DATA: l_ref_INTERFACECONTROLLER TYPE REF TO ZIWCI__VSTX_REBATE_REQ_WD .
      l_ref_INTERFACECONTROLLER =   wd_This->wd_CpIfc_<comp usage name>( ).
      l_ref_INTERFACECONTROLLER->Save_Rr(
        STATUS = '01'                       " Zvstxrrstatus
    save_rr is the method of second component controller

  • How can I call a plsql function from an attribute?

    I have an attribute defined in an element. I want execute a PLSQL function from the attribute, and display the returne value with an HTML template.
    I've defined the attribute's type like PLSQL, and I've put the called of the function in the value of the attribute, but it doesn't work. The only value I obtain is an URL (I think that is the URL of the function or someting like this).
    How can I call to my function from the attribute and display the returnes value in the page?
    Thanks.

    Thanks, but it doesn't work. I have an attribute called ID_BOL and I want to associate a sequence to that attribute. I've created a function, with the sequence. This function return de value of the sequence. I want taht the attribute takes the value of the sequenece dinamically.
    I've tried it, creating the type attribute like PLSQL, and calling the function from the attribute, but it doesn't work.
    How can I return the sequence value to my attribute?
    Thanks.

  • How can I call a function from a procedure

    I have a function named: f_calc_value which return the variable v_result. This function is part of a package.
    How can I call this function from a new procedure I am creating?
    Thanks

    or refer this theread....calling function from procedure

  • How can i call a condition type into my ALV report

    I am developing one ALV report in that how can i call a condition type.I am one condition type PB00 for special price.This special price column should be present at the output list.This special price is not there any one of the database tables.So we will create one condition type for this.How can I develop one condition type and how we may call this condition type into my ALV report.

    V/06 is the condition type transaction .You attach a Access sequence to that which is stored in V/07 .
    there you can also get based on key combination tables names .
    which you can used in your report to include in the ALV .
    Contion type PB00 Access sequence PB00
    which will have step say
    Step Table combination 
    1      071       Material plant
    2      142       SO/dc/DV
    here Application would A and table would A table number .
    for eg .A071 .

  • How can i call a business model function?

    Hello!
    I have a simple problem
    A gui view-backing - function call the setUsername by FacesContext und operative Buinding - it works well.
    Now i want to call the the function getUsername from a function inside the class EntityImplEx - both classes are in the business model in different class-pathes.
    How can I call the function getUsername from AppModule?
    package model.app;
    public class AppModuleImpl extends ApplicationModuleImpl implements AppModule {
        public String username                = "init";
        public void setUsername(String ss) {
            username=ss;
        public String getUsername() {
            return(username);
    package model.entity;
    public class EntityImplEx extends EntityImpl {
    ***************************

    You probably don't want to call a function in your UI from your AM.
    Doing this will break the MVC design pattern and will make your AM depends on a specific UI page.
    The way to communicate between the two is through service methods on the AM that are invoked from the UI layer.
    See chapters 8.3-8.5 in the developer guide:
    http://download.oracle.com/docs/html/B25947_01/bcservices003.htm#sm0206

  • How can I call a condition type in my ALV report

    I am having one condition type.Then how can I call a condition type in my ALV report.

    Hi,
    If you have any conditions then filter your data according to that conditions through SQl queries.
    And then display it through ALV.
    Regards
    Mudit

  • How can we make function calls to sap in odi ?

    how can we make function calls to sap in odi ?
    to populate a column i need to make a function call which returns the value.

    There are two ODI SAP adapters available that allows extraction from SAP ERP and SAP BW. For SAP ERP we allow extraction from ERP tables, but not from RFCs/BAPIs.
    You can find details on them at
    http://www.oracle.com/technetwork/middleware/data-integrator/overview/odigs-sapabap-168070.pdf
    http://www.oracle.com/technetwork/middleware/data-integrator/overview/odigs-sapabapbw-168071.pdf

  • How can we call actionscript functions from js

    hi
    how can we call Action script function from js file . i
    tried ExternalInterface. add Callback() .but it throws an error .is
    there any other chance to call action script method .thnx in
    advance

    angadala,
    some people have found it is good to include the full
    qualification path, ie
    if (flash.external.ExternalInterface.available)
    flash.external.ExternalInterface.addCallback("ext_method_name",int_method_name);
    } // if (flash.external.ExternalInterface.available)
    There are also browser differences which affect how you find
    the Flex application object which are documented at
    http://www.adobe.com/livedocs/flex/3/html/help.html?content=passingarguments_5.html
    Richard

Maybe you are looking for