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!
Similar Messages
-
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.
ScottYes, you can call function modules.
-
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 -
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 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. -
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 -
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 -
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 -
Call ABAP function module from script?
Hi,
I have an ABAP function module, which works fine when I call it in a transformation.
Since I don't need to execute this function for each record but rather for each file I process, I would like to move the call from the DataFlow to a script in the WorkFlow. When I click on the 'functions' button the ABAP FM is available in my SAP Datastore, so I drag and drop it into my script. I also make sure to populate all required variables.
There are no error messages or warning when I check my job definition.
When I execute it, I get the following RFC error:
Function call <xxx ( abcd ) > failed, due to error <150413>: <RFC CallReceive exception <FUNCTION_NOT_FOUND>.>.
Is it just not possible to call an RFC enabled function module in SAP from a script or am I doing something wrong here?
Thanks,
Jan.Could you please let me know how I can call an abap function module from a transformation? (from abap xslt program). I know how we can call methods of a class from the transformations, but no idea how we can call function modules. Any suggestions or a sample code snippet towards this will be very useful for me.
Thanks,
Shashi. -
How to call a function module from a transformation
Hi,
Could somebody please let me know how I can call an abap function module from a transformation (abap xslt program). I know how to call the class methods from transformation, but how do i call a function module..?
Thanks,
Shashi.
Edited by: Shashi Kanth Kasam on Apr 8, 2010 12:45 PMYa. I can do that. But I don't want to use a class and a method to call that function module. Want to directly call function module from transformation. Is that possible..?
Thanks,
Shashi -
Calling Z function module from BSP page
hi,
i am calling a z function module from BSP application ROS_SELF_REG ,The z function module is inside a z function group,It does not give any sytnax error..but while running BSP application ,it is going into dump saying that Z function module is not found..Any idea why this is happening???Hi,
Check whether the Z function module is spelled correctly. Also try activating the whole function group and function module in se80 transaction.
Check whether the BSP application is calling the Z FM from the correct server/client where it is available.
Regards,
Harish -
Call a function module from CRM 5.0 via ITS to FICA
Hi
I want to call a function module in FICA (FICA is using sapgui) from CRM (IC-web) via ITS (Not integrated in FICA)
Is it possible and how should this be done???
If someone know how, please help
BR//JLgenerally RFCs should not have user dialogs.
any how to handle your case, you need ITS and since FICA is a WAS 6.20 system, you need to have a ITS installed for FICA system, without which you cannot do that.
alternatively you can mimic the functionality of the RFC by programming the same in a BSP and call this from CRM system
Regards
Raja -
How to call Z-Function module from BAPI_IDOC_INPUT1.
Hi All,
Process code is :BAPI and standard function module is BAPI_IDOC_INPUT1.
I am coding all the logic for the INBOUND IDOC in the Z-Function module ZIDOC_INPUT_ZGOODSMOVEMENTOIL.
My requirement is:
Process code fires the inbound function module BAPI_IDOC_INPUT1, this in turn call the function module ZIDOC_INPUT_ZGOODSMOVEMENTOIL.
How can i call ZIDOC_INPUT_ZGOODSMOVEMENTOIL from BAPI_IDOC_INPUT1 to process the idoc.
Thanks in Advance.
Regards,
UmeshHi Krush,
Thanks for your reply,
Now i can trigger the idoc.
I have one more problem that if i want to add another z-segment to the attached idoc type its not allowing me its saying that it is already generated and cannot be changed.
if i am generating the BDBG transaction its not asking for specific segment and it automatically takes the segment and generates the function module.
How i can add an additinal z-segment to the idoc type and it generate through BDBG transaction to include in inbound function module?
Thanks in Advance.
Regards,
Umesh -
Is it possible to call Normal function Module from WD4A , Not RFCs
Is it possible to call Normal function Module(FM) from WebDynPro for ABAP , Not RFCs
There is no difference, unless you are specifically calling the RFC to connect to another system. If so, then you need to add the DESTINATION keyword to the function call and specify the destination name. This name must be defined in SM59. But, if you are not going to another system, you can call the RFC the same way you call the regular function module.
REgards,
Rich Heilman
Maybe you are looking for
-
that will disable a USB port on my Mac? anyone know how to fix it?
-
Problem while deploying ADF application to standalone WLS server
Hi, I am facing a problem while deploying ADF application to standalone WLS Server. Following is the error message that I am getting. [07:24:03 PM] ---- Deployment started. ---- [07:24:03 PM] Target platform is (Weblogic 10.3). [07:24:07 PM] Retri
-
Got a new iphone, lost half of pictures
I upgraded my iphone, and some of my photos uploaded in photo stream, but I lost over half of them. Is there a way I can get the other half back?
-
Issue with encrypted stdin in solaris
hi all .. i've found a following problem: i need to build .bin file installer for customer .. i am used to use following way: cat script.sh data.tgz > installer.binbut when trying from within script cut data.tgz part, returned file is encrypted and i
-
What size External HD for Macbook Pro 2.4Ghz with 250GB Internal HD
I am looking at getting the Macbook Pro 15-inch 2.4Ghz with 250GB Internal HD. What is the minimum size External HD I need if I want to use Time Capsule with this machine?