Functions in iView parameters
Hi
For a transaction iView,
i can pass lastname as parameter to iview using the syntax lastname=<User.lastname>
similarly,
my portal users loginid consists of 10 characters.
i want to pass the last 8 characters of loginif as parameter to iview.
is it possible ?
Also i want to pass Current Year - 1 as a parameter to the iview.
e.f if current year is 2010 it will pass 2009 to the iview.
in short,can we use functions in parameters ?
Regards
Rajendra
Hi,
I would also recommend you talke at look at Customer Exits for u2018Parameter Provideru2019 this is a way to provide dynmaic values when calling a transaction.
Take a look at this post: Making Customer Exits Work in the Portal
BRgds,
Simon
Similar Messages
-
Question about function with in parameters
Hello,
I have a question about functions with in-parameters. In the HR schema, I need to get the minimum salary of the job_id that is mentioned as an in-parameter.
this is what I am thinking but I dont know if it's correct or not or what should I do next!
create or replace function get_minimum_salary (i_job_id in varchar2)
return number
as
begin
SELECT min_salary INTO min_sal
FROM jobs
where job_id = get_minimum_salary(xy);
RETURN i_job_id;
end get_minimum_salary;
thanks in advance
EDIT
Thanks for your help all.
Is it possible to add that if the i_job_id which is the in type parameter does not have a minimum salary then use the following function to register an error:
create or replace procedure insert_error (i_error_code in number,
i_error_message in varchar2)
as
begin
insert into error_table (error_user, error_date, error_code, error_message)
values (user,sysdate,i_error_code,i_error_message);
end insert_error;
This function is basically to say that an error has occured and to register that error, at the same time I need to print out the error using the dbms_out.put_line.
Any ideas of how to do that?
Thanks again
Edited by: Latvian83 on Jun 1, 2011 5:14 AMHI
I have made little bit changes in ur code. try this
create or replace function get_minimum_salary (i_job_id in varchar2)
return number
as
v_Min_sal jobs.salary%type=0;---- Variable declaration
begin
SELECT min_salary INTO v_ min_sal
FROM jobs
where job_id = i_job_id;
RETURN v_Min_sal;
end get_minimum_salary;
Regards
Srikkanth.M -
Function with incomplete parameters
I create a function with many parameters
and I call this function through my application
but when I call function I must declare all parameter inside this function like
ddd("a","b",0,0,0,0,0,0,0)
is there a method let function set a default value for parameter if code didn't declare itYou can send just few first parameters and the rest will be passed as false. If you need to pass, say, first and 7th parameter, then you put 6 commas between values, as there is no named parameters in VFP and all parameters are passed by position.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
How to use URL iview parameters??
Hi all,
i have created a URL iview to www.gmail.com, now my requirement is i dont want to give user id and password and it should logged me in directly so for that i need to make use of URL iview parameters, but i am not aware of how to use it, can anybody help me to resolve this issue??
Thanks in advance,
Regards,
Ameya.Hi Ameya,
Basically, you need to create a HTTP system, then create a URL Iview giving this http system as a reference in it.
Check this <a href="https://www.sdn.sap.com/irj/sdn/thread?threadID=389042">thread</a> for details.
You can also refer to
<a href="http://help.sap.com/saphelp_nw70/helpdata/en/f5/eb51730e6a11d7b84900047582c9f7/frameset.htm">SAP Help Library</a>
cheers~
avadh -
Function call statement parameters
I have called some functions within a select query and the parameters are mentioned in the function call.
month, department_code,office,finincial_year
are the input parameters
these are fetched from the selected columns and are passed as parameters to the functions.
all this is in the same select query.
what names are to be written for this parameter list in the function call?
do i need to use the alias names of the selected columns or...?
the actual function has the parameters same as the variables mentioned in the query inside the function body.
Please let me know what to do
ASAP
ThanksActually, I have already tested using the first appraoch, but the result was not what i have expected.
My requirement is as follows:
this financial_year has to be passed as 2008-2009 format and this is the same format present in the view fro,m which it is being selected
I am not sure this is being passed correctly to the functions because when i tested the query inside the function to get the desired result using 2008-2009 format it has given me result as expected. but the same thing when tested using just 2008 gives just zero as the result.
hence i got to know that this value is not being passed correctly.
for each month, for a single office, and a single dept the count of policies has to be calculated.
what needs to be done.
2) this value has to be calculated per month and upto the month
per month is for the self same month
upto the month starts from the financial year to the cuent months that is passed to the function (APRIL to AUGUST, APRIL to SEPTEMBER ...so on)
ex: for the month count is 1 for august 3 for septmeber
upto the month values ought to be as 1 upto august, 4 upto septmeber
so i have added the statemetn as month betweem 'APRIL' and p_month in the function query.
but to my disappointment both 'for' and 'upto' values are coming as same.
any logic for this please -
Function Module TABLES parameters
Hi All,
I want to pass my internal table to a function module but when I try to access the componenbts of the table it is giving me syntax error. Is it required that I should create DDIC structure for this? Is there any other option?
I have declared the internal table using types. And in function module tables parameters just declared internal table.
Regards,
DilipHi
In the function
Say import parameter is TAB ( with no type definition )
From program you pass an internal table ITAB .
You don't need to define TAB in your function.
In the code you can diretcly use
LOOP AT TAB.
ENDLOOP.
( At runtime TAB will take the structure of ITAB from program )
Cheers -
Can a function take OUT parameters...?
Hi all.
Can a function take OUT parameters...?
Thanks in advance,
PalYou can do it in PL/SQL but not in SQL. The following example demonstarte that -
satyaki>
satyaki>create or replace package S_glob
2 as
3 b varchar2(20);
4 end;
5 /
Package created.
satyaki>
satyaki>
satyaki>create or replace function S_test_mul_out(a in number,c out varchar2)
2 return number
3 is
4 cursor c1(eno in number)
5 is
6 select ename,job,sal
7 from emp
8 where empno = eno;
9
10 rec c1%rowtype;
11 d number(10);
12 begin
13 open c1(a);
14 loop
15 fetch c1 into rec;
16 exit when c1%notfound;
17 glob.b:= rec.ename;
18 c:= rec.job;
19 d:= rec.sal;
20 end loop;
21 close c1;
22 return d;
23 end;
24 /
Function created.
satyaki>
satyaki>
satyaki>set serveroutput on
satyaki>
satyaki>
satyaki>declare
2 yy varchar2(30);
3 zz number(10);
4 begin
5 ZZ:= s_test_mul_out(7566,yy);
6
7 dbms_output.put_line('Ename: '||glob.b);
8 dbms_output.put_line('Job: '||yy);
9 dbms_output.put_line('Sal: '||zz);
10 end;
11 /
Ename: JONES
Job: MANAGER
Sal: 1000
PL/SQL procedure successfully completed.
satyaki>Regards.
Satyaki De.
Message was edited by:
Satyaki_De -
Hello,
I have an issue with setting iView Parameters. I do the following:
response.write("Converting...<br/>");
iiv.putAttribute("ApplicationParameter","queryid="+request.getParameter("queryid"));
try
iiv.save();
iiv.notifyAll();
}catch (ValidationException ve)
response.write(ve.toString());
catch (IOException ie)
response.write(ie.toString());
However, when I see the iView properties in the portal the value is not changed. When reading the value programatically, it is changed. Are there two of them or do I have a caching issue here?
I already tried clearing browser cache and so forth, but problem remains.
My code is supposed to change iView-ApplicationParameters..Hi,
I found all information I needed in help.sap.com.
So I wrote a little portal component to update a custom iview parameter and it is working fine for me.
Here's my code:
Sharing References:
<property name="SharingReference" value="com.sap.portal.ivs.api_iview,com.sap.portal.pcd.glservice,com.sap.portal.pcm.admin.apiservice"/>
Custom Parameter in portalapp.xml
<component-profile>
<property name="AuthScheme" value="anonymous"/>
<property name="MTAGCustom" value="Test"/>
</component-profile>
and my Java Code to update(change the value:
Imports:
import java.io.IOException;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import com.inqmy.lib.xml.parser.dtd.ValidationException;
import com.sap.portal.directory.Constants;
import com.sap.portal.pcm.admin.PcmConstants;
import com.sap.portal.pcm.iview.IiView;
import com.sapportals.portal.pcd.gl.IPcdContext;
Code Snippet:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
env.put(Context.SECURITY_PRINCIPAL, request.getUser());
env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
InitialContext iCtx = null;
try
String iViewID = "pcd:portal_content/com.mtag.test/com.mtag.testcomponent";
iCtx = new InitialContext(env);
IiView myIView =(IiView)iCtx.lookup(iViewID);
myIView.putAttribute("MTAGCustom","newValue");
myIView.save();
myIView.notifyAll();
} catch(Exception Ex) {
Ex.printStackTrace();
I deployed the component and create an IView from PAR. I started the iView in Preview Mode and the Custom Parameter "MTAGCustom" now has the new Value "newValue"
Let me know if it helps (Reward Points are appreciated if helpful
Cheers -
Open Doc Function to pass parameters from Xcelsius to WEBI
Hi All,
I need to have a drill through functionality from xcelsius report to WebI report I am using the following open doc URL
http://BO ServerName/OpenDocument/opendoc/openDocument.jsp?
sType=wid&sRefresh=Y&sIDType=CUID&iDocID="Doc ID"&mode=full&lsSRegion=""&lsSDay=""&lsSPlant=""&lsSProduct%20Name=""
When I run the flash in Internet Explorer then the drill through webi report opens without any error for the 1st time
but when I try to reopen the report again with new set of parameters , the browser gets hanged
Also when I run the flash in Firefox , I get error while opening the Webi Report for the 1st time but when I try to open the report again it works fine.
Please let me know if anyone has faced similar issue before.
I am Using Xcelsius 2008 SP3 and BO XI 3.1
Thanks,
ShwetaHi Shweta
If you place the URL un the browser directly does the report open and refresh ok? Can you try altering the parameters of the URL, also directly in the browser?
Something else to check would be if the prompts in the WebI report can be optional, store the last value etc, and I wouldn't recommend having a prompt which has a space in the name such as you have (Product%20Name). Keep the prompts as simple as possible, and make sure that the 'equal to' and 'in list' operators are properly reflected in the URL.
Regards
Charles -
Passing parameters to table valued functions and using parameters as column name on select
I am creating a function where I want to pass it parameters and then use those parameters in a select statement. When I do that it selects the variable name as a literal not a column. How do I switch that context.
Query:
ALTER FUNCTION [dbo].[ufn_Banner_Orion_Employee_Comparison_parser_v2]
@BANNER_COLUMN AS VARCHAR(MAX),
@ORION_COLUMN AS VARCHAR(MAX)
RETURNS @Banner_Orion_Employee_Comparison TABLE
LAST_NAME nvarchar(max),
EMPNO int,
BannerColumnName nvarchar(max),
BANNER nvarchar(max),
ORION nvarchar(max)
AS
BEGIN
INSERT INTO @Banner_Orion_Employee_Comparison
(LAST_NAME, BANNER, ORION)
SELECT
a.LAST_NAME, @BANNER_COLUMN, @ORION_COLUMN
FROM OPENQUERY(ORCLPROD_APDORACLE, 'select LAST_NAME, BANNER_RANK, BADGE, EMP_STATUS from XTRACT_VIEW') AS a
inner join IWM_Stage.dbo.ViewPersonnel AS b
on a.BADGE = b.badge
WHERE a.EMP_STATUS = 'A'
and a.BANNER_RANK <> b.[rank]
RETURN;
END;
GO
Output
I execute this:
select * from ufn_Banner_Orion_Employee_Comparison_parser_v2 ('a.BANNER_RANK' , 'b.[rank]')
and get:
Cerecerez NULL
NULL a.BANNER_RANK
b.[rank]
George,
You could go for using a CASE statement as earlier mentioned by Erland. This would look like below: (Downside is that you need to be mentioning all possible values in the CASE)
ALTER FUNCTION [dbo].[ufn_Banner_Orion_Employee_Comparison_parser_v2]
@BANNER_COLUMN AS VARCHAR(MAX),
@ORION_COLUMN AS VARCHAR(MAX)
RETURNS @Banner_Orion_Employee_Comparison TABLE
LAST_NAME nvarchar(max),
EMPNO int,
BannerColumnName nvarchar(max),
BANNER nvarchar(max),
ORION nvarchar(max)
AS
BEGIN
INSERT INTO @Banner_Orion_Employee_Comparison(LAST_NAME, BANNER, ORION)
SELECT
a.LAST_NAME
, CASE @BANNER_COLUMN WHEN 'a.BANNER_RANK' THEN a.BANNER_RANK WHEN 'a.BADGE' THEN a.BADGE END --put values as required
, CASE @ORION_COLUMN WHEN 'b.[rank]' THEN b.[rank] END --put values as required
FROM OPENQUERY(ORCLPROD_APDORACLE, 'select LAST_NAME, BANNER_RANK, BADGE, EMP_STATUS from XTRACT_VIEW') AS a
inner join IWM_Stage.dbo.ViewPersonnel AS b
on a.BADGE = b.badge
WHERE a.EMP_STATUS = 'A'
and a.BANNER_RANK <> b.[rank]
RETURN;
END;
GO
Another method that I would suggest is to get all values from the function, then build a dynamic query to obtain results from it .. Something like:
ALTER FUNCTION [dbo].[ufn_Banner_Orion_Employee_Comparison_parser_v2]()
RETURNS @Banner_Orion_Employee_Comparison TABLE
LAST_NAME nvarchar(max),
EMPNO int,
BannerColumnName nvarchar(max),
BANNER nvarchar(max),
ORION nvarchar(max)
AS
BEGIN
INSERT INTO @Banner_Orion_Employee_Comparison(LAST_NAME, BANNER, ORION)
SELECT
* --Returns all the columns
FROM OPENQUERY(ORCLPROD_APDORACLE, 'select LAST_NAME, BANNER_RANK, BADGE, EMP_STATUS from XTRACT_VIEW') AS a
inner join IWM_Stage.dbo.ViewPersonnel AS b
on a.BADGE = b.badge
WHERE a.EMP_STATUS = 'A'
and a.BANNER_RANK <> b.[rank]
RETURN;
END;
GO
--Execution
DECLARE @BANNER_COLUMN AS VARCHAR(MAX), @ORION_COLUMN AS VARCHAR(MAX),@SQL NVARCHAR(MAX)
SET @BANNER_COLUMN='BANNER_RANK'
SET @ORION_COLUMN='[rank]'
SET @SQL='
select LAST_NAME,'+@BANNER_COLUMN+','+@ORION_COLUMN+' from ufn_Banner_Orion_Employee_Comparison_parser_v2 ()'
PRINT @SQL
EXEC @SQL
You just need to make sure that the column names returned by the function are UNIQUE (Using proper alias names) so that you don't have a problem referring to them from the outside..
Thanks,
Jay
<If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'> -
Question about URL iView parameters
Hi experts.
I have this issue: I have several iviews in DEV instance, URL iViews that points to backend applicationes. The URL parameters in DEV instance, point to DEV instance of backend applications. But when a will need to transport these iview to PROD instance, the URL parameters then I need to point to PROD instance of this backends apps.
Which is the best practices to resolve this issue ?
<b>Example:
in DEV instance:
URL iView "A" point to http://dev.app.com.
in PROD instance
URL iVIew "A" point to http://prod.app.com</b>
But i try to avoid change this parameters after transport to Production , in Production instance directly.
I think for example, use a some type of configuration file o .ini, in order to iviews "take" the URL string from it; and do not harcdode this strings.
Is possible? How?
I am clear?
thanks in advance!thanks Atul, Wayne,
I could be use "http system" but..
Suposse this case:
In DEV instance, I have:
- URL iview "A" point to backend system "http://dev.zzz.com"
- URL iview "B" point to backend system "http://dev.xxx.com"
- URL iview "C" point to backend system "http://dev.yyy.com"
In PROD instance, I have:
- URL iview "A" point to backend system "http://prod.rrr.com"
- URL iview "B" point to backend system "http://dev.ddd.com/aspx"
- URL iview "C" point to backend system "http://dev.mmm.com/app3"
All different!. No pattern. If I use a Http system,I think that I am continue with the same problem: in the transport to PROD, I should be change all references, or all http systems.
For this reason, I am begin asking for use a some type of configuration file, but I dont know how.
thanks in advance.. -
Calling a function and passing parameters via Variables
I've got an XML file that is loading in data and is calling functions.
I've figured out how to call the methods from classes with variables set from the XML file:
var functionToCall:String = xml.functions.func[0].to_fire.toString();
myClass[functionToCall]();
This calls the function perfectly.
I was wondering if there is anyway to pass parameters into the function as well through variables. Some functions may have no parameters, some functions could have 5... so the xml could be like this:
<functions>
<func>
<to_fire>function1</to_fire>
<param>
<value>true</value>
<type>Boolean</type> <!-- Must be set to Boolean, String or Number -->
</param>
</func>
<func>
<to_fire>function2</to_fire>
<param/>
</func>
<func>
<to_fire>function3</to_fire>
<param>
<value>false</value>
<type>Boolean</type> <!-- Must be set to Boolean, String or Number -->
</param>
<param>
<value>My String Value</value>
<type>String</type> <!-- Must be set to Boolean, String or Number -->
</param>
<param>
<value>10</value>
<type>Number</type> <!-- Must be set to Boolean, String or Number -->
</param>
</func>
</functions>
whats the best way to set something like this up?how would I set something like that up?
in the class:
public function myFunction(_param1:String, _param2:Number):void {
then to call it, would ParamTypes be cast as an array or object or something?
var functionVariable:String = "myFunction";
myClass[functionVariable](??);
Or do I structure the XML file in some way to pass in the information? -
TABLE function to simulate parameterized view
Hi all,
Since view can not have parameters, I tried to used stored procedure to return ref cursor then used TABLE function in select statement to simulate a view with parameters, since it's easy to pass parameters to a stored procedure.
The idea is like this
function foo (p1 int, p2 int)
return sys_ref_cursor
c sys_ref_cursor -- sorry, i forgot the buildin ref cursor name, just used
this as pseudo code
is
open c for select * from table_a where col1=:p1 and col2=p2 using p1, p2;
return c;
end;
select * from table(foo(1,2)) does not work, I know that I can iterate throught
the cursor and pipe it out to a SQL type in function foo, then use TABLE
function in SELECT statement. However, it seems so much coding work. Is it the
only way or do you have better idea?
Thanks in advance.It is just not correct that you cannot parameterize views.
Nicolas gave you a link above which has an example using a context.
Even before Oracle supported contexts you could have parameterize views using package variables.
SQL> create or replace package pkg_vars as
2 function get_job return emp.job%type;
3 procedure set_job (p_job in emp.job%type)
4 end pkg_vars;
5 /
Package created.
SQL>
SQL> create or replace package body pkg_vars as
2 g_job emp.job%type;
3
4 function get_job return emp.job%type)
5 is
6 begin
7 return g_job;
8 end get_job;
9
10 procedure set_job (p_job in emp.job%type
11 is
12 begin
13 g_job := p_job;
14 end set_job;
15 end pkg_vars;
16 /
Package body created.
SQL>
SQL> create or replace view view_emp1 as
2 select deptno, count(empno) cnt
3 from emp
4 where job = pkg_vars.get_job
5 group by deptno
6 ;
View created.
SQL> select distinct job from emp;
JOB
CLERK
SALESMAN
PRESIDENT
MANAGER
ANALYST
5 rows selected.
SQL> exec pkg_vars.set_job('CLERK');
PL/SQL procedure successfully completed.
SQL> select * from view_emp1;
DEPTNO CNT
30 1
20 2
10 1
SQL> exec pkg_vars.set_job('MANAGER');
PL/SQL procedure successfully completed.
SQL> select * from view_emp1;
DEPTNO CNT
30 1
20 1
10 1
SQL> -
Hi all.
I want to create a RFC iView passing a few parameters, but I cannot input a fixed value; I want to call it using SY-DATUM, SY-UNAME and things like that...
Is it possible?? How??
Thanks in advance.Hello Carlos,
M not sure weather m rt or not but as far as ur RFC for R/3 is concerned you can create either SAP transaction Iview or SAP WebDynPro Iview Aftre creating system that connects ur Portal with R/3 Backend.
Regards.
Soni Vinit -
Function Bulder / Importing parameters
do i need to call 3 times my function builder if i ve 3 import parameters s it.....function builder ll be validatin all the 3 import parameters dependin upon which s importd
Hi...
You are having 3 import parameters in your Function module. Then you can pass the 3 import parameters in a Single CALL FUNCTION 'your function module'.
No need to call it 3 times.
If you have still doubt explain your scenario clearly.. so that we can guide you...
Maybe you are looking for
-
Hi, We use File <-> XI -> IDoc scenario. XI picks the Text file from the fileserver & we have BPM to do the intial validations. If the validation fails, then the file is again sent back to the fileserver by attaching a trailer record to the file. If
-
Syntax for Illustrator update silent install
I have 13.0.1 and 13.0.2 updates and tried /? /help /s /qn /r /f1 ... and none of them work to kick a silent install or generate a install script. Can someone tell me how to allow for silent install of these updates? We would like to deploy these via
-
How to include all subsequent debit/credit?
Hi Guru: Which table/transaction to include all sebsequent debit/credit memo in specific fiscal year?
-
Hi folks! Hi, this is upgrade from 4.6 B to ECC5.0. Problem: There is a flat file in unix directory. that has to be uploaded to the inbound system(my system).But the error is occured due to the port configuration. Actually the port details are given
-
what changes have been made from bo xi to bo xi r2?