Uncatchable exception: BSP calling Function Module
Hi all,
currently i'm facing a very weird problem. My application class calls function module
HR_INFOTYPE_OPERATION. Normally, in case of an error, the function module gives you back a return parameter. But if i call it from my BSP, the processing doesn't leave the function module. It directly throws an exception ERROR_MESSAGE_STATE instead of writing the message into parameter return.
If i call the function module with the same parameters from a report, it works fine and the error message is written to return parameter without throwing an exception.
What am i doing wrong? I don't want that exception and need to go on with filled parameter result.
Regards
Mark-André
Hi MA,
try using ERROR_MESSAGE in the exceptions list, like this.
CALL FUNCTION 'func_name'
EXPORTING
string = text
pos = position
IMPORTING
string1 = text1
string2 = text2
EXCEPTIONS
string1_too_small = 1
string2_too_small = 2
ERROR_MESSAGE = 3
OTHERS = 4.
Cheers
Graham Robbo
Similar Messages
-
Dear All,
in BSP, I want to call a Function Module.
the question is, how to display the result of Function Module into page layout, if I called a function module in/from Event Handler (onInitialization)
thanksmoving on from what Brian said - check the doco,
but in a nutshell, your function module will have probably export parameters or some results, you need to create some attributes in your BSP and then assign the values of the results from the function module to these attributes and then in the layout of the bsp you can use the <%= Attribute_Name %> syntax to display the value of your attributes whether in a textView or dropdownListBox etc.
Here's an example:
assuming your function module has en export parameter UName then you need to create an Attribute in the Attributes section of the BSP which you will assign the value of this export parameter UName to eg,
fm_UName TYPE STRING parameter to assign FM UName to
then in the event handler, after you have executed the Function Module assign the export parameter UName value to your local attribute with,
fm_UName = UName.
then in your layout, in the right place display the value of your parameter with the syntax,
<%= fm_UName %>
That's it.
Milan. -
Calling function modules from a BSP page
Hi all
How do we call function modules from a BSP page.
regards,
PaulOk, You want to construct the URL pointing to a BW report and want to execute the same when a button is clicked right? if yes here is the answer.
for constructing the BW query URL
http://<bwserver>:<port>/sap/bw/BEx?sap-language=ENCMD=LDOC&infocube=<cube anme>&query=<query name>&var_name_1=<variable name1>&var_value_ext_1=<variable value 1>&var_name_2=<variable name2>&var_value_ext_2=<variable value 2>
(for more info on how to pass parameters to BW query URL refer to the BW web designer reference manual which can be found at http://services.sap.com/bw)
and for executing this from a button use onclientclick property of htmlb:button along with window.open
<htmlb:button id ="BWQ"
onClientClick = "javascript:window.open("<%= BW_URL %>" );"/>
Hope this is clear.
Regards
Raja -
Calling function module in bsp
hi all,
please help me out. i am calling function module in bsp(in on initialization). i am calling 2d_matrix fm. but in output, its not showing the graphics. i think i have to do something in layout also, to connact the FM. Plz help me if you have any idea in bsp.
thanks in advance.thanks for ur reply.
but i am using it in layout and its giving me an error.
i have selected all the fields in on initialization.
and in layout i am displaying my data in tabular form. correspondigly i want to display same data in graphical format.
for that i have used a FM in on initialization(2d_matrix FM).
but how i link it in layout . so, that i can give me a output.
i can understand.
plz reply me.
thanks in advance. -
How to use Exceptions for a function module
Hi folks,
I have created a new function module.Its working fine, but i am not aware of using exceptions for a function module. I hav just declared an exception in the 'exception' tab. Could any body explain me how to use that in my FM source code....Thanks...Hi Shyam,
Have a look at this,
START-OF-SELECTION.
gd_file = p_infile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gd_file
has_field_separator = 'X' "file is TAB delimited
TABLES
data_tab = it_record
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc NE 0.
write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
skip.
endif.
Regards,
Sai -
Call function module in backgrouns task and in update task
Hi Gurus,Pls crear me on the " <b>Call function module in backgrouns task and in update task</b>".
how it works and waht is the link with LUW releated to these .
also heard that commit work statement aslo linked with this.
Pls clarfiy me with expalnation of code.Hi sridhar,
the explanation already given is correct and good. Small add-on:
All functions called during one LUW with addition IN UPDATE TASK are stored together with their actual parameters in a temporary memory area. The moment a COMMIT WORK is issued, the functions are released to be executed by a so-called update task which is running in the background. This explains why functions called in update task never return anything, no SY-SUBRC and no export or table parameters If a function called in update task raises an exception or runs into an error the calling user will get an express message informing about this. Also, all database updates done by this update process are rolled back to keep consistency.
This proceeding helps to keep database tables consistent and allows the user to keep on doing his work before all database updates are complete. You may have seen messages like "material will be changed" after saving. If you open the same material immediately, you'll get a message "object locked by...<yourself>". This means the update task is still running.
Regards,
Clemens -
Error BT616 when calling function module SXPG_COMMAND_EXECUTE in background
Hi All,
We use function module SXPG_COMMAND_EXECUTE with a custom command we defined in SM69 to move files in unix (mv command).
The function module call has worked fine for almost a year and recently we have been seeing an error (BT616) in our job lob (SM37) when the program is run in background. We have not been able to reproduce the error in foreground mode and it seems to be occuring only periodically in the background. (The appropriate SAP authorization objects where assigned to the batch job ID and the steps on the batch job.) We are in the process of setting up the trace flag and performing analysis on the trace log via ST11 to help identify the issue.
After perform analysis on SXPG_COMMAND_EXECUTE, the error is occurring when calling function module SAPXPG_END_XPG for exception 2, system failure, yet function module SAPXPG_END_XPG does not exist. I assume this is a program at the operating system level and is just a signature of the parameters to be passed to the operating system program.
Below is part of the SAP function module SXPG_COMMAND_EXECUTE that is failing.
* Now we have to wait for the termination of the external
* command if the caller wants us to.
IF TERMINATIONWAIT = 'X'.
CALL FUNCTION 'SAPXPG_END_XPG'
DESTINATION DESTINATION
IMPORTING EXITSTAT = STATUS
EXITCODE = EXITCODE
TABLES LOG = LOG
EXCEPTIONS COMMUNICATION_FAILURE = 1 MESSAGE MSG
SYSTEM_FAILURE = 2 MESSAGE MSG.
I performed a where used on function module SXPG_COMMAND_EXECUTE, and most of SAP programs call the function module with the parameter TERMINATIONWAIT = 'X', so I assume we should pass X as well.
Any ideas on what could be causing this issue?
Mike VondranI also remember I have this kind of issue, as I have some UNIX script at OS( UNIX) level . The problem was with the ID , as it dont have proper authorization at OS level ( UNIX ) . Please check this ID authorization. This could be the one of reasons if youre sure from SAP standpoint.
Hope thisll give you some guide line..
Thanks
Bye -
How to call function module from IP
Hi
I need to trigger the process chain from the input ready queries in Bex analyzer. I figured out that I need to call RSPC_API_CHAIN_START.
How do we go about in calling the above function module in IP.
Thanks in advance
IHi Matt
Thanks for your response, it was very productive at the right time as we saw our process chain running indefinetly. With selecting all chars to be changed, it ran just once with no errors.
what is TA ? I know rsplan- transaction code for the planning modeler.
Can you tell me how can we call function module in custom exit planning function.
Where should I embed the code
CALL FUNCTION 'RSPC_API_CHAIN_START'
EXPORTING
I_CHAIN = 'ZPC_CCATOPCA'.
I_T_VARIABLES =
I_SYNCHRONOUS =
I_SIMULATE =
I_NOPLAN =
IMPORTING
E_LOGID =
EXCEPTIONS
FAILED = 1
OTHERS = 2
thanks in advance -
Can we call functional module in a subroutine? Any example?
Can we call functional module in a subroutine? Any example?
sample code....
REPORT ZPL_BDC_PA30.
TABLES : PA0022.
DATA : V_PERNR LIKE PA0022-PERNR,
V_SLABS LIKE PA0022-SLABS.
DATA : FILENAME TYPE STRING.
DATA : BEGIN OF IT_DATA OCCURS 0,
PERNR LIKE PA0022-PERNR, "Personnel Number
SLABS LIKE PA0022-SLABS, "Certificate code
SLABS1 LIKE PA0022-SLABS, "Certificate code new
END OF IT_DATA.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 1 WITH HEADER LINE.
DATA : BEGIN OF IT_ERROR OCCURS 0,
POS LIKE SY-TABIX,
TEXT(40),
END OF IT_ERROR.
PARAMETERS : P_FNAME TYPE DXFIELDS-LONGPATH.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
I_LOCATION_FLAG = ' '
I_SERVER = '?'
I_PATH = I_PATH
FILEMASK = '.'
FILEOPERATION = 'R'
IMPORTING
O_LOCATION_FLAG = O_LOCATION_FLAG
O_SERVER = O_SERVER
O_PATH = P_FNAME
ABEND_FLAG = ABEND_FLAG
EXCEPTIONS
RFC_ERROR = 1
ERROR_WITH_GUI = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
START-OF-SELECTION.
FILENAME = P_FNAME.
PERFORM UPLOAD. "Uploading inputfile to internal table.
PERFORM VALIDATE. "validating the values
PERFORM POPULATE_BDC. "Populating bdc internal table
PERFORM ERROR_RECORDS
TABLES IT_ERROR. "Error records
*& Form bdc_fdata
FORM BDC_FDATA USING FNAM FVAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDFORM. " bdc_fdata
*& Form bdc_hdata
FORM BDC_HDATA USING PROGRAM SCRNO DYNBEGIN.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROGRAM.
IT_BDCDATA-DYNPRO = SCRNO.
IT_BDCDATA-DYNBEGIN = DYNBEGIN.
APPEND IT_BDCDATA.
ENDFORM. " bdc_hdata
*& Form upload
FORM UPLOAD .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = FILENAME
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE = VIRUS_SCAN_PROFILE
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH = FILELENGTH
HEADER = HEADER
TABLES
DATA_TAB = IT_DATA
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE I000(BCTRAIN) WITH 'FILE NOT UPLOADED'.
ELSE.
MESSAGE I000(BCTRAIN) WITH 'FILE UPLOADED'.
ENDIF.
ENDFORM. " upload
*& Form populate_bdc
FORM POPULATE_BDC .
LOOP AT IT_DATA .
PERFORM BDC_HDATA USING 'SAPMP50A'
'1000'
'X'.
PERFORM BDC_FDATA USING 'RP50G-PERNR'
IT_DATA-PERNR.
PERFORM BDC_FDATA USING 'RP50G-CHOIC'
'0022'.
PERFORM BDC_FDATA USING 'BDC_OKCODE'
'=MOD'.
PERFORM BDC_HDATA USING 'MP002200'
'2000'
'X'.
PERFORM BDC_FDATA USING 'P0022-SLABS'
IT_DATA-SLABS1.
PERFORM BDC_FDATA USING 'BDC_OKCODE'
'=UPD'.
CALL TRANSACTION 'PA30' USING IT_BDCDATA.
REFRESH IT_BDCDATA.
ENDLOOP.
ENDFORM. " populate_bdc
*& Form validate
FORM VALIDATE .
data : num like sy-tabix,
num1 like sy-tabix.
LOOP AT IT_DATA.
num = num + 1.
num1 = sy-tabix.
SELECT PERNR
FROM PA0022
INTO V_PERNR WHERE
PERNR EQ IT_DATA-PERNR.
ENDSELECT.
IF SY-SUBRC <> 0.
MOVE num TO IT_ERROR-POS.
MOVE 'Invalid Pernr' TO IT_ERROR-TEXT.
APPEND IT_ERROR.
DELETE IT_DATA .
ELSE.
IF IT_DATA-SLABS IS INITIAL.
MOVE num TO IT_ERROR-POS.
MOVE 'Certificate code is initial' TO IT_ERROR-TEXT.
APPEND IT_ERROR.
DELETE IT_DATA.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " validate
*& Form error_records
FORM ERROR_RECORDS TABLES IT_ERRORS.
FORMAT COLOR COL_GROUP.
WRITE : / 'Error in the following records : ' .
FORMAT COLOR COL_NEGATIVE.
LOOP AT IT_ERROR.
WRITE : / IT_ERROR-POS,
IT_ERROR-TEXT.
ENDLOOP.
ENDFORM. " error_records -
Customer 9000AAAE : Exception 7 in function module VIEW_KUAG2
Hi,
Hi all,
When I do the intercompany billing for STO (vf01), I got the system message attached below. The customer 9000AAAE is a ship to party and assigned to the ordering plant. It has the partner function SH. So can anybody kindly tell me where is wrong in the custmer master data or somewhere else according to the following message? Or where to find the VIEW_KUAG2? What does it mean?
Customer 9000AAAE: Exception 7 in function module VIEW_KUAG2
Diagnosis
During the attempt to read customer master record 9000AAAE,
an error occured which is not handled separately.
System Response
The billing document for this business transaction was not
created.
Procedure
If the error occured during a background job, you should try
to create the billing document online. If the error occured
online, the billing document can be created online. In any
case, you should check the customer master record. If you
cannot find any error in the master data, contact SAP.
Technical data
Tech. data details
Client 002
Group Number
Sales Document Number 0080100090
Item Number of the SD Document 000000
Schedule Line Number 0083
Counter in Control Tables 00
Message Identification VF
System Message Number 083
Output Type E
Message Variable 01 9900AAAE
Message Variable 02
Message Variable 03 VIEW_KUAG2
Message Variable 04
Group Type F
In our Intercompany, our ship to party is different from the Sold to, bill to and Payer. The configuration done as follows -
a. Defined Ship to Party as 9000AAAE
b. Define Sold to, Bill to, Payer as 9000AAAA
c. Assignd Ship to Sold to
d. Assigned Ship to customer to plant assignment in STO configuration in MM
e. Assigned internal customer of sales organization as 9000AAAA
Please help in this
Best Regards
GouthamHi,
Thanks for ur reply
I check the partner determination and the settings are as below -
a. Defined new account group for Sold to, Bill to and Payer
b. Defined new account group for Ship to
c. In the Ship to party account group, system only determine the ship to partner function
d. Customer defined in Sold to is assined as interneal customer to sales org
e. Customer defined in Ship to is assigned as customer for plant in Shipping data configure for STO in MM Configuration
Please provide more insights
Best Regards
Goutham -
What is the use of CALL FUNCTION MODULE - AT BACKGROUND TASK?
Hi experts,
I found Call functional module in background task will make the FM run at the next commit work as some people said. So I have some questions:
1 if we use COMMIT WORK commend, the pending FM will be called? If there are several FMs called at background task, what is the sequence of them? How many conditions will trigger the running of these FMs?
2 Where can I find the log of this pending FMs? In SAP library, it says there are 2 tables. But I checked these tables and can only find the FM name and user of it. And I can not understand content of these tables. It seems one is for the main information of FM, and the other is for the data of the FM, maybe the parameters.
3 If I call a FM in this way, Can I canncel it before the next commit work in some way?
Finally, thanks for reading and help.HI,
When the COMMIT WORK statement is executed, the function modules registered for the current SAP-LUW are started in the order in which they were registered. ROLLBACK WORK deletes all previous registrations for the current SAP-LUW.
If the specified destination is not available when COMMIT WORK is executed, an executable program called RSARFCSE is started in background processing. By default, this tries to start the function modules registered for a SAP-LUW in their destination every 15 minutes and up to 30 times. These parameters can be changed in the transaction SM59. If the destination does not become available within the defined time, it is recorded in the database table ARFCSDATA as the entry "CPICERR". The entry in the database table ARFCSSTATE is deleted after a standard period of eight days -
Third party system call function module/BAPI through RFC to update Z table
Dear Friends,
We have a third party system which directly inserts a Z table in SAP through its programming, which is an auditing issue.
We want the third party system should call function module/BAPI through RFC so that the Z table gets updated.
waiting for inputs..
Thanks,
Kumarif third party system is capable of making Remote Function call, then writing a Function module & making it remote enable is not difficult task in ABAP.
You may have to prepare specifications first to decide if third party system is going to Read, insert, update, delete records from Zee table. -
Why Service Call and why not call Function module Directly in WD ABAP
Hi,
I have created a Webdynpro applications and the logic requires calling avrious Function modules.
Do I need to create Service Call for each Function module or call them directly.
It would be great if you can suggest me under what cases I need to opt for Service call
For example, if I use 'RP_CALC_DATE_IN_INTERVAL', do I need to use Service call or call function module directly.
Note: I have searched forums but could not get the correct answer which I want
Thanks!The Service Call is really meant to be a wizard/time saver. It has the advantage that it can generate matching context nodes/attributes for the interface of the Function Module you are calling. However everything that the service call does can also be created by hand.
Personally I'm not a fan of what the service call wizard generates. Its good as a time saver or for beginners, but I find I prefer to touch up the code it generates anyway. I much prefer to create a nice reusable model class with its own unit test and then consume this model class (with the service call wizard) from WD. This model class might contain one or more function module calls depending upon what logic I need to access. -
Calling Function Module in Update Task
Hello Experts,
Can anyone let me know about
Calling Function Module in Update Task.
Why do we use this " In Update Task " ??
How do we Use ??
What is the Use... ??
Kindly let me know....
Thanks and Regards
Pramodhi,
Why do we use this " In Update Task " ??
The main update technique for bundling database changes in a single database LUW is to use CALL FUNCTION... IN UPDATE TASK.
How do we Use ??
A typical R/3 installation contains dialog work processes and at least one update work process. The update work processes are responsible for updating the database. When an ABAP program reaches a COMMIT WORK statement, any function modules from CALL FUNCTION... IN UPDATE TASK statements are released for processing in an update work process. The dialog process does not wait for the update to finish. This kind of update is called asynchronous update.
What is the Use... ??
Asynchronous update is useful when response time from the transaction is critical, and the database updates themselves are so complex that they justify the extra system load
Real time scenario.
Suppose a user wants to change an entry in a database table, or add a new one. He or she enters the necessary data, and then starts the update process by choosing Save. This starts the following procedure in the ABAP program:
Firstly, the program locks the database entry against other users, using the enqueue work process (or the message server in the case of a distributed system). This generates an entry in the lock table. The user is informed whether the update was successful, or whether the lock could not be set because of other users.
If the lock is set, the program reads the entry that is to be changed and modifies it. If the user has created a new entry, the program checks whether a record with the same key values already exists.
In the current dialog work process, the program calls a function module using CALL FUNCTION... IN UPDATE TASK, and this writes the change details as an entry in table VBLOG.
When the program is finished (maybe after further dialog steps), a COMMIT WORK statement starts the final part of the SAP LUW. The work process that is processing the current dialog step starts an update work process.
Based on the information passed to it from the dialog work process, the update work process reads the log entries belonging to the SAP LUW from table VBLOG.
The update work process passes this data to the database for updating, and analyzes the return message from the database. If the update was successful, the update work process triggers a database commit after the last database change and deletes the log entries from table VBLOG.
If an error occurred, the update work process triggers a database rollback, leaves the log entries in table VBLOG, flags them as containing errors, and sends a SAPoffice message to the user, who should then inform the system administrator.
The corresponding entries in the lock table are reset by the update work process.
Hope this is helpful, Do reward. -
Type error while calling function module with in FOX formula
Hi,
I am getting following error while calling function module from FOX Formula:
"Types of parameter DAY_IN () and variable J_CALDAY(D) are inconsistent"
Following is the code:
DATA I_CALDAY TYPE 0CALDAY.
DATA N_CALDAY TYPE 0CALDAY.
DATA KYF TYPE KEYFIGURE_NAME.
FOREACH I_CALDAY, KYF.
CALL FUNCTION SLS_MISC_GET_LAST_DAY_OF_MONTH
EXPORTING
DAY_IN = I_CALDAY
IMPORTING
LAST_DAY_OF_MONTH = N_CALDAY.
{KYF, N_CALDAY} = {KYF, L_CALDAY}.
ENDFOR.
Import parameter DAY_IN is of type sy-datum (that inturn is data element SYDATUM of data type DATS - same as 0CALDAY). Not sure why error is being thrown. Any idea? Thanks.
Edited by: SAP_BOY on Dec 4, 2009 5:26 PMHi,
I think It will not identify ,though you have (data element SYDATUM of data type DATS - same as 0CALDAY).Check it out by assigning it through a variable of type D.
Data I_CALDAY TYPE D.
Hope it may work out.
Regards,
Indu
Maybe you are looking for
-
What Multiple GPU Support??
I just purchased a very pricey Mac Pro for my company, with the intention of utilizing it's dual GPUs & processing power for fast turnaround times on video projects. Turning on GPU acceleration in Premiere, however, essentially renders this machine u
-
Alle Tastenkürzel verloren in Premiere Pro CC 2014
Ich habe ein eigenartiges Problem - bei Premiere Pro CC 2014 auf dem Mac (OS X Yosemite, aktuelle Version) funktionieren keine Tastenkürzel mehr - einschließlich Abspielen (Leertaste), Löschen (Rücktaste) oder Rückgängig (Command + Z). Einfach alles
-
Trying to recover an old PC error code...
Hello everyone. I am kinda a novice at this stuff but here is my problem. Friends 07 HP pavilion A6228x with win. vista home premium. He gave it to me to see if i could fix. windows would not boot up so i did a system recovery from the PC as i did no
-
Z3 rear glass cracked...again!
I dropped my orange 1 week old Z3 compact and had a replacement sent out by the insurance company. Within 12 hours 2 cracks had appeared on the rear and a phone call to the insurance company had them send out another phone as a replacment... It's be
-
Hi, can anyone help? I have a web-deployed form with a bean. The bean is derived from an example class posted in metalink as note 130431.1 "How to Read Local Files Using Web Deployed Forms? A step by step guide." I'm running forms 6i version 6.0.8.24