Validating import parameters in Functin module
Hi Eveyone,
Anybody let me know how to validate import parameters to Function module,
if the sy-subrc not equal to 0, what i have to do.
Hi Madhavi,
When you pass some parameters to any Function Module , i.e. Import Parameters, First thing we do is validation.
Check for the respective data lements and validate them, If sy-subrc fails, then throw an exception, or raise an error message, by using standard procedure of structure type BAPIRET2 (For RFC's) or throw any respective error message.
Hope this will resolve your Query.
Reward alll the helpful answers.
Regards
Nagaraj T
Similar Messages
-
Importing parameters in Function Module SD_VBFA_ARRAY_READ_VBELV
Hi All,
Please let me know the use of importing parameters in the Function Module SD_VBFA_ARRAY_READ_VBELV.
The importing parameters are,
I_BYPASSING_BUFFER
I_REFRESH_BUFFER
I'm having problem of memory overflow in the function module so I thought these importing parameters may help me.
Kindly explainn me the use of these importing parameters and tell me whether they help m out to avoid memory overflow problem.
Thanks a lot in advance,
Rama KrishnaHello Rama
If you bypass the buffer the fm will always read directly from the DB.
And if you refresh the buffer the buffer is cleared and will be filled again with every call of the fm.
Regards
Uwe -
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 -
Get Import Parameters of a Function Module
Hi,
Is there a way to find the import parameters and their Data Type of a Function Module in any Table??
For example, i know i can find the name and the include of the Funtion Module in TFDIR. Is there anywhere i can find the list of Import Parameters and their Data Types??
Thanks and Regards,
Kaeyuryou can use
Data: lv_type type c.
clear:lv_type.
DESCRIBE FIELD p_bukrs TYPE lv_type.
It will return C as its type C and p_bukrs is selection screen parameter.
hope this helps. -
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. -
Export/Import Parameters dissapear when using user-exit
I am using some import/export parameters in a dynamic action when I create a new record (infotype). I am also using a user exit to avoid modifying BEGDA and ENDDA when I modify the record (IPSYST = 'MOD'). Using this user-exit, the parameters dissapear from memory so the dynamic action does not execute well. What can I do to use the user-exit?? Anything to add?
In the dinamic actions when I create, I delimit records on infotype with export/import parameters defined in infotype Module Pool. When I delete, I avoid deleting the record if it is not the last one. With the user-exit the modification of begda endda in infotype is not allowed. If I use the user-exit, the dinamic actions which use export/import parameters, don't work.
I have tried to do in MP what I do in user-exit but it is not easy because I haven´t got in PSAVE what I want. -
Hi
Im going to use FM: CS_BOM_EXPL_MAT_V2 and I want to only pass WERKS, but when I execute FM is gives exception as CALL_INVALID.
I saw all the Import parameters are Optional, but I think I need to pass more inputs to FM.
Please let me know what are MINIMUM input parameters required to run this FM
ThanksHi
In my requirement, there are range of WERKS and MATNR which has to be given from selection screen, where as In CS_BOM_EXPL_MAT_V2 function module I can only give single value for WERKS and MATNR.
Can any one guide me how can I implement this? -
Import parameters in a FM with a previous date
Dear experts,
I need to default the import parameters in one of my function modules with a previous date.
For eg: if i hiit F8 on my Z** function module the default value should be YESTERDAYS date NOT todays date.
How can i do this?
Thanks
RickyCheck in the code whether the import parameter was supplied, and if it wasn't, then calculate the value by deducting 1 from today's date.
So something like:
IF I_DATE IS NOT SUPPLIED.
I_DATE = SY-DATUM - 1.
ENDIF.
Edit: Upon re-reading your question, I see that you want to set the default only in the FM test environment... off the top of my head, I don't know a way to calculate the previous day like that. But the above code works as setting a default if the FM is called from a program - provided the parameter is set up as 'Pass by value'.
Edited by: Tamas Hoznek on Apr 21, 2011 12:07 PM -
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.
SundaresanHi,
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 -
VBA and RFC - How to deal with tables in export/import parameters
Hi,
maybe one of you can support me...
I have a couple of vba modules reading and writing data to SAP by means of function modules. As usual, they use export and import parameters as well as tables (in the table section). They work very well.
Now, I want to execute some newer function modules and they don't use tables in the table section (because they're obsolete nowadays), instead they expect the tables as export resp. import parameters. I tried it in a couple of ways, without any success.
Has anybody tried this before? And if so, do you mind share some snippets?
Best regards, ThomasHello Thomas,
I think we discussed the same problem here, but unfortunately without any result. Please, take a look at this post and let us know.
Cheers
Stefan -
How to call an eCATT programmatically with import parameters
Hi there,
I am using function module ECATT_EXECUTE to call test scripts from within ABAP test code, like below. Unfortunately, I am not able to pass my actual import parameter values. It seems that the interface does not provide a way to pass import parameters to the eCATT.
Although posted in November, this is still an issue for me. Does anybody know an answer?
call function 'ECATT_EXECUTE'
exporting
to_execute = lt_script
display_log = space
i_supress_output = 'X'
importing
executed = lt_executed
logid = ls_logid
trace_prot = lt_trace
exceptions
nothing_to_do = 1
too_many_scripts_called = 2
others = 3.
Does anybody reading this have a solution?
Thanks and regards,
Rüdiger
Edited by: Rüdiger Plantiko on Jan 17, 2008 3:05 PM
Edited by: Rüdiger Plantiko on Jan 17, 2008 3:05 PMHello Rüdiger,
direct passover would be fine - well, I've come to get used to finding workarounds in SAP though. Maybe, the function module will support the missing parameters in some forthcoming release.
Btw I switched over to tables ECTC_VAR / ECTC_DATA and pass obj_type = 'ECTC' to ECATT_EXECUTE, since test configurations can directly be executed.
You don't happen to know what has to be done, if the call of ECATT_EXECUTE results in a dump? After correctly executing the test configuration. Looks like eCatt tries to put the resulting log to nowhere. Perhaps I have to initialize some kind of a log receiver first or set some option in the start profile? I passed DISPLAY_LOG = SPACE, and SUPPRESS_OUTPUT = 'X'.
Dump was:
Laufzeitfehler OBJECTS_OBJREF_NOT_ASSIGNED
Datum und Zeit 05.03.2008 17:37:00
Zeile Quelltext
1 METHOD http_send_and_receive .
2
3 DATA: l_errortext TYPE string.
4 DATA: l_http_subrc TYPE sy-subrc.
5 *----------------------------------------------------------------
6
>>>>> im_http_client->request->set_data( data = im_request ).
8
Aktive Aufrufe/Ereignisse
Nr. Art Programm Include Zeile
Name
6 METHOD CL_HTTP_TESTZONE_RESULT=======CP CL_HTTP_TESTZONE_RESULT=======CM00Q 7
CL_HTTP_TESTZONE_RESULT=>HTTP_SEND_AND_RECEIVE
5 METHOD CL_HTTP_TESTZONE_RESULT=======CP CL_HTTP_TESTZONE_RESULT=======CM00O 16
CL_HTTP_TESTZONE_RESULT=>HTTP_REQUEST_NEWRESULTID
4 METHOD CL_HTTP_TESTZONE_RESULT=======CP CL_HTTP_TESTZONE_RESULT=======CM00T 34
CL_HTTP_TESTZONE_RESULT=>SEND_TO_RESULT_REPOSITORY
3 METHOD CL_APL_ECATT_LOG_TO_RESREP====CP CL_APL_ECATT_LOG_TO_RESREP====CM001 400
CL_APL_ECATT_LOG_TO_RESREP=>GET_LOG_DATA
2 FUNCTION SAPLECATT_EXECUTE LECATT_EXECUTEU01 888
ECATT_EXECUTE
1 EVENT ZDSD_SL_VIA_CATT ZDSD_SL_VIA_CATT 26
START-OF-SELECTION
Regards + have a nice weekend,
Matthias -
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 -
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. -
hi all,
when i call a function module in a program, why are the import paramters (which are export parameters of FM)commented out initially?
thanksLets use an example. Look at the function module GUI_DOWNLOAD.
*"*"Lokale Schnittstelle:
*" IMPORTING
*" REFERENCE(BIN_FILESIZE) TYPE I OPTIONAL
*" REFERENCE(FILENAME) TYPE STRING
*" REFERENCE(FILETYPE) TYPE CHAR10 DEFAULT 'ASC'
*" REFERENCE(APPEND) TYPE CHAR01 DEFAULT SPACE
*" REFERENCE(WRITE_FIELD_SEPARATOR) TYPE CHAR01 DEFAULT SPACE
*" REFERENCE(HEADER) TYPE XSTRING DEFAULT '00'
*" REFERENCE(TRUNC_TRAILING_BLANKS) TYPE CHAR01 DEFAULT SPACE
*" REFERENCE(WRITE_LF) TYPE CHAR01 DEFAULT 'X'
*" REFERENCE(COL_SELECT) TYPE CHAR01 DEFAULT SPACE
*" REFERENCE(COL_SELECT_MASK) TYPE CHAR255 DEFAULT SPACE
*" REFERENCE(DAT_MODE) TYPE CHAR01 DEFAULT SPACE
*" EXPORTING
*" VALUE(FILELENGTH) TYPE I
*" TABLES
*" DATA_TAB
*" EXCEPTIONS
*" FILE_WRITE_ERROR
*" NO_BATCH
*" GUI_REFUSE_FILETRANSFER
*" INVALID_TYPE
*" NO_AUTHORITY
*" UNKNOWN_ERROR
*" HEADER_NOT_ALLOWED
*" SEPARATOR_NOT_ALLOWED
*" FILESIZE_NOT_ALLOWED
*" HEADER_TOO_LONG
*" DP_ERROR_CREATE
*" DP_ERROR_SEND
*" DP_ERROR_WRITE
*" UNKNOWN_DP_ERROR
*" ACCESS_DENIED
*" DP_OUT_OF_MEMORY
*" DISK_FULL
*" DP_TIMEOUT
*" FILE_NOT_FOUND
*" DATAPROVIDER_EXCEPTION
*" CONTROL_FLUSH_ERROR
call function 'GUI_DOWNLOAD'
exporting
* BIN_FILESIZE =
filename =
* FILETYPE = 'ASC'
* APPEND = ' '
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
tables
data_tab =
* EXCEPTIONS
* FILE_WRITE_ERROR = 1
* NO_BATCH = 2
* GUI_REFUSE_FILETRANSFER = 3
* INVALID_TYPE = 4
* NO_AUTHORITY = 5
* UNKNOWN_ERROR = 6
* HEADER_NOT_ALLOWED = 7
* SEPARATOR_NOT_ALLOWED = 8
* FILESIZE_NOT_ALLOWED = 9
* HEADER_TOO_LONG = 10
* DP_ERROR_CREATE = 11
* DP_ERROR_SEND = 12
* DP_ERROR_WRITE = 13
* UNKNOWN_DP_ERROR = 14
* ACCESS_DENIED = 15
* DP_OUT_OF_MEMORY = 16
* DISK_FULL = 17
* DP_TIMEOUT = 18
* FILE_NOT_FOUND = 19
* DATAPROVIDER_EXCEPTION = 20
* CONTROL_FLUSH_ERROR = 21
* OTHERS = 22
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Notice that the IMPORTING parameters of the funcion module are actually the EXPORTING parameters when calling the function module. These parameters are commented out only when mark as optional or have a default value assigned to them.
Notice the EXPORTING parameters of the function module,
there is only one, FILELENGTH. These are always commented out by default, because you don't need to bring them into the calling program. Notice that when calling the function module, it is coming back thru IMPORTING parameter.
Tables parameters work just like IMPORTING paramaters where they can be optional. If they are optional, they will be commented.
Does this make sense now?
Regards,
Rich Heilman -
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
-
Extent of Address Book sync?
Will every address, phone no., etc. on each Address Book entry sync on an iPhone? What about the notes at the foot of each entry? flat-screen iMac Mac OS X (10.4.10)
-
MDX not working in Power View on sharepoint 2013
I have this MDX statement below that should be able to dynamically give me a % of total for any dimension. IN power View (sharepoint 2013) I am getting an error. It works in Excel and works in the AS browser but will not seem to work in power v
-
Connecting Vox ToneLab to Mac Mini
I have a Vox ToneLab that I would like to use to record guitar in Garageband on my Mac Mini. I believe that I could use an iMic to accomplish this, however, I am a little confused as to what cables or adapters I would need. The ToneLab has a 1/4" pho
-
WebDynpro ABAP : Error when calling ME23N with URL
Hi all, I have some problem with my WDA. I have an ALV in web dynpro and it displays Document number for Purchase Order. When a user clicks on it, we call SAP WEBGUI using ITS and I create dynamically URL to display the document. But I can't set the
-
Import Vodeo files in XAVCS format
Hi, it is the first time working with lightroom 5. I have problems in importing Video files in the format XAVCS from my Sony RX100M3. Lightroom does not recognize that format and does not show them in the import dialogue. Any idea what can be done. T