‎2007 Nov 28 7:02 AM
Hi Gurus ,
I need some clarification in a function module . i need to handle errors in a function module .
iam writing an extractor for open item (ie using table bsid ,ztable )
in some scenarios , some records of bsid are not matching ztable entries .
just i want to capture that records and write it to a flat file .
Can any one help me out on this how to do it .
Thanks ,
Shankar.
‎2007 Nov 28 7:07 AM
HI Gurus ,
Do we have any return paramenters in a function module like we are having a BAPI .
Kindly clarify .
Shankar .
‎2007 Nov 28 7:10 AM
Hi,
Refer this code.
*--Call function to download the error file
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = file
filetype = 'ASC'
TABLES
data_tab = pr_eord_error
EXCEPTIONS
file_write_error = 1
no_authority = 5
unknown_error = 6
access_denied = 15
file_not_found = 19.
CASE sy-subrc .
WHEN '1'.
Unable to write the error file.
MESSAGE e505.
WHEN '2'.
No authority to write the file.
MESSAGE e506.
WHEN '3'.
Access Denied.
MESSAGE e507.
WHEN '4'.
File not Found.
MESSAGE e503.
ENDCASE.
Regards,
Prashant
‎2007 Nov 28 9:38 AM
Hi Gurus ,
When i try to use gui_download in my extractor , my code is going for a dump .
I cant find whts the actual problem .
kindly advice me on the same .
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught
in
procedure "Z01_FBIWI_AR_EXTRACTOR" "(FUNCTION)", nor was it propagated by a
RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
One of the database selections included a database Commit.
The selection was then supposed to continue. Before a
database commit, however, all outstanding database selections
must be concluded.
Possible causes in the application program:
While a read process from a database cursor is taking place
(within a loop SELECT/LOOP/EXEC SQL or before a FETCH command),
one of the following statements is used:
- MESSAGE (apart from MESSAGE S...)
- COMMIT WORK
- ROLLBACK WORK
- BREAK-POINT
- WAIT
- CALL FUNCTION ... DESTINATION (synchronous RFC)
- CALL FUNCTION ... STARTING NEW TASK
RECEIVE RESULTS
CALL DIALOG
CALL SELECTION-SCREEN
CALL TRANSACTION
CALL SCREEN, or any other statement that results in the display of a
new screen
henever a program runs in debugging mode, a "COMMIT WORK" can
ossibly be triggered during database selection. This abnormal
ermination can also occur in debugging mode even with a correct
rogram.
"COMMIT WORK" during debugging may be due to the following reasons:
. A program or screen was regenerated during debugging
and updated in the database.
. Each user needs a separate process in debugging mode, but
the number of available processes is restricted. If this
limit is exceeded, each debugging step then requires a
"COMMIT WORK".
he error occurs in a statement in which the table "BSAD " is accessed.