User Function in Fullscreen ALV
Hi guys,
i'm using a fullscreen ALV (CL_SALV_TABLE) and want to add a user defined function. On halp.sap.com i found a hint that i have to copy the GUI-STATUS SALV_TABLE_STANDARD and add that copy to ALV by using the method SET_SCREEN_STATUS.
Now the new Button appears, but here is my question. Where do i have to put my coding for that function?
Normally i catch function codes within user_command, but how to do that with fullscreen ALV?
Hope someone can help me?
Regards
Mark-André
Hi,
Chek this article [ALV Object Model u2013 Simple 2D Table u2013 Event Handling|https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01&overridelayout=true]. It explains it well.
Regards
Marcin
Similar Messages
-
How to create user defined button in alv report
how to create user defined button in alv report
thnks in advance.Hi,
U can define it the the PF-STATUS ( Menu for ALV ).
For that u have to define it in the EVENTCAT.
form z_eventcat using p_i_eventcat type slis_t_event.
data: i_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = p_i_eventcat
exceptions
list_type_wrong = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
clear i_event.
read table p_i_eventcat with key name = slis_ev_top_of_page into
i_event.
if sy-subrc = 0.
move 'TOP_OF_PAGE' to i_event-form.
append i_event to p_i_eventcat.
endif.
read table p_i_eventcat with key name = slis_ev_pf_status_set into i_event.
if sy-subrc = 0.
move 'SET_PF_STATUS' to i_event-form.
append i_event to p_i_eventcat.
endif.
clear i_event.
read table p_i_eventcat into i_event with key name = slis_ev_user_command .
if sy-subrc = 0.
move 'USER_COMMAND' to i_event-form.
append i_event to p_i_eventcat.
endif.
And in the DISPLAY
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = v_progname
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
i_grid_title = v_gridtitle
i_save = 'A'
is_layout = i_layout
it_fieldcat = i_fieldcat[]
it_sort = i_sortinfo
it_events = i_eventcat
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = it_final
exceptions
program_error = 1
others = 2
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
*MENU SETTINGS.
form set_pf_status using rt_extab type slis_t_extab.
set pf-status 'ALV_MENU'.
endform. "SET_PF_STATUS
endform. " Z_EVENTCAT
Now double click on ALV MENU nad u can create a button in the application bar.
Regards,
Pritha. -
What is the difference b/w ALV Function Module and ALV Methods?
Hello Friends,
Can anybody help me in finding out the difference between ALV Function Modules and ALV methods?
Thanks & Regards
Sathish KumarHi Sathish,
Plz go through this info. It is very useful.
hi,
chk these excellent links.
http://www.geocities.com/mpioud/Abap_programs.html
http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
Simple ALV report
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
Go thru these programs they may help u to try on some hands on
ALV Demo program
BCALV_DEMO_HTML
BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
BCALV_GRID_DEMO Simple ALV Control Call Demo Program
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO
BC_ALV_DEMO_HTML_D0100
OOPs:
Check this for basic concepts of OOPS
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
Tabstrip
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf
Editable ALV
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc
Tree
http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
General Tutorial for OOPS
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
Rewords some points if it is helpful.
Rgds,
P.Naganjana Reddy -
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 -
hi all,
i have to make a function key(Re-process) in ALV grid output and if user selects any ALV row and click on that function key then it will reprocess the selected data. so can any one please tell how would i make Function key in ALV output and also how to trap the selected row data of ALV?
regards.For this you will have to write the a Call back routine you will have to add a custom button in allv
and when your added button is pressed then this routine will be triggred you will have to write a operation for the function code inteh call back routine
you Get the CALL BACK ROUTING NAME PARAMETER in the REUSE_ALV_GRID_DISPLAY
in this routine you will ge the current selected row also.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
i_callback_program = sy-cprog
i_callback_html_top_of_page = 'TOP_OF_PAGE'
* i_callback_top_of_page = 'TOP_OF_PAGE'
* I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USER_COMMAND'
* I_GRID_TITLE = 'VIRAJ PROFILES LTD.'
* I_STRUCTURE_NAME =
is_layout = layout
it_fieldcat = fieldcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
it_sort = i_sort
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IR_SALV_LIST_ADAPTER =
* IT_EXCEPT_QINFO =
* I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = <table>
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when '&IC1'.
loop at it_ekko into wa_it_ekko.
if rs_selfield-fieldname cs wa_it_ekko-ebeln.
set parameter id 'ANF' field wa_it_ekko-ebeln.
call transaction 'ME47' and skip first screen.
endif.
endloop.
when '%_GC 117 3'.
data : msg type string.
concatenate 'Click' 'on' rs_selfield-fieldname into msg separated by space.
message msg type 'I'.
when others.
endcase.
endform. "USER_COMMAND
Above is sample code ...just debug it you will get it all
Edited by: Anup Deshmukh on Feb 2, 2010 4:43 AM -
User Function Name wrong resultset in Oracle Apps Query
Hi,
I am using the below query to extarct the user function names alonng with responsilibity .But doing so i am getting a User Function Name for eg 'Cross Validation Rules' under Order Management User.But thats wrong.Cross validation rules should exists in Receivables,GL and Payables.
select distinct frv.menu_id, frv.responsibility_id, frv.responsibility_name, fff.function_name, ffft.user_function_name
from
fnd_responsibility_vl frv,
fnd_responsibility frp,
fnd_form_functions fff,
fnd_form_functions_tl ffft,
fnd_resp_functions resp,
fnd_menu_entries mnu,
fnd_menus fmn
where
fff.function_id = ffft.function_id
and mnu.menu_id=frp.menu_id
and mnu.menu_id=fmn.menu_id
and frv.responsibility_id=resp.responsibility_id
and mnu.function_id=ffft.function_id
and resp.rule_type='M'
and frv.menu_id in (select me.menu_id
from fnd_menu_entries me
start with me.function_id = fff.function_id
connect by prior me.menu_id = me.sub_menu_id )
and (frv.responsibility_name like '%Order%')
order by 1
Kindly any help will be helpful for meWhat is your application release?
I am using the below query to extarct the user function names alonng with responsilibity .But doing so i am getting a User Function Name for eg 'Cross Validation Rules' under Order Management User.But thats wrong.Cross validation rules should exists in Receivables,GL and Payables.Please try the queries in these docs.
Script To Extract Submenu And Function Information About A Menu [ID 458701.1]
HOW TO GENERATE MENU TREE FOR A MENU ATTACHED TO A RESPONSIBILITY IN ORACLE APPLICATIONS 11i ? [ID 312014.1]
Thanks,
Hussein -
Control User Specific button in ALV report
Hi,
Can anybody please suggest me how to control "USER SPECIFIC" button in ALV report layout using authorization object. I mean if you can tell me which authorization object is responsible to control the "USER SPECIFIC" button.additional info to what Lakshmi already said:-
normally the restrictions for saving layouts/display variants are done at 2 levels:
1) The developer of an ALV list first predetermines the authorization in the 'i_save' parameter within the code.
I_SAVE = ' ' -
layouts cannot be saved
I_SAVE = 'A' -
user-specific and cross-user layouts can be saved
I_SAVE = 'X' --- cross-user layouts can be saved
I_SAVE = 'U' --- user-specific layouts can be saved
2) The second level comes to us restriciting the S_ALV_LAYO which gives access to users to save global layouts if I_SAVE for that particular transaction is A or X.
for example, a report has I_SAVE= 'A', which means
it will allow to save User-specific layouts without any restrictions.
and if user has S_ALV_LAYO then he can save both User-Specific and Global Layouts(variants).
it would be better to keep this object separate. -
Problem while using a user function
Hi,
I just want to learn how a user function in ODI works.
I have created a user function(for Oracle technology).
In Definition Tab, I gave bfun($(branchc))
In implementation I gave
if ($(branchc) = 'it' || 'cse') then
return('IT')
else
return('Non-IT')
end if
In a mapping rule i am using it as BFUN(STUDENT.BRANCH)
I am getting the following error...
Bad Query: ORA-00904: "BFUN": Invalid Identifier
select BFUN('STUDENT.BRANCH') from EX.STUDENT STUDENT where (1=2).
EX is my source schema.
Please help me in resolving this.Hi,
That is a common error on ODI.
The ODI function, (as ODI variable) is to "substitute words", it means, ODI is a code generator and a function are made to substitute code, not to "execute" that action coded.
For instance: If there are a "case when" instruction that is necessary be typed over and over again, at several places just change the column to be evaluate, you can create a ODI function to substitute this code avoiding type it several times and better, let the same code in just one place.
Is a way to have “Object Orientation” coding (OO) to code generation...
Does it make any sense to you?
Cezar Santos -
Incorrect Results When Using an In-Line View and User Function in 10g
My developers are complaining of incorrect Select statement results when using an in-line view along with a user defined function. Below is the statement:
select test_f(wo1)
from
(SELECT a.WORK_ORDER_NBR, b.work_order_nbr wo1/*, facility_f(A.FACILITY),
A.PLANNER, A.WO_STATUS, mil_date(A.WO_STATUS_DATE)*, A.WORK_ORDER_TYPE,
A.WO_DESCRIPTION
FROM TIDWOWRK A, TIDWOTSK B
WHERE B.WORK_ORDER_NBR(+) = A.WORK_ORDER_NBR))
where wo1 is null;
Test_f() is a user defined function and the above query returns thousands of rows. It should return 308 rows. It is apparent that the target database is not evaluating the "where wo1 is null;" clause.
select to_char(wo1)
from
(SELECT a.WORK_ORDER_NBR, b.work_order_nbr wo1/*, facility_f(A.FACILITY),
A.PLANNER, A.WO_STATUS, mil_date(A.WO_STATUS_DATE)*, A.WORK_ORDER_TYPE,
A.WO_DESCRIPTION
FROM TIDWOWRK A, TIDWOTSK B
WHERE B.WORK_ORDER_NBR(+) = A.WORK_ORDER_NBR))
where wo1 is null;
In the above query return 308 rows. The user function was replaced by an Oracle function. The Where clause is now evaluated correctly.
The query is executed from an Oracle 10g R2 database and retrieves data from a 9.2.0.6 database.
I've seen a little information on Metalink. It appears that there was some trouble in 9i, but were fixed in a 9.2.0.6 patch. I don't see any information about a 10.2.0.2 database.
Anyone have any experiences or a successful solution. I suspect that I will need to report this to Oracle and wait for a patch.
Thanks,
JohnI can only think of two reasons for this behaviour:
1) You are executing these two queries from two different users and there is some policy on the table.
2) The function doesn't do an upper, but returns null a lot of times, even when the input is a not null value, like this:
SQL> create table tidwowrk
2 as
3 select 1 id, 'A' work_order_nbr, 'DST' facility from dual union all
4 select 2, null, 'TRN' from dual union all
5 select 3, 'C', 'DST' from dual
6 /
Tabel is aangemaakt.
SQL> create table tidwotsk
2 as
3 select 'A' work_order_nbr from dual union all
4 select 'B' from dual
5 /
Tabel is aangemaakt.
SQL> create or replace function test_f (a in varchar2) return varchar2
2 is
3 begin
4 return case a when 'A' then null else a end;
5 end;
6 /
Functie is aangemaakt.
SQL> select count(*)
2 from ( SELECT a.WORK_ORDER_NBR
3 , test_f(b.work_order_nbr) wo1
4 FROM TIDWOWRK A
5 , TIDWOTSK B
6 WHERE B.WORK_ORDER_NBR(+) = A.WORK_ORDER_NBR
7 and a.facility in ('DST', 'TRN', 'SUB')
8 )
9 where wo1 is null
10 /
COUNT(*)
3
1 rij is geselecteerd.
SQL> select count(*)
2 from ( SELECT a.WORK_ORDER_NBR
3 , to_char(b.work_order_nbr) wo1
4 FROM TIDWOWRK A, TIDWOTSK B
5 WHERE B.WORK_ORDER_NBR(+) = A.WORK_ORDER_NBR
6 and a.facility in ('DST', 'TRN', 'SUB')
7 )
8 where wo1 is null
9 /
COUNT(*)
2
1 rij is geselecteerd.Regards,
Rob. -
Using the Dollar($) Sign in a User Function Implementation
Hi All,
Just a quick question: how could you use a dollar($) sign in the implementation (Oracle) of a user function? I'm asking because the table name that I'm using in the implementation happens to contain the dollar sign (I$_FACT_SALES) and from the results I'm getting now, ODI reads the $ as reference to a variable, therefore removing the $-sign from my table name upon execution (I_FACT_SALES). Is there something like a backslash or some other character that could be inserted before the $ so it would register as part of the table name?
Any response would be greatly appreciated.
Thanks very much,
MarcoYou may have 3 options:
1.) Try using the tablename in quotes "MY$TABLE" or may be MY$$TABLE using double $ symbol
or
2.) I found this code snippet : odiRef.getInfo( \\u0022DEST_WORK_SCHEMA\\u0022 )+\\u0022.\\u0022,\\u0022\\u0022)?. So on these lines you can use \\u0022 as a symbol for "
You can see similar problem/solution/explanation in
Re: Regular Expression wierdness - problem with $ character
or
3.) Change the Work Tables Prefix in Topology Manager > Physical Schema > Your_Schema
from E$_ , C$_ , I$_ to something like ERR_ , SRC_ , INT_
Edited by: Ace2 on Dec 2, 2009 9:57 AM -
Using PL/SQL code in ODI User Functions
Is it possible to write PL/SQL code (with multiple in params and one out param) in ODI User Function ?
Actually I need to use this user functions in my interface mapping.
I know it can be done using ODI Procedures but Procedures cannot be used within interfaces when mapping columns.Hi Anurag Ambasta,
You can use the ODI user functions and choose the Linked technology as 'Oracle' where you can implement and use oracle syntax .
And the user functions can receive the multiple parameters and it returns the single value to the function cal, which use are expecting right?
Thanks,
Yellanki -
Calling user function from Interface mapping
I am getting error "Bad query:ORA-00904: invalid identifier" while calling function in the mapping of an interface.
Can some one provide the syntax of calling user function from interface mapping.
Thanks,
RPuser452108 wrote:
Can some one provide the syntax of calling user function from interface mapping.Oracle's Call Iinterface, the OCI, does not work differently when coding using a Dvorak keyboard, or writing code using a pretty pink font in the editor.. or coding the call from an interface mapping (whatever the hell that that is).
You have 2 types of calls. SQL and PL/SQL.
To call a function via SQL, it can be done using a the standard cursor interface. E.g.
select MyFunkyFunction from dualIt will return the function value via a single row with a single column. The standard cursor fetch and close cursor calls are used.
To call it via PL/SQL, an anonymous PL/SQL block is needed, and the caller needs to use a bind variable to receive the value from the function. The anon block will look as follows:
begin
:bindVar := MyFunkyFunction;
end;Refer to your client's abstract layer for interfacing with the Oracle Call Interface, on how to deal with bind variables. -
hai all
iwant to know about few function modules in alv
1) reuse_alv_default_varients_get.
2)reuse alv_varients_f4
what is the use of these function modules
how to use these function modules, what r the structures used to use these function module. where to pass this in
in list and grid display function modules.
plz help me.
thanks & regards
sinduHI,
check this.
REPORT Z_TEST_alv_variant .
TYPE-POOLS : SLIS.
PARAMETERS: ONE RADIOBUTTON GROUP G1 DEFAULT 'X',
TWO RADIOBUTTON GROUP G1.
DATA: BEGIN OF I_TAB OCCURS 0,
FIELD1 TYPE I,
FIELD2 TYPE I,
END OF I_TAB.
DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: L_VARIANT TYPE DISVARIANT,
LX_VARIANT LIKE DISVARIANT,
L_SAVE TYPE C,
L_EXIT(1) TYPE C.
SELECTION-SCREEN BEGIN OF BLOCK 0 WITH FRAME TITLE TEXT-VAR.
PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT.
SELECTION-SCREEN END OF BLOCK 0.
INITIALIZATION.
L_SAVE = 'A'.
PERFORM VARIANT_INIT.
Get default variant
LX_VARIANT = L_VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
I_SAVE = L_SAVE
CHANGING
CS_VARIANT = LX_VARIANT
EXCEPTIONS
NOT_FOUND = 2.
IF SY-SUBRC = 0.
P_VARI = LX_VARIANT-VARIANT.
ENDIF.
Process on value request
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
PERFORM F4_FOR_VARIANT.
I_TAB-FIELD1 = 19.
I_TAB-FIELD2 = 20.
APPEND I_TAB.
I_TAB-FIELD1 = 19.
I_TAB-FIELD2 = 20.
APPEND I_TAB.
I_TAB-FIELD1 = 19.
I_TAB-FIELD2 = 20.
APPEND I_TAB.
I_TAB-FIELD1 = 19.
I_TAB-FIELD2 = 20.
APPEND I_TAB.
I_TAB-FIELD1 = 19.
I_TAB-FIELD2 = 20.
APPEND I_TAB.
PERFORM INITIALIZE_FIELDCAT USING GT_FIELDCAT[].
PERFORM CALL_ALV TABLES I_TAB[]
USING GT_FIELDCAT.
*& Form initialize_fieldcat
text
-->P_GT_FIELDCAT[] text
FORM INITIALIZE_FIELDCAT USING L_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
LS_FIELDCAT-FIELDNAME = 'FIELD1'.
LS_FIELDCAT-KEY = 'X'.
LS_FIELDCAT-COL_POS = 1.
LS_FIELDCAT-SELTEXT_S = 'Work center'.
LS_FIELDCAT-SELTEXT_L = 'Work center'.
APPEND LS_FIELDCAT TO L_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'FIELD2'.
LS_FIELDCAT-KEY = ' '.
LS_FIELDCAT-COL_POS = 2.
LS_FIELDCAT-SELTEXT_S = 'Work center2'.
LS_FIELDCAT-SELTEXT_L = 'Work center2'.
APPEND LS_FIELDCAT TO L_FIELDCAT.
CLEAR LS_FIELDCAT.
ENDFORM. " initialize_fieldcat
*& Form call_alv
text
-->P_GT_FIELDCAT text
-->P_I_TAB text
FORM CALL_ALV TABLES P_TAB
USING P_GT_FIELDCAT .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = P_GT_FIELDCAT
I_DEFAULT = 'X'
IS_VARIANT = L_VARIANT
I_SAVE = L_SAVE
TABLES
T_OUTTAB = P_TAB[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " call_alv
*& Form VARIANT_INIT
text
FORM VARIANT_INIT.
CLEAR L_VARIANT.
L_VARIANT-REPORT = SY-REPID.
ENDFORM. " VARIANT_INIT
*& Form variant_SELECTION_SCREEN
text
FORM VARIANT_SELECTION_SCREEN .
IF NOT P_VARI IS INITIAL.
MOVE L_VARIANT TO LX_VARIANT.
MOVE P_VARI TO LX_VARIANT-VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
I_SAVE = L_SAVE
CHANGING
CS_VARIANT = LX_VARIANT.
L_VARIANT = LX_VARIANT.
ELSE.
PERFORM VARIANT_INIT.
ENDIF.
ENDFORM. " variant_SELECTION_SCREEN
*& Form F4_FOR_VARIANT
text
FORM F4_FOR_VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
IS_VARIANT = L_VARIANT
I_SAVE = L_SAVE
IMPORTING
E_EXIT = L_EXIT
ES_VARIANT = LX_VARIANT
EXCEPTIONS
NOT_FOUND = 2.
IF SY-SUBRC = 2.
MESSAGE ID SY-MSGID TYPE 'S' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
IF L_EXIT = SPACE.
P_VARI = LX_VARIANT-VARIANT.
ENDIF.
ENDIF.
ENDFORM. "F4_FOR_VARIANT
Regards,
Laxmi. -
HOW TO USE FUNCTION MODULE IN ALV
hi guyz
I developed an alv report using join statements .But i got all that fields in a function module. so how can i use function module in alv .
if i got a function module with all the fileds do i need to use select statement.
plz help me.
thanks
sudheerHi,
Hope the following helps..
1)
LOOP AT IT_OUTPUT.
Call the function module to get the tracking number and store the output in the
variable V_TRACKINGNO.
IT_OUTPUT-TRACKING_NO = V_TRACKINGNO.
MODIFY IT_OUTPUT TRANSPORTING TRACKING_NO.
ENDLOOP.
2) Date conversion
DATA: V_CHAR(10) VALUE '2006.11.17'.
DATA: V_DATE TYPE SYDATUM.
CONCATENATE V_CHAR(4) V_CHAR5(2) V_CHAR8(2) INTO V_DATE.
WRITE: V_DATE TO V_CHAR MM/DD/YYYY.
WRITE: / 'MM/DD/YYY Format - ', V_CHAR.
Please make sure to reward points for helpful answers..
Thanks,
Naren -
User function code not substituted
Hi
I have a user function (getCode(...)) of the form
case
when exists (select * from ...)
then '!Ok!'
else '!None!'
end
When I use this function in a interface mapping (getCode(a,b,c)), the code is not substituted in the generated query (as seen in the operator):
insert /*+ APPEND */ into ...
Z_CODE,
RUN_NR,
REC_ID
select
getCode( NAME, 'ZIV', 'G' ),
RUN_NR,
REC_ID
from ...
where (1=1)
and the execution results in an ORA-00904 exception: Invalid column name.
How come?
ThanksFirst of all, thanks for your answers!
The problem was lying in the definition of the function's syntax:
I'm using the possibility to specify the data_type of the arguments: getCode($(run_nr)n, $(tabi)s, $(code)s).
Unfortunately, I put a space between the arg_name and the data_type! This causes the function not to be substituted into the query ...
Once again thanks to all.
Cheers, Benno
Maybe you are looking for
-
Newly bought imac 27 desktop not responding, cursor moves only.
My setup did not go well as I was stuck in VoiceOver mode. Command f5 got me out of it but cannot do anything on the desktop, track pad moves cursor but by taping on it the icons do not respond. I am new to apple products, used to windows 7 pc. Can a
-
How do you change the owner name of an IPOD mini?
-
Seq File Post Step Runtime Error and Failure
Hi, I am using SequenceFilePostStepRuntimeError & SequenceFilePostStepFailure in my seq file to handle both. the issue at hand is that, once there is error the execution runs to runtime-error (SequenceFilePostStepRuntimeError) thats fine
-
Ok to move LR 2 presets and settings from old Mac PowerPC into my Mac Pro and LR4?
I had a Mac PowerPC but recently purchased a Mac Pro. While I was at it I got Lightroom 4. Now I want to migrate the Settings and Plugins folders from my LR 2, which is on the Mac PowerPC, to my LR 4, which is on the Mac Pro. Is that going to caus
-
Itunes 5.0 won't update my ipod
Have been suffering through vers 5 like most of us. It has installed ok and looks ok but will not update my ipod. It recognises it is plugged in and it tells me it is doing it but nothing happens. I have installed the latest quicktime and ipod update