How to detect caller of a function module
Hello,
how is it possible to detect who is calling a function module?
Thanks a lot,
Tanguy Mezzano
Hi, May i know why you need the caller name. If suppose you want to know currently who is executing the function. then you can check the sy-uname inside the calling program or function module that will have. If you want to know from another program then you need to pass some parameter id in side the function module and check your second program for the parameter id having any value.
Thanks.
Regards,
Jey
Similar Messages
-
How to change call to the function module in the standard program
Hi Guru,
My requairment is to create the new Z function module ZJ_1B_IM_NF_DOCUMENT_FUNCTION in the MM07MFJ1 program.
I have created the Z Funtion module,
plz provide me the info how to change the call to the new custom FM from the standard program.
Points will be given to the ans.You use SE38 to change out the code. When you try and change it you will get a popup asking you for a Key, since you are changing SAP Code. If you have a Developers key you have to go to the SAP Service Marketplace and tell SAP that you are changing this code in order to get they key. After this every time you do support packs you run the risk of this getting overlaid and you will have to change it back, also if you have a problem and SAP sees that you customized this code they probably won't spend any time on your problem.
-
How to capture errors when a Function module is called as BACKGROUND TASK
How to capture errors when a Function module is called as BACKGROUND TASK?.Please advise.
FUNCTION ZRPM_DELETE_PROJECT_DATA_API.
""Local interface:
*" IMPORTING
*" VALUE(IV_EXTERNAL_ID) TYPE RPM_TV_EXTID OPTIONAL
*" VALUE(IV_PROJECT_GUID) TYPE RPM_TV_GUID OPTIONAL
*" VALUE(FLAG) TYPE BOOLEAN OPTIONAL
*" EXPORTING
*" VALUE(EV_RC) TYPE I
*" VALUE(EV_MSG) TYPE STRING
*" VALUE(ET_MSG) TYPE RPM_TT_MESSAGES
IF flag = cl_rpm_co=>sc_true.
Call function 'RPM_DELETE_PROJECT_DATA' IN BACKGROUND TASK
EXPORTING
IV_EXTERNAL_ID = IV_EXTERNAL_ID
IV_PROJECT_GUID = IV_PROJECT_GUID
IMPORTING
EV_RC = EV_RC
EV_MSG = EV_RC
ET_MSG = ET_MSG.
COMMIT WORK.
ELSE.
CALL FUNCTION 'RPM_DELETE_PROJECT_DATA'
EXPORTING
IV_EXTERNAL_ID = IV_EXTERNAL_ID
IV_PROJECT_GUID = IV_PROJECT_GUID
IMPORTING
EV_RC = EV_RC
EV_MSG = EV_MSG
ET_MSG = ET_MSG.
ENDIF.
ENDFUNCTION.
In above code how to capture 'EV_RC' when FM is called as background task.Prakash,
CALL FUNCTION IN BACKGROUND TASK allows no IMPORTING parameters, so that your code will produce a syntax error.
The calling program can only handle errors of remote function calls (RFC) if these are either
- synchronous RFC (that is CALL FUNCTION ... DESTINATION ...) or
- asynchronous RFC (that is CALL FUNCTION STARTING NEW TASK ... DESTINATION ...).
Both synchronous and asynchronous RFC allow the capturing of errors by means of exceptions. But that is a different topic. -
Hello Guys,
I have a question regarding calling a RFC function module.
In BW - BI 7.0 I call a RFC function module:
(The ABAP program in BW-BI 7.0 is below)
CALL FUNCTION ''ZTESTFUNCTIONMODULE' " Function module in ECC
DESTINATION 'DECCLNT110' " ECC system
TABLES
it_gl_item = it_gl
it_errlog_gl = it_errlog_gl.
The 'ZTESTFUNCTIONMODULE' is RFC enabled in the ECC system.
The purpose is we retarct the data from BW to ECC.
When I run the function module it always asks for the user id and password.
The SAP logon screen appears and it asks for the user id and password.
The destination is maintained in the SM59 transaction and also the user is maintained there. I think it should login automatically into remote system and return the tables. is it correct. How to skip the logon screen.
Do I have to pass the user id and password in the function module. I think it should take the user id from the SM59 destination. Is it correct.
Please advise. As always thanks for your help guys.Hi Senthil,
I think you answered your query in your question itself
The user ID and password need to be maintained in RFC destination in SM59.
Go to SM59 and then click on test connection..if it does not ask for ID and passwoed that means correct ID and password is maintained in SM59 otherwise maintain it.
Regards,
Atish -
How to write the exceptions in function module
dear all,
how to write the exceptions in function modules with example.
thanq
jyothiHi,
Raising Exceptions
There are two ABAP statements for raising exceptions. They can only be used in function modules:
RAISE except.
und
MESSAGE.....RAISING except.
The effect of these statements depends on whether the calling program handles the exception or not. The calling program handles an exception If the name of the except exception or OTHERS is specified after the EXCEPTION option of the CALL FUNCTION statement.
If the calling program does not handle the exception
· The RAISEstatement terminates the program and switches to debugging mode.
· The MESSAGE..... RAISING statement displays the specified message. Processing is continued in relation to the message type.
If the calling program handles the exception, both statements return control to the program. No values are transferred. The MESSAGE..... RAISING statement does not display a message. Instead, it fills the system fields sy-msgid, sy-msgty, sy-msgno , and SY-MSGV1 to SY-MSGV4.
Source Code of READ_SPFLI_INTO_TABLE
The entire source code of READ_SPFLI_INTO_TABLE looks like this:
FUNCTION read_spfli_into_table.
""Local Interface:
*" IMPORTING
*" VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
*" EXPORTING
*" VALUE(ITAB) TYPE SPFLI_TAB
*" EXCEPTIONS
*" NOT_FOUND
SELECT * FROM spfli INTO TABLE itab WHERE carrid = id.
IF sy-subrc NE 0.
MESSAGE e007(at) RAISING not_found.
ENDIF.
ENDFUNCTION.
The function module reads all of the data from the database table SPFLI where the key field CARRID is equal to the import parameter ID and places the entries that it finds into the internal table spfli_tab. If it cannot find any entries, the exception NOT_FOUND is triggered with MESSAGE ... RAISING. Otherwise, the table is passed to the caller as an exporting parameter.
Calling READ_SPFLI_INTO_TABLE
The following program calls the function module READ_SPFLI_INTO_TABLE:
REPORT demo_mod_tech_fb_read_spfli.
PARAMETERS carrier TYPE s_carr_id.
DATA: jtab TYPE spfli_tab,
wa LIKE LINE OF jtab.
CALL FUNCTION 'READ_SPFLI_INTO_TABLE'
EXPORTING
id = carrier
IMPORTING
itab = jtab
EXCEPTIONS
not_found = 1
OTHERS = 2.
CASE sy-subrc.
WHEN 1.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno.
WHEN 2.
MESSAGE e702(at).
ENDCASE.
LOOP AT jtab INTO wa.
WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
ENDLOOP.
The actual parameters carrier and jtab have the same data types as their corresponding interface parameters in the function module. The exception NOT_FOUND is handled in the program. It displays the same message that the function module would have displayed had it handled the error.
Or
just have to decide what exceptions u want and under what conditions.
then declarethese exeptions under the exceptions tab.
in the source code of ur function module.
if
like this u can code .
now when u call the function module in tme mainprogram.
if some error occurs and u have declared a exception for this then it will set sy-subrc = value u give inthe call of this fm.
in the fm u can program these sy-subrc values and trigger the code for ur exception.
Please reward if useful
Regards,
Ravi
Edited by: Ravikanth Alapati on Mar 27, 2008 9:36 AM -
Error in calling the Remote Function Module
Hi all,
I am trying to call the Remote function Module which is in CRM from ECC .
But we are not able to detect the function module as it is showing the error as Function Module not found.
Can anybody help us in calling the Remote Function Module .
Regards,
MadhaviPlease check the foll 2 things :
RFC radio button clicked in se37 for that FM
RFC connection established with the remote server in SM59
Thanks -
Debuggin a Call to Remote Function Module
Hi
I have a scenario where i have a Remote Function Module in r3 which is being called synchronously by an external java application. The FM has a lot of input and output parameters and many tables. The output returned by the FM is not as expected.
Can anyone tell me how debug a Remote Function Module when a call has been made from an external application.
I am not able to get the test data sent by the external application . So when the external application gives a call to this Remote FM and if it is possibele to debug it would be great.
regards
Nilesh Taunk.Hi Nilesh,
1) Login to SAP with the same ID with which you will calling the RFC function module from the outside system.
2) Goto transaction - se37/se38
3) Goto Utilities => Settings.
4) Select the ABAP Editor Tab.
5) Click on the Debugging tab.
6) Tick the Actv. button and give the user name with which you will be debugging the code. In this case the logged in user id.
7) Press Enter.
8) Now put an external break point inside the Function Module.
9) Load your external application (from where you want to debug the FM) once again.
The execution will stop in the FM.
Hope it helps..
Lokesh
PS: This was a simple question, but I guess the reason no one has answered your question is due to the fact that you havent rewarded points to members helping you. Also remember to close your post once it has been answered. -
Calling an ABAP function module
Hi friends,
I am developing an application in EP6 SP2 using JSPDynPage from which, want to call an ABAP function module that returns table and show the values from this table in this application.
I went thru various blogs and APIs. I am confused between SAP JCO, JCO client service and connector framework. Do u have any documentation on how to connect to R3 systems and call a function module, retrieve results etc.
Regards,
NilzJCo is the point to start. This gives you low level access to all rfc functions. Everything else (accept BSP and Web dynpro) are just layers of encapsulation around the low level JCo function.
The steps are always like this:
call the sap system for rfc login
prepare data areas and call in java
call the rfc in the R/3 system
handle exceptions
logoff and free ressource
continue with data obtained in R/3
There is a lot of material around jco. One book that is fairly ok is :
SAP Interface Programming
A comprehensive reference for RFC, BAPI, and JCo programming
J. Meiners, W. Nüßer
SAP PRESS ISBN 1-59229-034-5
This helps you navigate through the wealth of information also at SDN -
Multiple calls of same function module do NOT initialize variables ?
Hi all,
..so its my fist post here, this is a bit strange problem for me and maybe someone knows whats happening.
So I have in SAP Solution Manager a function module 'Z', which calls a standard SAP class CL_SPROJECT_SOLAR_BASE_REPORT, which in turn calls the standard function module 'SPROJECT_GET_ADMIMP_SCREEN_BP'.
During development, things worked fine, but now I run my Z-Program for more than one instance and even I do all FREE for the Class, apperently the function module SPROJECT_GET_ADMIMP_SCREEN_BP, which is called by the class CL_SPROJECT_SOLAR_BASE_REPORT, does not get it's variables from the global data of the function pool re-initialized, when it is called for the second, 3rd, ... time.
This is a bit strane behavior for me, I would have expected that variables in a function module (or even in the global data of that function pool) get re-initialized each time that function module is called ?
Actually, this is the only function in that function pool.
Well, if not, does anyone has an idea how I can get the variables of this module pool re-initialized between the calls ? More concrete, the global data of function pool SAPLSPROJECT_SOLAR_ADMEVAL_BP define:
DATA: g_v_with_var TYPE char1.
In the function module line 36 (no reference to g_v_with_var, no module call, no changes to g_v_with_var before the IF-statement at all) it is querying:
IF g_v_with_var IS INITIAL.
So this is my problem, the second time I am calling the class (which is 'free'ed and re-created between the calls) which calls this function module the 'g_v_with_var' is not initial and there seems to be no way to have it set to initial again ?
So even thought this is in SolMan, I think the question & problem is a ABAP technical one ?
Any thoughts, help or support would be very much appreciated,
thank so much,
FrankHi Mae,
..thanks a lot for your fast reply, unfortunately there is only one function and no functions or forms at all for initializing. The variable I am fighting with is g_v_with_var and that is referenced only 4 times in the whole function pool:
Global Data: 101 DATA: g_v_with_var TYPE char1.
Function Module SPROJECT_GET_ADMIMP_SCREEN_BP (which is the only function module):
36 IF g_v_with_var IS INITIAL.
127 g_v_with_var = airep_true.
193 CLEAR g_v_with_var.
If in line 36 g_v_with_var is 'X', which it is always after the first call, the function will exit with an exception, so line 193 to clear it will actually never be executed...and it is not cleared the next time the function module is called, so you never get back to have the function run...
All the best,
Frank -
Call report in function module
Hi All,
Please tell me how to call report in function module. i want input parameters of function module with same selection screen parameters of report. please tell to me .if possible provide the code.
Thanks,
Raju.Hi Kumar,
Incorporate the below logic in the FM that you have developed.
SUBMIT zreport WITH s_vbeln IN t_saleorder_range
WITH p_file EQ w_file
AND RETURN.
Note: Here, t_salerder_range is an internal table of type range. It has four fields just like selection-options...SIGN,OPTION, LOW and HIGH. Whatever the values that you pass here would be taken as the selection screen values for the report that you are calling.
Hope this is helpful
Thanks,
Babu Kilari -
How to Create a Remotely Enabled Function Module
Hi All,
How to Create a Remotely Enabled Function Module.
I Want to Create a FM Using Sample Data , This for Practice
What Fields can i give in the Import and Export Parameters.
Please Give me one Example
Can Any one Give me the Steps to do this.
Regards
VamsiHi Vamsi,
Lets do simple example where you will first create a RFC in one server (say A) and create normal program in othere server (say B). Finally you will call the RFC in A from B.
Do the following steps for creating RFC in server A.
1. log on to server A
2. go to se37
3. Edit -> function groups-> create function group and give the function group name (say ZGRP).
4. create a FM ( say Z_TEST_RFC) in se37 providing the function group which is created just now.
5. go to attribute tab -> choose remote-enabled module from processing type.
so that your FM will become RFC.
6. provide the import parameter in import tab.
we will provide only two import parameters.
- parameter name : P_NUM1, typing: TYPE, associated type : I & <b>check the pass value</b> (all the parameters of RFC must pass by value).
- parameter name : P_NUM2, typing: TYPE, associated type : I & <b>check the pass value</b>
7. provide the export parameter in export tab.
parameter name : P_SUM, typing: TYPE, associated type : I & <b>check the pass value</b>
8. write the given simple code in source code tab.
FUNCTION Z_TEST_RFC.
P_TOT = P_NUM1 + P_NUM2.
ENDFUNCTION.
Do the following steps for creating ABAP program which will call the RFC in server B.
1. se38 - > creat a program.
2. write the given simple code.
data tot type i.
call function 'Z_TEST_RFC' destination '<b>XXXXXX</b>'
exporting
p_num1 = 10
p_num2 = 15
importing
p_tot = tot.
write tot.
please note that <b>XXXXXX</b> is RFC connection which is avialable in <b>sm59</b> transaction in server A.
-go to sm59 - > abap connection (list of RFC connection configurations are avialable). choose server B connection and replace it of <b>XXXXXX</b> in the code.
finally you can execute the normal abap program that will call the RFC and display the result.
Regards,
Sukhee -
Revision: 2260
Author: [email protected]
Date: 2008-06-26 12:42:39 -0700 (Thu, 26 Jun 2008)
Log Message:
Fix for version checking code not always detecting calls to newer functions.
flex checkintests pass
Modified Paths:
flex/sdk/trunk/modules/asc/src/java/macromedia/asc/semantics/ConstantEvaluator.java
flex/sdk/trunk/modules/asc/src/java/macromedia/asc/semantics/ReferenceValue.javaRevision: 2260
Author: [email protected]
Date: 2008-06-26 12:42:39 -0700 (Thu, 26 Jun 2008)
Log Message:
Fix for version checking code not always detecting calls to newer functions.
flex checkintests pass
Modified Paths:
flex/sdk/trunk/modules/asc/src/java/macromedia/asc/semantics/ConstantEvaluator.java
flex/sdk/trunk/modules/asc/src/java/macromedia/asc/semantics/ReferenceValue.java -
Calling a normal function module in SAP system .
Hi Experts,
I have the requirment like -->
I want to call a normal function module in SAP system which will perform a data look up. The module will be called by SAP-XI and the response will come to SAP-XI . That means i want to make a synchronous call to a Normal function module (not Remote module) which can perform the data look up and send me the result.
Can anyone help me in this.
ThanksHi Ajay,
Lookups in XI made simpler -
/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
How to check JDBC SQL Query Syntax and verify the query results inside a
User Defined Function of the Lookup API -
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
/people/prasad.illapani/blog/2006/10/25/how-to-check-jdbc-sql-query-syntax-and-verify-the-query-results-inside-a-user-defined-function-of-the-lookup-api
Lookups - /people/morten.wittrock/blog/2006/03/30/wrapping-your-mapping-lookup-api-code-in-easy-to-use-java-classes
Lookups - /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
http://help.sap.com/saphelp_nw04/helpdata/en/cf/406642ea59c753e10000000a1550b0/content.htm
/people/sap.user72/blog/2005/12/06/optimizing-lookups-in-xi
Thanks,
Satya Kumar -
How to use Logical database in function module?
I will create a function module in HR.
but how to use Logical database in function module ? Logical database PNP always show screen.in function (RFC) code , it is a matter.You cannot attach the LDB to the main program of the function group.
- So you may [SUBMIT|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=submit&adv=false&sortby=cm_rnd_rankvalue] a report which use the LDB and get back the data (export/import), by default in the syntax of SUBMIT the selection-screen will not be displayed
- Use [LDB_PROCESS|https://www.sdn.sap.com/irj/sdn/advancedsearch?query=ldb_process&cat=sdn_all], fill a structured table for selection, and get data back in another table
- Use [HR function modules to read Infotypes|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=hrfunctionmodulestoread+Infotypes&adv=false&sortby=cm_rnd_rankvalue].
Regards -
Problem while calling an RFC Function Module in Background
Hello,
I have created a RFC function module for reading data from an external DB system. The FM calls an external RFC program (coded in C++ using RFC SDK), which delivers the required data. This external program is maintainged as an TCP RFC Connection in SM59.
Further I have created a report, that calls the RFC function module to get the data from the external RFC programm.
My problem is, when I call the report in foreground, everything works OK, the RFC connection works and data can be read from the external program.
However, when I schedule the report to run in background as a job, the report is stating in the protocoll that there was a problem calling the defined RFC connection (although the connection is working properly at that time).
More funny is, this particular problem with running in background occurs only in the productive system, in test and development system the report works correctly also while running as a job in background.
Can you suggest the solution to this problem? Could it be something with authorisations or server settings?
I will be on holiday for the next 6 weeks, so take your time to answer .
Regards,
Dusan.
Edited by: Julius Bussche on Jan 22, 2009 7:19 PM
Please read the forum rules about u r g e n t ...This is an external RFC server program, not a remote enabled ABAP RFC function module as the others seem to be assuming, right?
Is it possible that your DEV and QAS systems only have one application server, but the PROD has many and dedicated one(s) for processing low priority background jobs?
It might be that the target server of your TCP connection is not this BTC instance, and your RFC server is returning the data "locally" - so, into nirvana...
Just guessing, but might be worth checking.
Cheers,
Julius
Maybe you are looking for
-
0x2D becomes 0xAD after upgrade from 8.5 to XI 2
We used to use Crystal 8.5 to create reports with embedded email commands for use in eDocPrinterPro, which converts the report to .pdf format and attaches the resulting .pdf document to an email, with an email address as specified in the embedded com
-
How to start safe mode while showing? Sign
My MacBook pro show
-
Remove leading zeros in report
Hi all, I do a clasical reoporting. Data in the internal table numeric types. But when writing in the report, is appearing as 000056 etc. I want to remove this leading zeros in the report output. Any helps? Regards, Mic.
-
Leopard Server on G4 XServe?
I run a lab of 31 Intel iMacs (plus a number of assorted machines around the school) using a G4 1.33 GHz XServe with 1.25 GB of RAM. The lab iMacs and the server are both currently running 10.4.11. I have purchased an unlimited license of Leopard ser
-
Change Color Settings through Scripting
We're having an issue at my work where Photoshiop is frequently losing its Color Settings. Is there a way to modify these settings through scripting, so I can have it run automatically? The settings are: Working Spaces RGB: sRGB IEC61966-2.1 Color