Can you call a function module from within a smartform?
I was told that yu can not call a function module from a smartform - that does not make sense to me because you can do tons of ABAP within a smartform.
Well - can you?
Thanks.
Scott
Yes, you can call function modules.
Similar Messages
-
Calling a function module from within a transformation routine
I created a routine within a transformation and experience the following weird behavior now:
When I call a function module within that routine, the load fails with the following error message:
Exceptions in Substep: Rules
When I click on the button next to this text, it point me to my function module call.
What I do not understand is, that the following two scenarios work fine:
- Having the same function call (with fake values) in a plain ABAP program works beautilfully
- If I copy the content of my function module directly into my transformation routine, everything works fine as well
I am now wondering whether the routine does not "see" the function module I am calling. The module resides in a different package. Is that a problem? Do I have to include something first?
Here is the code that calls my FM (
CALL FUNCTION 'Z_CA_CONVERT_US_COST'
EXPORTING
PSOURCEVAL = SOURCE_FIELDS-/BIC/USFRZMFC
PSOURCEUOM = SOURCE_FIELDS-BASE_UOM
PUSITM = SOURCE_FIELDS-/BIC/USITM
PTARGETUOM = PRODUCTION_UOM
IMPORTING
PTARGETVAL = RESULT
EXCEPTIONS
CONVERSION_NOT_MAINTAINED = 1
PARTNO_NOT_FOUND = 2
OTHERS = 3.
Thanks a lot for your help. Points will be assigned.
DennisGood catch, BI Learner. This was exactly it: when assigning the values from SOURCEFIELDS directly to the import/export parameters, you have to make sure that the types are EXACTLY the same, otherwise it will not work (the routine stops with an error when calling the FM, but there is no dump).
Therefore, to solve my problem, I created the declarations precisely as expected by the FM and assigned the values to these fields:
DATA:
SOURCEVAL TYPE /BIC/OIINVQTY,
SOURCEUOM TYPE /BIC/OIUSUOM,
USITM TYPE /BIC/OIUSITM,
TARGETUOM TYPE /BIC/OIUSUOM,
CONVERTED_COST TYPE /BIC/OIINVQTY.
DATA PRODUCTION_UOM TYPE /BIC/OIUSUOM.
" get the Production UOM
SELECT SINGLE I~/BIC/USPRDUOM
FROM /BIC/PUSITM AS I
INTO PRODUCTION_UOM
WHERE I~/BIC/USITM = SOURCE_FIELDS-/BIC/USITM AND I~OBJVERS = 'A'.
IF ( SY-SUBRC = 4 ). " no records found
"RAISE PARTNO_NOT_FOUND.
RAISE EXCEPTION TYPE CX_RSROUT_SKIP_RECORD.
ENDIF.
" load the parameters
SOURCEVAL = SOURCE_FIELDS-/BIC/USFRZMFC.
SOURCEUOM = SOURCE_FIELDS-BASE_UOM.
USITM = SOURCE_FIELDS-/BIC/USITM.
" then you can call the FM
CALL FUNCTION 'Z_CA_CONVERT_US_COST'
EXPORTING
PSOURCEVAL = SOURCEVAL
PSOURCEUOM = SOURCEUOM
PUSITM = USITM
PTARGETUOM = PRODUCTION_UOM
IMPORTING
PTARGETVAL = CONVERTED_COST
EXCEPTIONS
CONVERSION_NOT_MAINTAINED = 1
PARTNO_NOT_FOUND = 2
OTHERS = 3.
" ... [do the rest]
Thanks for your help,
Dennis -
Can we call a function module from a structure?
Hi everyone,
I have a requirement to send an idoc. I have to populate a segment with signing authority . I have to create a custom table for that and call the function module. How do i do that ?
Thanks in advance,
VenkatHi!
When you have an outbound IDOC, then there is a function module to create the IDOC and fill the segments. Often the function name follows the form MASTERIDOC_CREATE_NNN with NNN = IDOC-name.
Inside this function module should be an user exit to add some own coding.
Regards,
Christian -
Call a function module from within a sapscript form
not being an ABAPer i have the task of changing the Invoice SAPScript form.
i have made the necessary changes - just about... but they have asked that i include the VAT Number on the Invoice....
not too bad apart from different company codes have different vat numbers...
not knowing a better way to retrieve data from table V_001_B - i am using the print program -RFKORD50, is there a better way of getting the VAT Number by company code? I figured if i could call the FM to return the value, all well and good.., they do not want the print program changed if possible so was looking at alternate methods....
or am i trying to reinvent the wheel here?thank you both! helpful answers! :o)
anyway!
i have written the program which is called from the SAPScript:
/: PERFORM GET_VATNUMBER IN PROGRAM ZFI_F140_OPERATIONS
/: USING &BKPF-BUKRS&
/: CHANGING &VATNUMBER&
CE VAT Registration No : &VATNUMBER&
REPORT zfi_f140_operations.
FORM get_vatnumber TABLES in_par STRUCTURE itcsy
out_par STRUCTURE itcsy.
DATA: lv_co_code TYPE bukrs,
lv_vat_no TYPE stceg.
READ TABLE in_par WITH KEY name = 'BKPF-BUKRS'.
MOVE in_par-value TO lv_co_code.
SELECT SINGLE stceg FROM t001
INTO lv_vat_no WHERE bukrs = lv_co_code.
out_par-name = 'VATNUMBER'.
WRITE lv_vat_no TO out_par-value.
CONDENSE out_par-value.
MODIFY out_par INDEX 1.
ENDFORM.
it is not working and i cannot work out why...
i have not been ABAPing for very long but have had a go....
any thoughts as to what i have done wrong?
or point me where i should be looking? thank you! -
Calling a function module from APO Macro
Hi,
Can I call a function module from a macro directly without going through the user exit? If so, how should I pass the parameters to the function module? I don't have to get the results back to macro.
RegardsHi Asokan - you can call a function module directly from a macro providing it is designed to be called from a macro. For example if you are in the Macrobuilder and use the menu path Edit -> Edit User Function then you will get a list of existing function modules that you can call directly by inserting a Operator/function into your macro. If you want to call a function module not listed in the User Function drop down list then you will either need the user exit or create a custom function module as a wrapper and register the wrapper function module in the Edit User Function menu path. Calling a function module will always return a value - but you can choose to ignore that value depending on how you build your macro.
Regards
Andy -
How to call a function module from the Web Template?
Hi all,
how can I call a function module from a BI 7.x web template and then show the result of the FM on the web template?
Many thanks for your hints.
Regards, NilsHi!
I am too working on a similar issue.
Probably this helps:
Re: Calling a function module from a Web Template
Regards,
Sri -
How do you call a function module in a web dynpro application ?
Why do you delete my postings ?????????????????????????????
pls see subject
Edited by: Ilhan Ertas on Apr 1, 2009 4:51 PM
Edited by: Ilhan Ertas on Apr 1, 2009 4:52 PMIts not me deleting them. Perhaps a different moderator or a technical problem within SCN itself.
Someone might be concerned about your question because it is very basic.
You can call a function module from WD the same way you did in any ABAP program - with the CALL FUNCTION syntax. There is a service call wizard that will generate a matching context and calling code for you - but it is just a helper, code generator. Everything it does can be done by hand as well (and often better than the generator). -
Can i call a function module of SAP?
Hi, i have a question... Can i call a function module of SAP... I need print a document from a device, can i call the function module of SAP in order that me it prints it?
Thanks,Hi Victor,
you can use the GenericSync Example of the MDK. This calls the Module to verify the user directly. Generic Sync is exactly for that purpose: call a BADI directly and no usage of SyncBO. Be aware, that you - out of the box- sync your app data as well at that moment, because a sync runs both - generic and smartsync. Even worse: even when you have nothing to sync in Generic Sync - so nothing to print - it will call the function module for generic sync as long as it is registered.
Well, anyway, this is the way to call a function module separate.
If it works with you rparticular print module? I have no idea, but if this is a normal function module - well, it should be ok.
Hope this helps.
Regards,
Oliver -
Can one call a function module in Calculated Key Figure?
Can one call a function module in Calculated Key Figure? If yes how, if not, what is the solution if formula does not suffice?
I want to convert duration which is in seconds to Duration in Hours and Minutes. There is a function module for doing it. Not sure how to do it in a formula.One option you have is a Virtual Key Figure and User Exit to use the Function Module to convert the time from seconds to HH:MM. Here are two documents on this subject to help you create them, based on the technology your comfortable with:
[Implementing Virtual Key Figure/ Characteristics Makes Query More Dynamic|https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/e051fda8-71a9-2a10-ac9e-8d17414a8c8c&overridelayout=true]
[Step By Step Process for Virtual Key Figures and Characteristics through BAdi|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/60e34f63-f44c-2c10-488e-c89b04e0ca7c&overridelayout=true] -
Can we call a Function Module with in a loop
Hi,
Can we call a Function Module within a loop . Does it reduces the performance.
Can you please guide regarding this.
With Best Regards
Mamatha.hi Mamatha,
You can call .. but it is better to avoid calling it within a loop...
Loop at it_tab.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = it_tab-vbeln.
importing
output = it_tab-vbeln.
endloop.
Regards,
Santosh
Message was edited by:
Santosh Kumar Patha -
Calling a function module from a Web Template
Hi,
I need to call a function module from a web template. Any pointers on how i can do this ? Is this even possible ?
Thanks
ShaileshHi Rael,
We were finally able to call a FM module from the Web. The trick as Heike suggested was to create an ABAP class which inherits from CL_RSR_WWW_HELP_WINDOW. Then you should modify the process_cmd method of this new class in order to call the FM. Now use this class to create a help service. In case you need to pass any parameters to the FM, you will need to pass them as additional parameters while calling the help service.
An example is below.
CMD=PROCESS_HELP_WINDOW&HELP_SERVICE=ZBOOKMARKING&TEXT=mytext&URL=myurl
Where mytext and myurl were the parameters i pass to my FM and ZBOOKMARKING is my help service.
Thanks a Lot to Heike for his help on this !!
Shailesh -
Can we call a function module in ADHOC query
Hi
Can we call a function module in ADHOC query if yes how.
Also we ned to know how to call a function module in SAP query.
An early responce is appreciated.
Thanks and best regards
RajeevOkay as far as I understand your aim is:
To fill a field in the output list with a value that is based on the current line information and calculated by a function module
So go to SQ02 and create an additional field in the InfoSet.
You can refer in the coding to the technical names you can see in the left tree window like P0000-PERNR.
More information is avaiable in the Help part look for additional field in SQ02.
Regards,
Michael -
How to call a function module from a workflow ? ?
hi all,
i have to call a function module from an workflow, i got a hint from someone that i have to enhance an object and then write and methode, in this methode i can call that function module. I dont know even how to go for it.
Can anyone suggest that how to go for it ?
thanks.
raman khurana.Hi Raman Khurana,
Please go through the links it might be helpful , notsure
http://help.sap.com/saphelp_nw2004s/helpdata/en/c5/e4af8b453d11d189430000e829fbbd/content.htm
http://www.abapcode.info/2007/07/standard-function-module-text.html
http://it.toolbox.com/wiki/index.php/SAP_Workflow
Regards,
Sreekar.Kadiri. -
How to call a function module from debugger?
Hi all,
i just wanted to know whether we can call a function module from a debugger ,
if yes how ?Hi Laxmikanth,
How ur going to call a function module which is not present in program???
In debugging mode u can change the values of variables,put break points and watch points,but i thnk its not possible to call a function module(not present in program) while debugging .
Please share with us if u have any solution...
Regards,
lakshman. -
CNTL_ERROR while calling a function module from Java webdynpro
I am calling a RFC function module from javawebdynpro app
which inturn calls a function module performing BDC on CAPP transaction. When I run this from SE37 of the same system or a different system everything works fine. But when called from Java webdynpro app, it raises a CNTL_ERROR exception and creates a short dump.
Any help on this is highly appreciatedGood catch, BI Learner. This was exactly it: when assigning the values from SOURCEFIELDS directly to the import/export parameters, you have to make sure that the types are EXACTLY the same, otherwise it will not work (the routine stops with an error when calling the FM, but there is no dump).
Therefore, to solve my problem, I created the declarations precisely as expected by the FM and assigned the values to these fields:
DATA:
SOURCEVAL TYPE /BIC/OIINVQTY,
SOURCEUOM TYPE /BIC/OIUSUOM,
USITM TYPE /BIC/OIUSITM,
TARGETUOM TYPE /BIC/OIUSUOM,
CONVERTED_COST TYPE /BIC/OIINVQTY.
DATA PRODUCTION_UOM TYPE /BIC/OIUSUOM.
" get the Production UOM
SELECT SINGLE I~/BIC/USPRDUOM
FROM /BIC/PUSITM AS I
INTO PRODUCTION_UOM
WHERE I~/BIC/USITM = SOURCE_FIELDS-/BIC/USITM AND I~OBJVERS = 'A'.
IF ( SY-SUBRC = 4 ). " no records found
"RAISE PARTNO_NOT_FOUND.
RAISE EXCEPTION TYPE CX_RSROUT_SKIP_RECORD.
ENDIF.
" load the parameters
SOURCEVAL = SOURCE_FIELDS-/BIC/USFRZMFC.
SOURCEUOM = SOURCE_FIELDS-BASE_UOM.
USITM = SOURCE_FIELDS-/BIC/USITM.
" then you can call the FM
CALL FUNCTION 'Z_CA_CONVERT_US_COST'
EXPORTING
PSOURCEVAL = SOURCEVAL
PSOURCEUOM = SOURCEUOM
PUSITM = USITM
PTARGETUOM = PRODUCTION_UOM
IMPORTING
PTARGETVAL = CONVERTED_COST
EXCEPTIONS
CONVERSION_NOT_MAINTAINED = 1
PARTNO_NOT_FOUND = 2
OTHERS = 3.
" ... [do the rest]
Thanks for your help,
Dennis
Maybe you are looking for
-
I have a computer that has never been able to install iTunes. It is running Win 7 Home Professional. I have downloaded multiple versions of iTunes over the last year and I get the same error message: This installation package could not be opened.
-
[SOLVED] Gnome 3.2, gdm only show the default wallpaper
Hi all, I just upgrade to gnome 3.2 on 2 machines, for the first one I got a glib2 from AUR so it do not work first (it's now solve) but for the second one I still can't login into gnome. Gdm only show the default wallpaper and a cursor. Here is the
-
"No Bootable Device" after failed Boot Camp installation (Windows 8 - 1TB Fusion Drive)
On my new iMac /w a 1TB Fusion Drive, I tried to install Windows 8 (still technically unsupported) using the following method: http://arstechnica.com/information-technology/2012/11/no-support-no-problem-inst alling-windows-8-on-a-mac-with-boot-camp/
-
Programatically generating an event
Hi All, Perhaps I have tunnel vision here, but can't figure why this isn't an easy fix. Problem: I have an event structure with 7 events. One of these events (#3) removes a line of data from a table (indicator). It is activated on a value change of t
-
Xperia Z1 Android 4.3 14.2.A.0.290 firmware ROLLING NOW
Xperia Z1 Android 4.3 14.2.A.0.290 firmware Update Rolling Officially. Update available and confirmed in India, UK, Sweden, Finland, Singpore. Confirmed on Both C6902 and C6903 Source - http://www.xperiaguide.com/2013/12/16/xperia-z1-z-ultra-android