Call ALV custom function externally

Hi,
I am wondering whether it is possible to call a custom function of an ALV from a method because I don't want to repeat coding.
Best regards,
ts

Hi ts,
Option 1:
You can use class CL_SALV_WD_TABLE_FUNCTION to create object R_PARAM.
Sample Code:
          data lo_r_param type ref to cl_salv_wd_table_function.
           data lo_event      type ref to cl_wd_custom_event.
               "Create r_param object
               create object lo_r_param.
               "Create wdevent object & fill event parameters
               create object lo_event
               exporting
                    id = 'ADD' .
               WD_THIS->ON_ADD_LINE(
               exporting
                    wdevent = lo_event
                    r_param = lo_param ).             
Note: here ON_ADD_LINE is the event handler method triggered for alv table function
Option 2
Also, you can make the parameter R_PARAM as optional in event handler method, so that you no need to pass r_param  while calling the event handler method explicitly.
Hope this helps you.
Regards,
Rama

Similar Messages

  • Calling a custom function from XSLT in SOA

    I want to call a custom java method from an XSLT. The java method will calculate the power for the arguments passed and returns the power calculated.
    Thanks
    Cabo

    It can be done by creating custom xpath function:
    Documentation link:
    http://download.oracle.com/docs/cd/E15523_01/integration.1111/e10224/bp_xslt_mpr.htm#BABFCJEB
    section 33.3.4.4 Importing User-Defined Functions

  • Erroring out when trying to call a custom function from the discoverer repo

    Hi everybody, Thanks in advance....
    I have a discoverer report giving the shelf life of an item.
    The shelf life is to be calculated using a function.
    Hence, a custom function is created. I registered the function using Discoverer Administrator Edition.
    Then opened my desktop edition and opened the report.
    Going to Tools > Calculations > New > Functions > Database > selected the function and changed the parameters passed to the function by going to Items selecting the columns from the tables they are available.
    Now, when the query is refreshed, it comes up with an error "Function returns no value".
    When tested from sql session, the function returns value.
    any idea, as to whts the reason???
    -- Kiran

    Hi,
    Have you validated the function in Discoverer administrator?
    Is the function valid?
    Have you manually defined the function details or imported directly from the database?
    pls. let us know.

  • Transformation: Need for calling a custom function module on source system

    Hi Gurus,
    I need to use a custom FM residing on source system within the transformation to determine the type (e.g. posting type) of a document item. The logic is quite complex with many exceptions (many if statements) and 2 customizing & few transparent tables are in use as well in the FM.
    From my point of view, there are few options for achieving the outcome:
    1. Copy the FM logic 1:1 in transformation
    2. Transport the FM from ERP to BW system
    3. Source system delivers the info (e.g. with an extra field "posting_type")
    4. Access the FM directly via RFC/BAPI
    However, there are pros and cons for each of the alternatives:
    *Option 1*
    pros:
    cons: consistency problem, need for importing customizing tables & source tables, high maintenance effort
    *Option 2*
    pros: better consistency compared to Option 1
    cons: need for importing tables, administrative efforts
    *Option 3*
    pros: no logic is needed at BW side, no transformations means no impact on performance, high consistency, no administrative effort
    cons: structure in source system has to be changed, impact on historical records
    *Option 4*
    pros: best consistency (better than Option 3 as FM might change), no administrative effort
    cons: impact on performance during transformation
    Could you please verify my assumptions and give suggestions on solving the problem?
    Thanks a lot!
    Regards,
    Meng

    Hi Joon,
    According to me.
    If Historical data amount is so high, historical data is available in BW(at PSA level or acquisition layer or corporate memory layer) and headache to load history data(because of overload on ECC due to huge amount of data) from ECC then I will suggest combination of 3 and 4 steps.
    If fetching history data from ECC is not headache for you then go for step 3.
    Step 3 is most common approach in BW, which is easy for implementation and support.
    Regards,
    Ashish

  • Issue with calling custom function in merge command -10g

    Hi,
    I have ran into issue while calling a custom function in merge command.
    It throws error 'Invalid identifier'. Oracle doesnt understand that it is a function and take the function name as column name.
    Since no such collumn name exists, it throws 'Invalid identifier'.
    Interestingly, merge command works fine when it has a oracle function (replace, decode).
    The oracle version is 10.2.0.3
    It is very urgent.
    Any pointers will be helpful.
    Regards,
    Ravi

    I don't have privileges to create dblink, but this is working for me.
    So, i don't think function can be a issue here.
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Elapsed: 00:00:01.02
    satyaki>
    satyaki>
    satyaki>create table hist_tab
      2     as
      3       select * from emp
      4       where sal between 2000 and 4000;
    Table created.
    Elapsed: 00:00:00.09
    satyaki>
    satyaki>select * from hist_tab;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO JOB1      DOB
          7844 TURNER     SALESMAN        7698 08-SEP-81       2178          0         30 SALESMAN
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>
    satyaki>update hist_tab
      2     set mgr = 7794;
    1 row updated.
    Elapsed: 00:00:00.01
    satyaki>
    satyaki>commit;
    Commit complete.
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>select * from hist_tab;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO JOB1      DOB
          7844 TURNER     SALESMAN        7794 08-SEP-81       2178          0         30 SALESMAN
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>
    satyaki>
    satyaki>
    satyaki>create table tran_tab
      2     as
      3       select * from emp
      4       where sal between 2000 and 7000;
    Table created.
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>select * from tran_tab;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO JOB1      DOB
          7844 TURNER     SALESMAN        7698 08-SEP-81       2178          0         30 SALESMAN
          7902 FORD       ANALYST         7566 03-DEC-81    5270.76                    20 ANALYST
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>ed
    Wrote file afiedt.buf
      1  create or replace function fun(c_in number)
      2     return number
      3     is
      4       c_out number(4);
      5     begin
      6       if c_in < 7900 then
      7          c_out := 0;
      8       else
      9         c_out := 1;
    10       end if;
    11       return c_out;
    12*    end;
    13  /
    Function created.
    Elapsed: 00:00:01.00
    satyaki>
    satyaki>merge into hist_tab o
      2  using (
      3     select empno,
      4            ename,
      5            job,
      6            mgr,
      7            hiredate,
      8            sal,
      9            comm,
    10            deptno,
    11            job1,
    12            dob
    13     from (
    14              select k.*,
    15                     rank() over(order by fun(k.empno)) rn
    16              from tran_tab k
    17          )
    18     where rn = 1
    19     ) n
    20  on ( o.empno = n.empno)
    21  when matched then
    22    update set o.ename = n.ename,
    23               o.job = n.job,
    24               o.mgr = n.mgr,
    25               o.hiredate = n.hiredate,
    26               o.sal = n.sal,
    27               o.comm = n.comm,
    28               o.deptno = n.deptno,
    29               o.job1 = n.job1,
    30               o.dob = n.dob
    31  when not matched then
    32    insert(
    33            o.empno,
    34            o.ename,
    35            o.job,
    36            o.mgr,
    37            o.hiredate,
    38            o.sal,
    39            o.comm,
    40            o.deptno,
    41            o.job1,
    42            o.dob
    43          )
    44    values(
    45            n.empno,
    46            n.ename,
    47            n.job,
    48            n.mgr,
    49            n.hiredate,
    50            n.sal,
    51            n.comm,
    52            n.deptno,
    53            n.job1,
    54            n.dob
    55          );
    1 row merged.
    Elapsed: 00:00:00.03
    satyaki>
    satyaki>select * from hist_tab;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO JOB1      DOB
          7844 TURNER     SALESMAN        7698 08-SEP-81       2178          0         30 SALESMAN
    Elapsed: 00:00:00.00
    satyaki>You can check the final output with old output. It is working perfectly - i guess.
    Regards.
    Satyaki De.

  • Can we Call Custom function in Background? VERY URGENT

    Hi All,
    Can one one tell me can we call a custom function module in background. Is it possible or not. If yes plz tell how.
    In the custom function module I am updating a data base table using UPDATE statement. Can help me on this issue.
    Thanks
    Yathish

    Hi,
    1)
    Yes..You can call a customer function module in BACKGROUND ...
    Steps
    1 Make the custom FM as remote enabled..
    2 CALL FUNCTION 'ZFUNC' IN BACKGROUNG TASK
    2) Yes..You can write UPDATE statement..
    Thanks,
    Naren

  • Where is the best place to put custom functions?

    Hi,
    I have a composition which has a number of symbols. I have to call some custom methods externally and was wondering where is the best place to put the custom methods?
    I have seen posts that I should put the code in the CompositionReady event of the stage but I would like to put it a bit closer to the symbol.
    Is this the best place?
    Sham.

    Here is a case:
    It's a good idea if you well understand global and local variables.
    About complete event, you are right.

  • Custom function module raises exception CX_SY_NO_HANDLER

    Hi there!
    Does any one here know what this exception is?
    CX_SY_NO_HANDLER
    It is raised when I try to call a custom function module within a rule routine in a transformation.
    I've checked the input and output parameters and they're consistent.
    Thanks in advance for any help!
    Best Regards,
    Luís Andrade.

    Siggi!!
    First of all, let me tell you that I am a great fan of yours! I have learned a great deal from your posts about function modules and extractors.
    The note you referred is not applicable in my case, since we're running sp14.
    One thing I forgot to mention was that this FM is a copy of another FM, with minor modifications. I'm going to try to create a brand-new FM and paste the code in it.
    Best Regards,
    Luís Andrade.

  • Custom function in custom tag

    I'm created a .tag file and attempted to call a custom function. The custom function works fine in a .jsp file, but it doesn't work in the .tld. The jstl functions work in the .tag files.
    I assume my config is ok b/c my functions are working in the .jsp files fine. Any ideas?
    Thanks,
    Mike

    There was an error in my code, it is as follows :
    private void iterateThroughChildElements(Set elements)
         for (Iterator i = elements.iterator(); i.hasNext(); )
              this.parseAndDisplay( (Element) i.next() );
    }

  • LSMW + Custom Function Module

    Hello Friends,
    Is it possible to call a custom function module from LSMW? Please let me know!
    Thanks,
    Sam

    Hi Sam,
    You can have your own custom programs for LSMW if the standard DI/BI IDOC , BAPI dont meet your requirements.
    Its little bit complex. You need to register you custom program in table through SM30.
    SDX0 - Program Definition ( BI or DI )
    SDX1 - Program Assignment
    SDX2 - Declaring Structures
    SDX3 - Declaring field identifiers for structures
    You can goto SM30 and can view the standard BI/DI programs definition by using the four digit Obejct Number...
    <b>AS</b>

  • Custom Function on OO ALV Grid

    I am trying to implement ALV_GRID_XT to enhance the ALV Grid toolbar by adding couple of custom funcitons.As per the SAP documentation I have created 2 methods ON_TOOLBAR - one for adding items on toolbar and the other ON_USER_COMMAND - for processing if the user clicks on the custom function.
    I am unable to relate the ALV Grid instance onto the method ON_USER_COMMAND . One of the funciton is to calculate the average of column which represents percentage excluding cells with zero values. Once the user selects column(s) and clicks on the Percent button on the ALV grid my piece of code should trigger ON_USER_COMMAND and then display the average percentage on the Totals row.
    Method ON_USER_COMMAND has only one parameter E_UCOMM which i am able to get in the method but I am not able to get the instance of the ALV grid so that I can play around with the data in the Grid.
    I could have used a local class and then enhanced the ALV toolbar but this requirement is needed for about 20 reports and hence thought of implementing it globally.
    Any ideas would be appreciated.

    Hi there
    You need to set the handlers of course and register the events
    I'm using also a Z-class  using functionality from the ALV Grid
    in the application program
    data: z_object type ref to zcl_*      "my z_class"
    * Instantiate your Z class
    create object z_object
           exporting
                      z_object = z_object
                      cfname = 'CCONTAINER1'.
    Now in your Constructor for your Z-Class have a variable
    say grid1 which is defined as a type ref to cl_gui_alv_grid.
    Code the methods you require --. The trick is to instantiate your OWN Z class and within  YOUR CLASS  instantiate the GRID1 variable as an instance of cl_gui_alv_grid - then you can use methods etc from that class in your own Z class simple via  something like this
    method CONSTRUCTOR.
    create object grid_container1
            exporting
        container_name = cfname.
        create object  grid1
           exporting
              i_parent = grid_container1.
        set handler z_object->on_user_command for grid1.
        set handler z_object->on_toolbar for grid1.
        set handler z_object->handle_data_changed for grid1.
        set handler z_object->handle_data_changed_finished for grid1.
        set handler z_object->on_dubbelklik for grid1.
        set handler z_object->on_hotspot for grid1.
        call method grid1->register_edit_event
            exporting
               i_event_id = cl_gui_alv_grid=>mc_evt_enter.
      endmethod.
    method display_grid .
    get reference of g_outtab into g_outtab1.
         get reference of g_fldcat into g_fldcat1.
        struct_grid_lset-edit = i_edit.    "To enable editing in ALV
        struct_grid_lset-zebra = i_zebra.
        struct_grid_lset-cwidth_opt = i_opt.
        struct_grid_lset-grid_title = i_gridtitle.
    *    struct_grid_lset-ctab_fname = 'T_CELLCOLORS'.
    *    struct_grid_lset-stylefname = 'CELLTAB'.
         struct_grid_lset-ctab_fname = style_fname.
         struct_grid_lset-stylefname = style_ctab.
    *     export gt_outtab from gt_outtab to memory id 'gt_outtab'.
        call method grid1->set_table_for_first_display
           exporting
                 is_layout       = struct_grid_lset
           changing
                 it_outtab       = gt_outtab
                 it_fieldcatalog = it_fldcat.
      endmethod.
    You need to add the buttons to the toolbar with your ON TOOLBAR method
    for example
    method on_toolbar .
    type-pools icon.
    clear ls_toolbar.
         move  0 to ls_toolbar-butn_type.
         move 'EXCEL' to ls_toolbar-function.
         move  space to ls_toolbar-disabled.
         move  icon_xxl to ls_toolbar-icon.
         move 'Excel' to ls_toolbar-quickinfo.
         move  'EXCEL' to ls_toolbar-text.
         append ls_toolbar to e_object->mt_toolbar.
        perform   toolbar  in program (caller) if found
         using e_object.
    endmethod.
    Now the functionality should work in the ON_USER_COMMAND .
    Here's my ON_USER_COMMAND method within the class
    method ON_USER_COMMAND.
    *        FOR EVENT before_user_command OF cl_gui_alv_grid
    *        IMPORTING
    *          e_ucomm
    *          sender
    * When defined in SE24 you don't need to code the
    * FOR EVENT etc as this is already defined as an event handler
    case e_ucomm.
          when 'EXIT'.
            leave program.
          when 'EXCEL'.
           call method me->download_to_excel.
          when 'SAVE'.
          when 'PROC'.
            call method me->process.
          when 'REFR'.
            call method me->refresh.
            when 'SWITCH'.
            call method me->switch.
           when 'TEST'.
            call method me->get_cell.
           endcase.
    endmethod.
    Add whatever  extra functionality you want to the on_user_command so long as you've defined toolbars..
    Cheers
    jimbo

  • OO ALV - Excluding unwanted custom function buttons

    Hi,
    I'm using CL_GUI_ALV_GRID class in a ALV program.
    I have various screens with the same toolbar, and i need to exclude one customer function, one button that i created, from this toolbar.
    The idea is not showing the same buttons in the various screens.
    How can i do that?
    Best regards,
    Rui

    data: lt_exclude type ui_functions,          " Create internal taable
          ls_exclude type ui_func.
    ******************Hiding Buttons*****************
      ls_exclude = cl_gui_alv_grid=>mc_fc_sum.              " Pass the static method to the table
      append ls_exclude to lt_exclude.
      clear ls_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_mb_filter.
      append ls_exclude to lt_exclude.
      clear ls_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_mb_sum.
      append ls_exclude to lt_exclude.
      call method t_grid->set_table_for_first_display
        exporting
    *    i_buffer_active               =
    *    i_bypassing_buffer            =
    *    i_consistency_check           =
    *      i_structure_name              = 'T_SPFLI'
    *    is_variant                    =
    *    i_save                        =
    *    i_default                     = 'X'
          is_layout                     = w_layo
    *    is_print                      =
    *    it_special_groups             =
          it_toolbar_excluding          = lt_exclude                       "Pass the table to the method
    *    it_hyperlink                  =
    *    it_alv_graphics               =
    *    it_except_qinfo               =
    *    ir_salv_adapter               =
        changing
          it_outtab                     = t_spfli
          it_fieldcatalog               = t_fcat
        it_sort                       = t_sort
    *    it_filter                     =
    *  EXCEPTIONS
    *    invalid_parameter_combination = 1
    *    program_error                 = 2
    *    too_many_lines                = 3
    *    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.
    Or for Custom button:
    Just set Flag according to your screen and use:
    Data: t_ucomm like table of sy-ucomm with header line.   " Use enter the button name you want to exclude.
    SET PF-STATUS 'TEST' Excluding 'Buttonname'/T_ucomm..
    Regards,
    Gurpreet

  • How can I call a custom javascript function when clicking on cfgrid cell.

    I would like to call a custom javascript function when
    clicking on a cell in an cfgrid (of html format). The closest thing
    I can find is to use the HREF="" attribute, but it doesn't seem to
    work with javascript inside it.
    Simple example:
    <cfgridcolumn name="Foo" header="Foo"
    href="javascript:customFunction(#ID#);">
    Do I need to tap into the underlying Ext JS funtionality? If
    so, where can I start?
    Thanks!

    Hi,
    According to your post, my understanding is that you want to hide/show list columns based on specify the permission for Users, SharePoint Groups or Active Directory Groups.
    Here is a solution from CodePlex for your reference:
    SharePoint 2013 Column & View Permission
    https://sp2013columnpermission.codeplex.com/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Unable to debug an exit in CALL CUSTOMER FUNCTION 003

    Hi Guys,
    I have an exit EXIT_SAPMV45A_003 that is called by CALL CUSTOMER FUNCTION 003. I had placed a break point at
    CALL CUSTOMER FUNCTION 003 and the debugger stops here but i am unable to debug inside this to reach into
    the code in EXIT_SAPMV45A_003 even after setting the system debugging on & Update debugging
    ON.
    Can someone help me with this?
    thanks
    Dan

    You have to include that Enhancement of that exit in the Project and Activate that project in the CMOD.
    The Enhancement for the exit EXIT_SAPMV45A_003 is V45A0003.
    Create a project in CMOD
    And inclue V45A0003 in the project.
    Activate the Project.
    Now, it will stop at break point.
    Regards,
    Naimesh Patel

  • Can we call custom functions in view objects?

    Can we call custom functions in view objects?these custom functions are from my backing bean...
    Please help.....

    User,
    You can certainly add code to your view objects to do whatever you like.
    However, it would be considered a very bad practice to call something in the backing bean from your view object. It violates the whole MVC design principle of ADF.
    Perhaps if you can share your real use case, someone will give you ideas about the best way to do it, but I, for one, would advise you to forget about calling a backing bean function from your view object.
    Best,
    John

Maybe you are looking for

  • Photoshop elements 3 wont open

    i downloaded elements 3 from a software bundle i recieved with an intuose 3 drawpad and when i go to open it it says i have missing or invalid personalization information. how can i fix this?

  • Adapter Engine Cache Issue

    Hello All,     In SXMB_MONI i got an error saying SAP:AdditionalText>Error while writing to secure store: ERROR_UNKNOWN: Error when updating buffer for Adapter Engine</SAP:AdditionalText>   <SAP:ApplicationFaultMessage namespace="" />   <SAP:Stack>Er

  • REST Web Service Output Parameter not working in POST Handler

    I've created a RESTful Web Service in Oracle Apex, using a POST method as "handler".   I've setup 11 input parameters which all work fine, it is my one output parameter that does not return successfully. Here is detail on the Output Paramter Name:  r

  • Run Form in Form Builder 9.0.4.0.0

    Hi All: I have installed developer suite with form builder 9.0.4.0.0. Installation was successful but when i run a form from form builder it opens a browser window having address of html file resides in my c:\documentsandsetting \username\localsettin

  • Access data source from plugin

    I have a recorded webtest. I added a csv file as data source in WebAndLoadTestProject. Now I added a PlugIn which containing several class for pre/post request override method. I want to access that added csv file as source of data and want to assign