How to export values to a user defined function
Hi Experts,
I want to create a function module under FUNCTION EXIT_SAPMIWO0_020.How to access these values into the called function?
I tried it using IMPORT parameters of the called function.But while debugging I am not getting these values.
Can any1 suggest a solution for this problem?
Regards,
Sam.
> Earlier I was using RFC enabled function module for sending the mail under FUNCTION EXIT_SAPMIWO0_020
You were using aRFC (starting new task: it starts immediately and asynchronously), not tRFC (transactional RFC: it starts only at the end of COMMIT WORK).
> and the mail was getting delivered instantly.
It was only because you were using RSCONN01 (preceded by commit of course), not because of the aRFC.
> Here also I am using COMMIT WORK before
> SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
Well that's very strange it doesn't send the mail immediately! (see my answer below)
Note that it is dangerous (for many reasons I don't need to explain here) to run COMMIT WORK, SUBMIT, and a few other statements, in a BAdI, especially when it's at save time. Prefer to use tRFC as I said (and not the aRFC).
> Also the sent item of the mail in outlook is 50 minutes ahead of our system time
> Is it the reason for a delay in mail delivery?
As you call RSCONN01, the delay can only come from something external to SAP. Check the logs in SCOT, to make sure SAP has sent the mail immediately. In the mail you receive, look at the MIME information in the header of the mail, to check the times at which the mail is transferred from a server to another. Ask your administrator to help you.
Similar Messages
-
How to migrate sql server 2000 user defined function returns table
Hi,
How do I capture the SQL Server 200 user defined function that returns table? Is this supported in the current version of Oracle Migration Workbench? I am using the latest version - Release 9.2.0.1.0 with SQL SERVER 2000 plug-in.
I was able to capture the SQL Server 2000 user defined function that returns string and smalldatetime but not the functions return table during the migrate data source stage.
Thanks in Advance,
SusanSusan,
This is not currently supported. The next release of the Oracle Migration Workbench (due very soon), will do a better job of catching this mad reporting an error. We are looking into a suitable mapping and have created bug # 2355073 - TABLE DEFINITIONS NOT ACCEPTED FOR TABLE FUNCTIONS to track this issue.
Once possible solution we are looking into is using the object type to emulate. Here is an example from the bug:
Original table
SQL> create table tabela (a number, b number, c number, d number);
SQL> insert some values...
SQL> select * from tabela;
A B C D
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
SQL Server 2000 code
CREATE FUNCTION FUNCRETORNATABELA()
RETURNS TABLE
AS
RETURN SELECT A,B,C,D FROM TABELA
SELECT A,B,C,D
FROM FUNCRETORNATABELA()
ORDER BY A
Oracle code (workaround)
SQL> create or replace type MyObjType as object (
2 a number, b number, c number, d number);
3 /
Type created.
SQL> create or replace type MyTabType as table of MyObjType;
2 /
Type created.
SQL> create or replace function teste return Mytabtype pipelined as
2 aa MyObjType := MyObjType(null, null, null, null);
3 cursor c1 is select a,b,c,d from tabela;
4 begin
5 open c1;
6 loop
7 fetch c1 into aa.a, aa.b, aa.c, aa.d;
8 exit when c1%NOTFOUND;
9 pipe row (aa);
10 end loop;
11 close c1;
12 return;
13 end;
14 /
Function created.
SQL> select * from table(teste);
A B C D
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
SQL> select a, c from table(teste) order by c desc;
A C
4 4
3 3
2 2
1 1
Donal -
How to Use Sequence Object Inside User-defined Function In SQL Server
I'm trying to call sequence object inside SQL Server user-defined function. I used
Next Value for dbo.mySequence to call the next value for my sequence created. But I'm getting an error like below.
"NEXT VALUE FOR function is not allowed in check constraints, default objects, computed columns, views, user-defined functions, user-defined aggregates, user-defined table types, sub-queries, common table expressions, or derived tables."
Is there any standard way to call sequence inside a function?
I would really appreciate your response.
Thanks!The NEXT
VALUE FOR function cannot be used for User Defined function. It's one of the limitation.
https://msdn.microsoft.com/en-us/library/ff878370.aspx
What are you trying to do? Can you give us an example and required output?
--Prashanth -
How to apply dll file or user defined function in B1
Dear all,
I have dll file and user defined function which use for converting number amount to text of my language. I plan to create UDF to keep the result of function on A/R invoice and I will use this UDF on print layout desiner but I don't know how to apply my function on B1. Please kindly suggest.
Thanks you in advanced.
AngnamHi Angnam,
Check this link.
Re: amount in words
Thanks,
Srujal Patel -
How to provide value to a User Defined field thru java code
I am using OIM 11.1.1.5.
I have a user defined field called Unique-Customer-Number. This field need to be pre-populated during user creation (using OIM Web UI) and the value comes from a java code.
Can any of you tell me the high level steps to implement this.
Thanks!
KabiThanks Rajiv,
I just followed everything on metalink 1262803.1. My console shows the followings during Metadata import.
weblogicImportMetadata.bat :-
Starting import metadata script ....
Please enter your username :weblogic
Please enter your password :
Please enter your server URL [t3://localhost:7001] :t3://10.10.99.99:7001
Connecting to t3://10.10.99.99:7001 with userid weblogic ...
Successfully connected to Admin Server 'adm_server01' that belongs to domain 'server01'.
Warning: An insecure protocol was used to connect to the server. To ensure on-the-wire security, the SSL port or Admin port should be used instead.
Location changed to domainRuntime tree. This is a read-only tree with DomainMBean as the root.For more help, use help(domainRuntime)
Disconnected from weblogic server: adm_eimsdv1s01
End of importing metadata script ...
Exiting WebLogic Scripting Tool.
How I will I know that my plugin/ event-Handler is registered successfully. Is there any screen where I can see all registered plugins ? -
User-defined function in package
Hi all,
is it possible to return more than 1 value when using user-defined function in package?I'll try to describe my situation. My need is to find correct client type by its cid number. If it's individual (ct.officialtype = 3) then function returns 3. If it's not individual (ct.officialtype <> 3) then function should check ENTERPRISETYPE.id, 910 is small business (function should return 1), else it returns 2. You can find my try below, it returns
ORA-24344: success with compilation error
13/29 PLS-00201: identifier 'US1' must be declared
13/34 PL/SQL: ORA-00904: : invalid identifier
13/1 PL/SQL: SQL Statement ignored
17/4 PLS-00201: identifier 'US1' must be declared
17/1 PL/SQL: Statement ignored
9/13 PLS-00323: subprogram or cursor 'F_CLIENTTYPE' is declared in a package specification and must be defined in the package bodyCould you please give me solution on how do I write this procedure? It should be procedure, because I need to use it in SELECT statement.
CREATE OR REPLACE PACKAGE creator.marco_function_clienttype
IS
-- 0 - not found
-- 1 - small business
-- 2 - corporate
-- 3 - individual
FUNCTION f_clienttype
(cid number
RETURN NUMBER;
END;
CREATE OR REPLACE PACKAGE BODY creator.marco_function_clienttype
IS
FUNCTION f_clienttype
(ccid number)
RETURN NUMBER
IS
Us NUMBER;
Begin
--officialtype = 2 - corporate, officialtype = 3 - individual
select ct.officialtype into Us1
from contragenttype ct, contragent d
where d.id = ccid and ct.cid = d.contragenttypeid;
IF Us1 = 3 THEN
select '3' as t into Us from dual;
ELSE
--ENTERPRISETYPE.id = 910 - small business
select dd.enterprisetypeid into Us2
from contragent dd
where dd.id = ccid ;
IF Us2 = 910 THEN
select '1' as t into Us from dual;
ELSE
select '2' as t into Us from dual;
END IF;
END IF;
Return nvl(Us,0);
END;
END;
/ -
Using User Defined Function is SQL
Hi
I did the following test to see how expensive it is to use user defined functions in SQL queries, and found that it is really expensive.
Calling SQRT in SQL costs less than calling a dummy function that just returns
the parameter value; this has to do with context switchings, but how can we have
a decent performance compared to Oracle provided functions?
Any comments are welcome, specially regarding the performance of UDF in sql
and for solutions.
create or replace function f(i in number) return number is
begin
return i;
end;
declare
l_start number;
l_elapsed number;
n number;
begin
select to_char(sysdate, 'sssssss')
into l_start
from dual;
for i in 1 .. 20 loop
select max(rownum)
into n
from t_tdz12_a0090;
end loop;
select to_char(sysdate, 'sssssss') - l_start
into l_elapsed
from dual;
dbms_output.put_line('first: '||l_elapsed);
select to_char(sysdate, 'sssssss')
into l_start
from dual;
for i in 1 .. 20 loop
select max(sqrt(rownum))
into n
from t_tdz12_a0090;
end loop;
select to_char(sysdate, 'sssssss') - l_start
into l_elapsed
from dual;
dbms_output.put_line('second: '||l_elapsed);
select to_char(sysdate, 'sssssss')
into l_start
from dual;
for i in 1 .. 20 loop
select max(f(rownum))
into n
from t_tdz12_a0090;
end loop;
select to_char(sysdate, 'sssssss') - l_start
into l_elapsed
from dual;
dbms_output.put_line('third: '||l_elapsed);
end;
Results:
first: 303
second: 1051
third: 1515
Kind regards
TaoufikI find that inline SQL is bad for performance but
good to simplify SQL. I keep thinking that it should
be possible somehow to use a function to improve
performance but have never seen that happen.inline SQL is only bad for performance if the database design (table structure, indexes etc.) is poor or the way the SQL is written is poor.
Context switching between SQL and PL/SQL for a User defined function is definitely a way to slow down performance.
Obviously built-in Oracle functions are going to be quicker than User-defined functions because they are written into the SQL and PL/SQL engines and are optimized for the internals of those engines.
There are a few things you can do to improve function
performance, shaving microseconds off execution time.
Consider using the NOCOPY hints for your parameters
to use pointers instead of copying values. NOCOPY
is a hint rather than a directive so it may or may
not work. Optimize any SQL in the called function.
Don't do anything in loops that does not have to be
done inside a loop.Well, yes, but it's even better to keep all processing in SQL where possible and only resort to PL/SQL when absolutely necessary.
The on-line documentation has suggested that using a
DETERMINISTIC function can improve performance but I
have not been able to demonstrate this and there are
notes in Metalink suggesting that this does not
happen. My experience is that DETERMINISTIC
functions always get executed. There's supposed to
be a feature in 11g that acually caches function
return values.Deterministic functions will work well if used in conjunction with a function based index. That can improve access times when querying data on the function results.
You can use DBMS_PROFILER to get run-time statistics
for each line of your function as it is executed to
help tune it.Or code it as SQL. ;) -
User define Function at Mapping Time
Hello Everyone,
My requirement is I input the one value to the user define function (at mapping time). That function calls the RFC to R/3 system and return the 3 output values. Now my question is how can I return 3-output value from the user define function.
What is the other possibility to solve this type of problem?
Where we have one input parameter and more than one output parameter.
If any one did this kind of job. Please give me the idea how can I solve this.
Regards,
Gaurav JainHello Richard,
Are you talking about <b>copy head to line</b> example given in MappingFunctionality.pdf.
In my scenario:
Input - NULL
Output - OP1, OP2, RESULT
And I write my Advance user define function as
import com.sap.mw.jco.*;
public void Lookupfunction(ResultList result, Container container){
JCO.Repository mRepository;
// Change the logon information to your own system/user
JCO.Client mConnection = JCO.createClient(
"100", // SAP client
"user", // userid
"pass", // password
"EN", // language
"hostid", // host name
"00" ); // system number
// connect to SAP
mConnection.connect();
// create repository
mRepository = new JCO.Repository( "SAPLookup", mConnection );
// Create function
JCO.Function function = null;
IFunctionTemplate ft = mRepository.getFunctionTemplate("ZTEST2");
function = ft.getFunction();
mConnection.execute( function );
result.addValue( function.getExportParameterList().getString( "OP1" ) );
result.addValue(function.getExportParameterList().getString( "OP2" ) );
result.addValue(function.getExportParameterList().getString( "RESULT" ) );
mConnection.disconnect();
But it shows me only one field as output in mapping icon.
so as per the mapping document i attach splitbyvalue over that but in the example only one field at the output side where i have three field.
How can i solve the problem?
Even i check in XI 2.0 System it doesn't show output at all.
Thanks & Regards,
Gaurav Jain
Message was edited by: Gaurav Jain -
Multi mapping question using user defined function
Hi,
I have a message with multiple occuring nodes (i.e. one message with multiple orders (header + detail)) that I need to map to a idoc. I need to filter out of the source based on order type (in header) from creating an idoc.. How do I do it using user defined function + message mappping ?
madAll - Thanks much.. Here is my requirement that is no solved by regular mapping
<Root>
<Recordset>
<Ordheader>
<ord>
<ord_type>
</Ordheader>
<Ord_line>
<ord>
<Linnum>
</Ord_line>
</Recordset>
<Recordset>
<Ordheader>
<ord>
<ord_type>
</Ordheader>
<Ord_line>
<ord>
<Linnum>
</Ord_line>
</Recordset>
<Root>
As you see above, each recordset has order transaction. One Root message can contain multiple of these. So, when I map to the IDOC, I want to filter out any ord_type <> XX.
If I use regular graphical map, it only looks at first recordset and accepts all or rejects all.
I need to use UDF. In the UDF, what comes in as input ? Resultset is output -correct ? Now how do I usse graphical mapping with UDF to generate the correct target info -
How to assign a query retrived value to a user defined object in a table
how to assign a query retrived value to a user defined object in a table
Rajeshwar,
If you use the "Search" feature in this forum, you should be able to find helpful links to similar questions. You could also look at the RecordSet and DoQuery documentation in the SAP Business One SDK Help Center documentation to assist you with your question.
HTH,
Eddy -
How do you create a user defined functions UDF and passing a value like a ID to GEt a Value.
How do you create a user defined functions UDF and passing a
value like a ID to GEt a Value.
using a query.
are there example.
Thankstons of examples at cflib.org - good place to start, even
though many
udfs there are a bit outdated in their code...
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com -
How to add user defined functions in Menu bar of a Selection Screen?
Hi,
Can anybody please suggest me that how can I add user defined functions in the menu bar of a Selection Screen?
Regards
s@kDear Amit,
I am referring to the standard SAP program: RIEQUI20.
On the initial screen, there are 3 tabs.
Code:
SELECTION-SCREEN BEGIN OF TABBED BLOCK tab FOR 25 LINES.
SELECTION-SCREEN TAB (20) tab1 USER-COMMAND ucomm1
DEFAULT SCREEN 001.
SELECTION-SCREEN TAB (20) tab2 USER-COMMAND ucomm2
DEFAULT SCREEN 002.
SELECTION-SCREEN TAB (20) tab3 USER-COMMAND ucomm2
DEFAULT SCREEN 003.
SELECTION-SCREEN END OF BLOCK tab.
AT SELECTION-SCREEN.
CLEAR gv_okcode.
gv_okcode = sy-ucomm.
CLEAR sy-ucomm.
CASE gv_okcode.
WHEN 'IH08'.
CALL TRANSACTION 'IH08'. "Equipment Selection
WHEN 'IW29'.
CALL TRANSACTION 'IW29'. "Notification Selection
WHEN 'IW39'.
CALL TRANSACTION 'IW39'. "Order List Selection
WHEN OTHERS.
ENDCASE.
* Check date:
IF NOT datuv IS INITIAL
AND NOT datub IS INITIAL.
IF datub >= datuv.
ELSE.
MESSAGE e884(ih) WITH datuv datub.
ENDIF.
ENDIF.
IF variant IS INITIAL AND
dy_vari IS INITIAL.
PERFORM get_default_variant_f14 USING variant.
ENDIF.
PERFORM variant_existence_f14 USING variant.
IF datuv IS INITIAL.
datuv = sy-datum.
ENDIF.
IF datub IS INITIAL.
datub = sy-datum.
ENDIF.
IF sy-ucomm = 'ADDR'.
PERFORM adress_sel_f01 USING 'EQUIR'.
ENDIF.
PERFORM check_parnr_f76.
* AT SELECTION SCREEN OUTPUT
AT SELECTION-SCREEN OUTPUT.
STATICS: l_slset TYPE sy-slset.
*--- Set initial variant
PERFORM variant_init_f14 USING 'INST' 'INST' 'INST' 'RIEQUI20'.
IF variant IS INITIAL AND
dy_vari IS INITIAL AND
gv_variant_flag IS INITIAL.
PERFORM get_default_variant_f14 USING variant.
gv_variant_flag = 'X'.
ENDIF.
*--- Set Icon for adress-button
PERFORM set_icon_f01 USING dy_adrfl ad_icon text-ad0 text-ad1.
*--- get classification data from select option
*--- (if new variant or if called via submit or F3)
IF ( l_slset NE sy-slset ) OR
( s_comw[] IS NOT INITIAL AND gt_clsd_comw[] IS INITIAL ).
l_slset = sy-slset.
gv_class_old = dy_class.
gv_klart_old = dy_klart.
PERFORM copy_selopt_comw_f79 TABLES gt_clsd_comw s_comw.
PERFORM class_search_init_f77 USING 'EQUI'.
ENDIF.
*--- set Icon for classification
LOOP AT gt_clsd_comw TRANSPORTING NO FIELDS
WHERE atcod > '0'.
EXIT.
ENDLOOP.
IF sy-subrc IS INITIAL.
gv_comw_flag = 'X'.
ELSE.
CLEAR gv_comw_flag.
ENDIF.
PERFORM set_icon_f01 USING gv_comw_flag cl_icon text-cl0 text-cl1.
CALL METHOD cl_uid_cust=>selection_screen_output.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR variant.
PERFORM variant_inputhelp_f14 USING variant 'RIEQUI20'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR dy_parnr.
PERFORM f4_for_parnr_f76.
AT SELECTION-SCREEN ON BLOCK clse.
IF dy_class NE gv_class_old
OR dy_klart NE gv_klart_old.
gv_class_old = dy_class.
gv_klart_old = dy_klart.
CLEAR gv_comw_flag.
REFRESH gt_clsd_comw.
REFRESH s_comw.
ENDIF.
PERFORM class_exist_f77 USING dy_klart dy_class 'DY_CLASS'.
IF sy-ucomm = 'COMW'.
CALL FUNCTION 'IHCLSD_VALUATION_POPUP'
EXPORTING
i_klart = dy_klart
i_class = dy_class
i_language = sy-langu
i_key_date = sy-datum
i_also_subclasses = dy_subcl
TABLES
ct_comw = gt_clsd_comw
EXCEPTIONS
exc_no_class = 1
exc_klart_not_allowed = 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.
*--- fill classification data in select option
PERFORM copy_comw_selopt_f79 TABLES gt_clsd_comw s_comw.
ENDIF.
IF sy-ucomm = 'ONLI'.
sscrfields-ucomm = sy-ucomm.
ENDIF.
Regards
s@k
Edited by: siemens.a.k on Jan 15, 2010 10:10 AM -
How to Developed user defined functions to call function modules in SAP R/3
how to Develope user defined functions to call function modules in SAP R/3 system
Hello Raja,
Go through this V.imp Link...
http://download.oracle.com/docs/cd/B10464_05/integrate.904/b10408/rfc.htm
Steps to crate FM..
Follow these steps..
Go to the T: code SE37
First You Create Function Group
On That u specify
Function Group Name..............
Short Text..............................
save...
Go to SE 37
Specify the Function Module Name: Eg: Z_Bapi_Materialmaster
Short Text.......
Save...
Next Go to Attributes..
Select Radio button : Remote enabled model
Go to Parameters..
Click Import...
Give Parameter Type Associate type S.t
next Click Export...
Give Parameter Type Associate type S.t
Next Click Tables Button..
Specify tables..
Next click source code button..
Write Source code here..
Eg : Select statements Etc..
Finally we should be select the Radio button Enable remorely
https://www.sdn.sap.com/irj/sdn/wiki?path=/pages/viewpage.action?pageId=39728
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/bapi%2bstep%2bby%2bstep
Re: User Defined Functions Tutorials
Hope this information is useful to you..
Thanks ,
Satya Kumar.. -
How to migrate User Define Function to another mapping in other namespace
Hi Everybody
I have define many User Define Functions in mapping
How can i use them in other mapping
Thank you in advanceHi,
I tried to explain the steps.
1. Take the JAVA code of your User-Defined Functions
2. Go to a JAVA editor (e.g NWDS, Eclipse, etc...)
2.1. create a Java project
2.2. create a Java class
2.3. inside your Java class, put each JAVA code of your User-Defined Function inside a Method
2.4. Export your Java class to a JAR file (e.g my_tools.jar)
3. Go to IR
3.1 create an Imported Archive (IA) and upload your JAR file.
3.2 in this IA, you see your Java class which contains all your methods.
4. inside your mapping,
4.1 create a User-Defined Function <u>and import</u> your class
4.2 use your method.
So, you define in only one place your code (thanks to a IA) and you will be able to use it inside several mappings.
I hope I don't forget steps...
Advantage: if tomorrow, you want to create a new function, just add a new method to your Java class and re-import your JAR file
Oh, I missed: your IA must be created inside a specific Software Component (SC__TOOLS) and this one must be linked with the others by a "Usage dependency", else your IA will be recognise only in one Software Component (and maybe only in one namespace)
Mickael -
How many types of user defined functions are there?
how many types of user defined functions are there?
Hi Ramakrishna,
A user-defined function is only visible in the message mapping in which you created it. You can insert the function in the data-flow editor as a standard function by using the User-Defined function category.
You can use the following user-defined functions:
1.Simple functions, which can process individual field input values for each function call. Simple functions therefore expect strings as input values and return a string.
2.Advanced functions, which can process several field input values for each function call. You can import either all field values of a context or the whole queue for the field in an array before calling the function. For more information, see Advanced User-Defined Functions.
go through :
http://help.sap.com/saphelp_erp2004/helpdata/en/22/e127f28b572243b4324879c6bf05a0/content.htm
Advanced user-defined functions, which can process more than just individual field values.Instead, you can import a complete context or an entire queue for a field as an array before your function is called
go through :
http://help.sap.com/saphelp_erp2004/helpdata/en/f8/2857cbc374da48993c8eb7d3c8c87a/content.htm
*Pls: Reward points if helpful*
Regards,
Jyoti
Maybe you are looking for
-
PSCS4 could not save because the file is locked or was left open
Hello- I'm getting this error a lot, maybe once out of every dozen attempts to save. This occurs on files that are indeed open... because I've opened them in Photoshop! I open the file, make a change, hit CMD-S and get this message. The finder's info
-
Receivables and Payables Line Item performance
Does anyone get really slow performance when entering Orders/Invoices into AR or AP? I can't find any other comments about it yet we can't be the only ones which such slow performance. We get very slow performance with each line taking around 6 secon
-
Can this be done? I would like to upload a forum to use inreplace of a blog. How can I do this? For example, lets say my website is web.mac.com/travis.royer, i would want to be able to make a web.mac.com/travis.royer/forums. Is this possible? If so,
-
Starting and stopping a drum loop in MainStage
Hi, i've just started using Mainstage 2.1.2 and I'm setting up a B3/bass/drums split to accompany a vocalist. I'm trying to put in a drum loop from studio drummer which I use from Native Instruments. My issue is I need to be able to setup an action w
-
How to expande multiple table row from a single button
I am trying to create an expanding table that expands multiple rows when a single button is clicked. So far I have managed to create a table that expands a single row at a time using - click this.parent.parent.instanceManager.insertInstance(); I also