Need of Changing Parameters in Function Module
Hi All,
Why we need sepearte Import and Export parameters in Function Module if the Changing Parameters
acts as both import and export parameters.
What is the use of using Changing Parametrs in Function Module.
Thanks in advance.
Sundaresan
Hi,
EXPORT PARAMETERS: When u r passing some value to the function, and the parameter will not be changed in the function, we use export parameter. Example: u pass parameter (a : 10) to a function, even after the function has been executed, value of a will be 10 only.
IMPORT PARAMETER: When u require some value back from the function. u do not provide any initial value to the function. Example : u pass a parameter (b: <blank>) to the function, function returns the same import parameter as (b : 20).
CHANGING PARAMETER: When u pass some value to the function and that function may change that value inside function, then changing parameters are used. Example: u pass parameter ( c: 30) to the function as changing parameter and function modifies this variable and return ( c: 50).
Reward points if helpful.
Thanks & Regards
- Rishika Bawa
Similar Messages
-
Need to change the way Function module exit is called.
Dear Abaper,
I want to know wheather is it possible to change the way a function module exit is called.In transaction IK11 i am using enhancement imrc0001 this function module is called only when clicking the save button. My requirement will be met only when desired result is obtained while clicking ENTER button.Now the desired result are obtained by Clicking SAVE button. As a result only after saving i am able to view. Is there any way to change by clicking Enter button itself we can call the IMRC0001 enhancement. Please guide me.
Thanks and regards,
OmprasathHi,
Each action in the screen have some FCODE(SY-UCOMM) in that exit u can add code when the particular button is clicked then run it or else no need to run.
For Example SAVE has user command as SAV+(SY-UCOMM)
u can restrict it as.
IF SY-UCOMM = 'SAVE+'.
Run ur code.
Endif. -
Dynamic parameters in function module
Hi. I need to write a program that can call various different function modules based on what the user inputs.
For example, if the user chooses "BAPI_USER_GET_DETAIL" I need to then call that function module. There is a list of about 30 functions they can choose from.
I can read in the function interface using FUNCTION_IMPORT_INTERFACE and have got the import, changing and tables parameters being entered in an editable ALV.
Now I just need to work out how to call the function module.
I could spend ages hard coding all the various combinations, but what I would like to do is call the function totally dynamically.
I know this wouldn't work, but this sort of thing:
CALL FUNCTION p_funct
EXPORTING
<imp_1> = <val_1>
<imp_2> = <val_2>.
Has anyone got any ideas?
Thanks a lot,
Dave.Hi. I think you've solved it, thanks a lot.
Just checking it all now, will be back shortly.
Can't believe it was that simple, spent ages looking through SDN and google. I was searching for dynamic function, not bapi, so I missed that posting too.
Regards,
Dave. -
How to log input parameters for Function Modules?
Hi,
I need to create a Logging system to trace input parameters for function modules.
The log functionality could be done by developing a class method or a function module (For example 'write_log'), and calling it within each function module that I want to log. The 'write_log' code should be independent from the interface of the Function Module that I want to log.
For example, I'd like to write a function/class method that can log both these functions modules:
Function DummyA
Input parameters: A1 type char10, A2 type char10.
Function DummyB
Input parameters: B1 type char20, B2 type char20, B3 type char20, B4 type Z_MYSTRUCTURE
Now the questions...
- Is there a "standard SAP" function that provide this functionality?
- If not, is there a system variable in which I can access runtime all parameters name, type and value for a particular function module?
- If not, how can I loop at Input parameters in a way that is independent from the function module interface?
Thank you in advance for helping!check this sample code. here i am capturing only parameters (import) values. you can extend this to capture tables, changin, etc.
FUNCTION y_test_fm.
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(PARAM1) TYPE CHAR10
*" REFERENCE(PARAM2) TYPE CHAR10
*" REFERENCE(PARAM3) TYPE CHAR10
DATA: ep TYPE STANDARD TABLE OF rsexp ,
ip TYPE STANDARD TABLE OF rsimp ,
tp TYPE STANDARD TABLE OF rstbl ,
el TYPE STANDARD TABLE OF rsexc ,
vals TYPE tihttpnvp ,
wa_vals TYPE ihttpnvp ,
wa_ip TYPE rsimp .
FIELD-SYMBOLS: <temp> TYPE ANY .
CALL FUNCTION 'FUNCTION_IMPORT_INTERFACE'
EXPORTING
funcname = 'Y_TEST_FM'
* INACTIVE_VERSION = ' '
* WITH_ENHANCEMENTS = 'X'
* IGNORE_SWITCHES = ' '
* IMPORTING
* GLOBAL_FLAG =
* REMOTE_CALL =
* UPDATE_TASK =
* EXCEPTION_CLASSES =
TABLES
exception_list = el
export_parameter = ep
import_parameter = ip
* CHANGING_PARAMETER =
tables_parameter = tp
* P_DOCU =
* ENHA_EXP_PARAMETER =
* ENHA_IMP_PARAMETER =
* ENHA_CHA_PARAMETER =
* ENHA_TBL_PARAMETER =
* ENHA_DOCU =
EXCEPTIONS
error_message = 1
function_not_found = 2
invalid_name = 3
OTHERS = 4
IF sy-subrc = 0.
LOOP AT ip INTO wa_ip .
MOVE: wa_ip-parameter TO wa_vals-name .
ASSIGN (wa_vals-name) TO <temp> .
IF <temp> IS ASSIGNED .
wa_vals-value = <temp> .
ENDIF .
APPEND wa_vals TO vals .
ENDLOOP .
ENDIF.
ENDFUNCTION. -
What are the input parameters for Function Module
Dear Experts,
I want to generate a Sales Tax returns report,those fields are not available in my existing Datasources.
For that i want to write a Generic Datasource with Function Module.
audat
bukrs
vkorg
vtweg
spart
aurat
auart
netwr
mwsbp
kschl zedp(consition type)
kschl zvat(condition type)
ksch zcst(condition type)
matkl material group
Here what are the Input parameters for Function Module.
Thanks in Advance.
Srinivasan.Srinivasan-
For creating a Generic extractor based on a FM, you first of all need to know what is going to be your structure.. i.e. what all fields you need to pull from what all tables. A functional consultant may help you identify the exact DB tables.
Once you know them, hand over the requirement and the pdf mentioned by Krishna to the ABAP guy, he would be able to take this up further.
Also decide 1st whether you would be using a full load or delta. There is a slight difference in the way they are built.
Let me know how it goes.
-Bhushan. -
Need help for IDOC inbound function module !
Hi guys please help me to create a IDOC inbound function module.
What are the parameters and tables.
How to write the code.
What it does.
Please send me one inbound func module code if possuble
ThanksHi,
You need to create an inbound function module. Then define the process code in transaction we42 and attach the function module to this process code.
In the function module you create you need to define tables of types EDIDC (Control record (IDoc)), EDIDD (Data record (IDoc)) and BDIDOCSTAT (ALE IDoc status (subset of all IDoc status fields)).
Regards,
Soumya. -
What are the parameters of Function Module
Hi,
What are the parameters of Function Module?Function Modules are special external subroutine stored in a central library. The R/3 system provides numerous predefined function modules that you can call from the ABAP/4 programs.
All the function Modules are created under the Function Groups. Function Groups are nothing but the related group of function modules.
The function modules can be maintained through T.CodeSE37 and T.Code SE80.
In general the function module has the following components.
Documentation:
This is the place where you can find the discription/purpose of the function module.
Import & Export Parameters.
Import parameters correspond to the formal input parameters of subroutines. They pass data from the calling program to the function module.
Export parameters correspond to the formal input parameters of subroutines. They pass data from the function module back to the calling program.
Table Parameters.
Table parameters are internal tables. Internal tables are treated like changing parameters and are always passed by reference.
Exceptions.
Exceptions are used to handle error scenarios which can occur in the function modules. The function modules checks for any type of error and raise exception and returns SY-SUBRC value to the calling program.
Source Code:
the programming logic of the function module is written in this source code.
Rewards if useful. -
Changing option in function module
sir,
plz explain the role or importance of changing option in function module SE37hi check this example it had the usage of the changing option..
here the using will input the value to the perform and do some prosses and output some value..
PERNR TYPE P0001-PERNR Personnel Number
PLANS TYPE P0001-PLANS Position
ORGEH TYPE P0001-ORGEH Organizational Unit
DATE TYPE SY-DATUM SY-DATUM Date and time, current (applic
PLVAR TYPE PLOG-PLVAR '01' Plan Version
ISTAT TYPE PLOG-ISTAT '1' Planning Status
MANAGER TYPE ZHMSS_MANAGER Structure for manager for MSS
NO_PERNR_PLANS_ORGEH_SPEC No pernr, position or org unit specified
NO_EXIST_PLANS Position does not exist
INVALID_PLANS Position invalid
NO_EXIST_ORGEH Org unit does not exist
NO_EXIST_PERNR Personnel number does not exist
function z_get_orgunit_manager_info.
""Local interface:
*" IMPORTING
*" REFERENCE(PERNR) TYPE P0001-PERNR OPTIONAL
*" REFERENCE(PLANS) TYPE P0001-PLANS OPTIONAL
*" REFERENCE(ORGEH) TYPE P0001-ORGEH OPTIONAL
*" REFERENCE(DATE) TYPE SY-DATUM DEFAULT SY-DATUM
*" REFERENCE(PLVAR) TYPE PLOG-PLVAR DEFAULT '01'
*" REFERENCE(ISTAT) TYPE PLOG-ISTAT DEFAULT '1'
*" EXPORTING
*" REFERENCE(MANAGER) TYPE ZHMSS_MANAGER
*" EXCEPTIONS
*" NO_PERNR_PLANS_ORGEH_SPEC
*" NO_EXIST_PLANS
*" INVALID_PLANS
*" NO_EXIST_ORGEH
*" NO_EXIST_PERNR
if pernr is initial and
plans is initial and
orgeh is initial.
raise no_pernr_plans_orgeh_spec.
endif."pernr is initial and
if not pernr is initial.
if pernr cn '0123456789'.
exit.
endif.
*-- See if pernr exists
call function 'P_EMPLOYEE_CHECKEXISTENCE'
exporting
object_id = pernr
date = date
exceptions
employee_not_found = 01.
if sy-subrc ne 0.
raise no_exist_pernr.
exit.
endif.
*-- Obtain pernr position
call function 'HR_READ_INFOTYPE'
exporting
pernr = pernr
infty = c_infty_0001
begda = date
endda = date
importing
subrc = g_retcd
tables
infty_tab = i0001
exceptions
infty_not_found = 01
others = 02.
if sy-subrc eq 0.
describe table i0001 lines g_lines.
if g_lines > 0.
read table i0001 index 1.
*-- Got position now find org unit
perform zf_proc_get_om_objects tables i_objects
using c_otype_position
i0001-plans
plvar
c_rsign_a
c_relat_003
istat
date
date
c_otype_orgunit
changing g_retcd.
if g_retcd eq 0.
read table i_objects index 1.
g_orgeh = i_objects-sobid(8).
endif. "g_retcd eq 0.
endif. "g_lines > 0. for i0001
endif. "sy-subrc eq 0 hr_read_infotype
elseif not plans is initial.
if plans co '9' or
plans co '0'.
raise invalid_plans.
exit.
endif.
call function 'RH_READ_OBJECT'
exporting
plvar = plvar
otype = c_otype_position
objid = plans
istat = istat
begda = date
endda = date
langu = sy-langu
exceptions
not_found = 1
others = 2.
if sy-subrc <> 0.
raise no_exist_plans.
exit.
endif.
*-- Find org unit
perform zf_proc_get_om_objects tables i_objects
using c_otype_position
plans
plvar
c_rsign_a
c_relat_003
istat
date
date
c_otype_orgunit
changing g_retcd.
if g_retcd eq 0.
read table i_objects index 1.
g_orgeh = i_objects-sobid(8).
endif."g_retcd eq 0.
elseif not orgeh is initial.
call function 'RH_READ_OBJECT'
exporting
plvar = plvar
otype = c_otype_orgunit
objid = orgeh
istat = istat
begda = date
endda = date
langu = sy-langu
CHECK_STRU_AUTH = space "ASikaria, 10/15
exceptions
not_found = 1
others = 2.
if sy-subrc <> 0.
raise no_exist_orgeh.
exit.
endif.
g_orgeh = orgeh.
endif. "not pernr is initial.
if not g_orgeh is initial.
manager-orgeh = g_orgeh.
*-- Got org unit now find manager
perform zf_proc_get_om_objects tables i_objects
using c_otype_orgunit
manager-orgeh
plvar
c_rsign_b
c_relat_012
istat
date
date
c_otype_position
changing g_retcd.
if g_retcd eq 0.
read table i_objects index 1.
if sy-subrc eq 0.
manager-plans = i_objects-sobid.
call function 'Z_GET_POSITION_HOLDER'
exporting
plans = manager-plans
plvar = plvar
istat = istat
date = date
importing
pernr = manager-pernr
exceptions
position_not_exist = 1
position_invalid = 2
others = 3.
if sy-subrc <> 0.
clear: manager-pernr.
endif.
if not manager-pernr is initial.
*- BOC RTDK902962
*-- Obtained formatted name
clear: i0001.
refresh: i0001.
call function 'HR_READ_INFOTYPE'
exporting
pernr = manager-pernr
infty = c_infty_0001
begda = date
endda = date
importing
subrc = g_retcd
tables
infty_tab = i0001
exceptions
infty_not_found = 1
others = 2.
if sy-subrc eq 0.
read table i0001 index 1.
if sy-subrc eq 0.
manager-ename = i0001-ename.
endif.
endif.
*- EOC RTDK902962
*-- Obtain pernr information
*- Get 0002 data
clear: i0002.
refresh: i0002.
call function 'HR_READ_INFOTYPE'
exporting
pernr = manager-pernr
infty = c_infty_0002
begda = date
endda = date
importing
subrc = g_retcd
tables
infty_tab = i0002
exceptions
infty_not_found = 1
others = 2.
if sy-subrc eq 0.
read table i0002 index 1.
if sy-subrc eq 0.
manager-inits = i0002-inits.
manager-vorna = i0002-vorna.
manager-nachn = i0002-nachn.
manager-midnm = i0002-midnm.
endif.
endif.
*- Get 0105 data
clear: i0105.
refresh: i0105.
call function 'HR_READ_INFOTYPE'
exporting
pernr = manager-pernr
infty = c_infty_0105
begda = date
endda = date
importing
subrc = g_retcd
tables
infty_tab = i0105
exceptions
infty_not_found = 1
others = 2.
if sy-subrc eq 0.
describe table i0105 lines g_lines.
if g_lines > 0.
*- SAP usrid
loop at i0105 where subty = c_0105_usrid_subty.
manager-usrid = i0105-usrid.
endloop.
*- Email address
*// not sure where email is going to be stored but assume it is subtype
*// 0010
loop at i0105 where subty = c_0105_email_subty.
manager-email = i0105-usrid_long.
endloop.
endif. "g_lines > 0
endif."sy-subrc eq 0.
endif. "not manager-pernr is initial.
endif. "sy-subrc eq 0.
endif."g_retcd eq 0.
endif. "not g_orgeh is initial.
endfunction.
zposition holder
PLANS TYPE PLOG-OBJID Object ID
PLVAR TYPE PLOG-PLVAR '01' Plan Version
ISTAT TYPE PLOG-ISTAT '1' Planning Status
DATE TYPE SY-DATUM SY-DATUM Date and time, current (application server) date
PERNR TYPE P0001-PERNR Personnel Number
POSITION_NOT_EXIST Position does not exist
POSITION_INVALID Invalid position
function z_get_position_holder.
""Local interface:
*" IMPORTING
*" REFERENCE(PLANS) TYPE PLOG-OBJID
*" REFERENCE(PLVAR) TYPE PLOG-PLVAR DEFAULT '01'
*" REFERENCE(ISTAT) TYPE PLOG-ISTAT DEFAULT '1'
*" REFERENCE(DATE) TYPE SY-DATUM DEFAULT SY-DATUM
*" EXPORTING
*" REFERENCE(PERNR) TYPE P0001-PERNR
*" EXCEPTIONS
*" POSITION_NOT_EXIST
*" POSITION_INVALID
if plans cn '0123456789'.
raise position_invalid.
endif."plans cn '0123456789'.
if plans co '9'. "default position
exit.
endif.
call function 'RH_READ_OBJECT'
exporting
plvar = plvar
otype = c_otype_position
objid = plans
begda = date
endda = date
exceptions
not_found = 01
others = 02.
if sy-subrc ne 0.
raise position_not_exist.
else.
perform zf_proc_get_om_objects tables i_objects
using c_otype_position
plans
plvar
c_rsign_a
c_relat_008
istat
date
date
c_otype_pernr
changing g_retcd.
if g_retcd eq 0.
sort i_objects by begda descending. "get earliest rec
read table i_objects index 1.
if sy-subrc eq 0.
pernr = i_objects-sobid(8).
endif.
endif. "g_retcd eq 0.
endif. "sy-subrc ne 0.
endfunction.
regards,
venkat -
Difference between Import and Export parameters in Function Module
Hi All,
I am unclear about the import and export parameters, when i create a function module. Can anyone explain abt this. However when i call the function module in any program the import parameters in Function module are displayed as exporting in program amd the export parameters as importing.
Any help on this would be appericiated.
Shejal.HI,
Import parameter in FM is the value u provide to FM for processing.
export is the value u get from FM after processing.
when u call a FM in a progam the import parameter will appear as Export bcos u r giving value to the FM.
and u r getting value from FM in import parameter(bcos u r importing).
rgds,
latheesh
Message was edited by: Latheesh Kaduthara -
Changing delivered class/function module.
Hello All,
Can I change delivered ABAP class "CL_HRMSS_RECRUITING_WF" (add functionality to a method "CREATENBOBJECT"). Also can I change a delivered function module "HRWPC_EREC_CREATE_EREC_OBJECT" .
My original problem.
I am trying to pass the my object (with few attributes read from tables) using CREATENBOBJECT as a parameter to the function module "HRWPC_EREC_CREATE_EREC_OBJECT" (CREATENBOBJECT calls HRWPC_EREC_CREATE_EREC_OBJECT).
The "CREATENBOBJECT" is called as an activity in the workflow (personnel requisition workflow).
Kind regards.
SrinivasHi Srinivas,
Using SE24 to copy CL_HRMSS_RECRUITING_WF to say Z_CL_HRMSS_RECRUITING_WF
Copy Class:
Path:
1> Goto SE24
2> Type in CL_HRMSS_RECRUITING_WF in screen field Object Type
Menu path
3> Object Type/More Functions/Copy. Here you mention your class name (ex: Z_CL_HRMSS_RECRUITING_WF)
Copy FM:
Path
1> SE37
2> Type in HRWPC_EREC_CREATE_EREC_OBJECT in screen field 'Function Module'
Menu Path
3> Goto Function Module/ Other Functions /Copy. TYpe in your FM say Z_HRWPC_EREC_CREATE_EREC_OBJECT
I hope this solves your problem of copying. Herewith make your changes with these new objects.
Please reward points if it has satisfied your requirement.
AKJ -
Need to know the standard function module/program in E recruitment
Hi All,
I need to know the standard function module/programm that defaults the 'Functional area' field in the posting page from the requisition page.
Early responce is greatly appreciated.
Thanks and best regards
RajeevHi Masa,
Thanks for your reply.
We are using Assets with the integration of Project systems. We are now in 4.6C R/3 & SRM 5.0 system. And now R/3 upgrade and SRM upgrade going on smultaniously to ECC6.0 and SRM 7.0 respectively.
I would like to know any new functionality available in the latest upgrades and we have done lot of customization for Asset Procurement. And would like to go with Vanilla.
Can you please provide me some inputs about the Project (WBS element ) based Asset Procurement in SRM as standard.
Thanks and Regards,
Ramesh -
Need to create a validation Function Module
Hi,
I need to create a Validation Function Module.
I have a ITAB into which data comes.
FIELD-SYMBOLS : <ITAB> TYPE ANY ,
key TYPE ANY,
char TYPE ANY.
<ITAB> = local_file.
there is a field KEY whose sum when becomes equal to 10.000 for every CHAR,system should show a popup in the below FM
CALL FUNCTION 'POPUP_WITH_WARNING_ALV'
EXPORTING
TEXTLINE1 = LT_POPUPTEXT
TEXTLINE2 = ' '
TITEL = 'Warnung'
Please let me know if the requirement is not clear.
Thank U very Much.Hi annapurna ,
In your case even the KEY value is the most useful one right,
If so go about this way,
have another field flag set it when the sum of the KEY values exceeds 10.
Loop in an internla table.
Now the internal table will have all the data including the flag and now based on the flag (whether set or not) call the function module popup which should retrieve those matnr field where flag is set.
Display the error message saying that the KEY value fr this matnr exceeds 10.
Revert for further clarification.
Thanks and Regards
Srikanth.P -
Need to know the standard function module in E-Recruitment
Hi All,
I need to know the standard function module that defaults the value of 'Functional area' in 'Posting' from 'Requisition'.
Early response is greatly appreciated.
Thanks an best regards
RajeevHi Masa,
Thanks for your reply.
We are using Assets with the integration of Project systems. We are now in 4.6C R/3 & SRM 5.0 system. And now R/3 upgrade and SRM upgrade going on smultaniously to ECC6.0 and SRM 7.0 respectively.
I would like to know any new functionality available in the latest upgrades and we have done lot of customization for Asset Procurement. And would like to go with Vanilla.
Can you please provide me some inputs about the Project (WBS element ) based Asset Procurement in SRM as standard.
Thanks and Regards,
Ramesh -
Probelem with passing parameters to function module
hey i am facing a problem to pass the parameters to function module.let me explain.. we cant pass the parameters which we are using in the select option statements directly to a function module called...i just wanna know if there is any way so that i can pass those values to a fnc module while passing it from select options
Hi,
You have to create a table type in SE11..
Check this sample table type PDSMAINT_MATNR_RNG_T...
Then use that table type in the importing parameter of FM..
PT_MATNR TYPE PDSMAINT_MATNR_RNG_T..
For which field you have created select-options..I will check if there is any existing table type in se11..
Thanks,
Naren -
Role of Changing & Tables in Functional Module Tab
Hi, Experts of Abap
Please tell me how Changing Tab & Tables Tab help us
IN ABAP DEVELOPMENT
thanks
RajeevWell, it sounds to me that these parameters are self explaining, but let me give a try anyway.
Changing: You can use this parameter to import some data into your functionmodule, change it and send it back to the caller. This way you don't need an import and export parameter.
Tables: In the early days, you could only transfer tabular data into a function module using the TABLES parameter. So instead of transferring (import and/or export) one record, you can now pass several records to the function module.
BTW: You could als use the F1 help for this, search on help.sap.com, or search SCN first, before even thinking about posting a standard question like this.
Maybe you are looking for
-
Does anyone aside from me see this as a valuable new feature? Not sure it's possible...
-
Hi, You can visit http://brandy.pararuk.com and see just 15 flying comets animated with KineticJS library. When I run it (viewing Windows Task Manager) I see that firefox.exe consumes 100Mb of memory every second up to full avaliable memory and hangs
-
Lost thumbnails on second monitor PS 13.04
I lose those pictures that go in the thumbnail boxes of the channels and layers windows when they are on my second monitor. But wehn I drag the window to the main monitor the empty thumbnail box fills in with the picture of the channel or layer. I'm
-
AGO function seems to ignore filter
I have a column that uses the ago function to calculate the value from a week ago for certain hours that are considered "high traffic". I'm trying to get the average of these high traffic hours this week and last week, but the ago function seems to b
-
How to update a textarea from an applet on Mac OS
Hi, i'm writing an applet and I would like to update a textarea, of the same html page, from my applet. I'm working on MAC OS (LiveConnect doesn't work). I've tried the solution that i've found at this address: http://www.rgagnon.com/ce/java-js.html,