Function Module CLAF_CLASSIFICATION_OF_OBJECTS is thrrowing exception
Hi,
I have used this function in one of my program
CLAF_CLASSIFICATION_OF_OBJECTS
but it is throwing "NO_CLASSIFICATION" Exception and breaks into a short dump
only if i give some plant in the selection screen which is
can any one help.
try to uncomment the exceptions.
CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
EXPORTING
classtext = ' '
classtype = '300'
features = ' '
language = sy-langu
object = matl
objecttable = 'MARA'
key_date = p_date
TABLES
t_class = class_allocs
t_objectdata = obj_data
<b> EXCEPTIONS
no_classification = 1
no_classtypes = 2
invalid_class_type = 3
OTHERS = 4.
IF sy-subrc = 0.</b>
endif.
and handle them if you can.
regards
vijay
Similar Messages
-
RSAR_TRFC_DATA_RECEIVED Function module does not exist or EXCEPTION raised
Dear All,
We have 2 production systems one is a APO server & the other being BW server.
While checking in SM58 of our APO production server we found that so many entries were in error saying "ERROR REQU_<number> PG# 12 In BW" with target system as BWCLNT<CLIENT NO>.
We checked in both the production systems for any job failure w.r.t same time span but could find nothing.
When we tried to solve this by using F6 option to re-execute the LUW it says "Functional Module doesnot exists or Exception Raised". After doing checks it was found out that the Functional Module (RSAR_TRFC_DATA_RECEIVED) was existing . So we need to know about how we can solve this EXCEPTION RAISED issue.
Thanks & Regards,
SAPAPO
Edited by: SAP-APO on Dec 30, 2009 8:38 AMHi,
This migth be problem with not catching exact exception in the code.There might be data you are passing which not getting caught by the exception.
If you are using any code add this FM in the code or else try to debug where exactly u r facing this problem.
Regards,
Shiva Kumar G.C -
How to raise the exception in function module
Dear abaper's.
I am creating a Function module .In that in' EXCEPTION' Tab i am giving
3 exception .1.NO_DATA_FOUND 2.NO_PRINTER_FOUND 3.SMARTFORM_INTERFACE_NOT_FOUND.
In my coding if this condtion matches i want to raise this exception.how can i do this in my coding .can any one suggest me..
advance thanks,
Warm regards,
VeeraHi,
if that condition is not satisfied,and u didn't handle that exception while calling function module then in the runtime error u will get the text as the description of the exception in function module definition.
rgds,
bharat. -
What are the system built exceptions in function modules?
Hi Experts,
When we are creating the function module in se37 without exceptions ,but system will assign 2 default exceptions? what are the those exceptions? please provide the information on this issue.
Thanks,
Srinivas.Hi,
The system raises exceptions
1) COMMUNICATION_FAILURE and
2) SYSTEM_FAILURE by default.
Regards,
Lokeswari. -
Exception Raising in Function Module
Hi,
I am having a custom function module that calls a standard function module. Custom function module has following exception defined: manufacture unknown.
Standard function module has enhancement sections that I implement. For a defined condition I have to raise an exception and return from the function module. However, the exception is not defined in function module.
Standard exception OTHERS is available. Is it possible to raise OTHERS exception from the code? I have tried statement Raise OTHERS. But it has syntax errors.
Regards,
Bhavish BhatiaHi,
If you raise an exception not defined at exception's tab, sy-subrc will be returned with the number of exception OTHERS.
Just with the sentece:
RAISE ZEXCEPTION. (Assuming that ZEXCEPTION is not included at exception's tab).
Regards,
Pablo. -
Exceptions in the function module
Hi,
I declared exceptions in the function module. But those exceptions not trigger in the abap editor.
Regards
SrinuHi
use RAISE EXCEPTION...
RAISE KEY WORD IT WILL DEFENETELY RAISE THE EXCEPTION..
REWARD IF IT USE FUL -
Exceptions in Function Modules
Hi
How can I create an Exception in a Function Module and Raise that based on some condition? Plz helpHi Santo,,,,
Look into this link ,, where u will get a clear information on exceptions,,,,,
http://help.sap.com/saphelp_nw70/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm
http://abapprogramming.blogspot.com/2007/06/lesson-24-function-groups-and-function.html
In the function module, you can create your own local types and data objects, and call subroutines or other function modules.
You can make a function module trigger exceptions .
To do this, you must first declare the exceptions in the interface definition, that is, assign each one a different name.
In the source code of your function module, you program the statements that trigger an exception under the required condition. At runtime, the function module is terminated when an exception is triggered.
The changes to exporting and changing parameters are the same as in subroutines. There are two statements that you can use to trigger an exception. In the forms given below, stands for the name of an exception that you declared in the interface. The system reacts differently according to whether or not the exception was listed in the function module call:
RAISE .
If the exception is listed in the calling program, the system returns control to it directly. If the exception is not listed, a runtime error occurs.
MESSAGE () RAISING .
If the exception is listed in the calling program, the statement has the same effect as RAISE . If it is not listed, the system sends message from message class with type , and no runtime error occurs.
Function modules differ from subroutines in that you must assume that they will be used by other programmers. For this reason, you should ensure that you complete the steps listed here.
Documentation (can be translated)
You should document both your parameters and exceptions with short texts (and long texts if necessary) and your entire function module. The system provides a text editor for you to do this, containing predefined sections for Functionality, Example Call, Hints, and Further Information.
Work list
When you change an active function module, it acquires the status active (revised). When you save it, another version is created with the status inactive . When you are working on a function module, you can switch between the inactive version and the last version that you activated. When you activate the inactive version, the previous active version is overwritten.
Function test
Once you have activated your function module, you can test it using the built-in test environment in the Function Builder. If an exception is triggered, the test environment displays it, along with any message that you may have specified for it. You can also switch into the Debugger and the Runtime Analysis tool. You can save test data and compare sets of results.
When you insert a function module call in your program, you should use the Pattern function. Then, you only need to enter the name of the function module (input help is available). The system then inserts the call and the exception handling (MESSAGE statement) into your program.
You assign parameters by name. The formal parameters are always on the left-hand side of the expressions:
Exporting parameters are passed by the program. If a parameter is optional, you do not need to pass it. Default values are displayed if they exist.
Importing parameters are received by the program. All importing parameters are optional.
Changing parameters are both passed and received. You do not have to list optional parameters.
Default values are displayed if they exist.
The system assigns a value to each exception, beginning at one, and continuing to number them sequentially in the order they are declared in the function module definition. You can assign a value to all other exceptions that you have not specifically listed using the special exception OTHERS.
If you list the exceptions and one is triggered in the function module, the corresponding value is placed in the return code field sy-subrc. If you did not list the exception in the function call, a runtime error or a message occurs, depending on the statement you used in the function module to trigger the exception.
When you create a function module, you must assign it to a function group. The function group is the main program in which a function module is embedded.
A function group is a program with type F, and is not executable . The entire function group is loaded in a program the first time that you call a function module that belongs to it.
The system also triggers the LOAD-OF-PROGRAM event for the function group.
The function group remains active in the background until the end of the calling program. It is therefore a suitable means of retaining data objects for the entire duration of a program. All of the function modules in a group can access the group's global data.
Please reward if found helpful,,,,,,,,,,,,,,,,
Thanks And Regards ,,,,
Sreekar.Kadiri. -
Parameter passing by value or by reference in function module
hi everybody:
Im a beginner for abap.
Below description is described in online help.
In function module, the CALL FUNCTION statement can pass import, export, and changing parameters either by value or by reference. Table parameters are always transferred by reference.
I understand parameters passing by value means values carried by parameters are transferred, but I do not understand what is "by reference".
Please kindly give me a explanation.
Regards.
Andyhi,
Function modules are modular units with interfaces. The interface can contain the following elements:
Import parameters are parameters passed to the function module. In general, these are assigned
standard ABAP Dictionary types. Import parameters can also be characterized as optional.
Export parameters are passed from the function module to the calling program. Export parameters
are always optional and for that reason do not need to be accepted by the calling program.
Changing parameters are passed to the function module and can be changed by it. The result is
returned to the calling program after the function module has executed.
Exceptions are used to intercept errors. If an error triggers an exception in a function module, the
function module stops. You can assign exceptions to numbers in the calling program, which sets the
system field SY-SUBRC to that value. This return code can then be handled by the program.
By reference Passes a pointer to the original memory location. Very efficient
By value Allocates a new memory location for use within the subroutine. The memory is freed when the subroutine ends. Prevents changes to passed variable
By value and result Similar to pass by value, but the contents of the new memory is copied back into the original memory before returning. Allows changes and allows a rollback
When you pass a parameter by reference, new memory is not allocated for the value. Instead, a pointer to the original memory location is passed. All references to the parameter are references to the original memory location. Changes to the variable within the subroutine update the original memory location immediately.
1 report ztx1804.
2 data f1 value 'A'.
3
4 perform s1 using f1.
5 write / f1.
6
7 form s1 using p1.
8 p1 = 'X'.
9 endform.
The code in Listing produces the following output:
X
Hope this helps, Do reward. -
Different types of function module
hi,
When we create a function module : in one of the tabs we can find
1 general function module
2. remote function module
3. update function module.
What is meant by update function module and remote function module. can anyone explain me with an example and when shd we opt for 2 and 3.
thanxs
hariFunction Modules:
Function modules allow you to encapsulate and reuse global functions in the R/3 System.
They are stored in a central library. The R/3 System contains a wide range of predefined
function modules that you can call from any ABAP program.
Unlike subroutines, you do not define function modules in the source code of your program.
Instead, you use the Function Builder. The actual ABAP interface definition remains hidden
from the programmer. You can define the input parameters of a function module as optional.
You can also assign default values to them. Function modules also support exception handling.
This allows you to catch certain errors while the function module is running. You can test
function modules without having to include them in a program using the Function Builder.
Function Groups:
Function groups are containers for function modules. You cannot execute a function group.
When you call a function module, the system loads the whole of its function group into the
internal session of the calling program.
Calling Function Modules in ABAP:
To call a function module, use the CALL FUNCTION statement:
CALL FUNCTION <module>
[EXPORTING f1 = a 1.... f n = a n]
[IMPORTING f1 = a 1.... f n = a n]
[CHANGING f1 = a 1.... f n = a n]
[TABLES f1 = a 1.... f n = a n]
[EXCEPTIONS e1 = r 1.... e n = r n [ERROR_MESSAGE = r E]
[OTHERS = ro]].
You can specify the name of the function module <module> either as a literal or a variable.
Each interface parameter <fi> is explicitly assigned to an actual parameter <a i>. You can
assign a return value <r i> to each exception <e i>. The assignment always takes the form
<interface parameter> = <actual parameter>. The equals sign is not an assignment operator
in this context.
After EXPORTING, you must supply all non-optional import parameters with values
appropriate to their type. You can supply values to optional import parameters if you
wish.
[email protected]
34
After IMPORTING, you can receive the export parameters from the function module by
assigning them to variables of the appropriate type.
After CHANGING or TABLES, you must supply values to all of the non-optional
changing or tables parameters. When the function module has finished running, the
changed values are passed back to the actual parameters. You can supply values to
optional changing or tables parameters if you wish.
You can use the EXCEPTIONS option to handle the exceptions of the function module. If an
exception <e i > is raised while the function module is running, the system terminates the
function module and does not pass any values from the function module to the program,
except those that were passed by reference. If <e i > is specified in the EXCEPTION option,
the calling program handles the exception by assigning <r i > to SY-SUBRC. <r i > must be a
numeric literal.
If you specify of ERROR_MESSAGE in the exception list you can influence the message
handling of function modules. Normally, you should only call messages in function modules
using the MESSAGE ... RAISING statement. With ERROR_MESSAGE you can force the system
to treat messages that are called without the RAISING option in a function module as follows
for various FM's
http://www.erpgenie.com/abap/functions.htm
Calling Function Modules
http://help.sap.com/saphelp_46c/helpdata/en/9f/db98ef35c111d1829f0000e829fbfe/content.htm
remote enabled fm's are BAPI's
refer
Introduction to BAPIs:
Definition
The SAP Business Objects held in the Business Object Repository (BOR) encapsulate their data
and processes. External access to the data and processes is only possible by means of specific
methods - BAPIs (Business Application Program Interfaces).
A BAPI is defined as a method of a SAP Business Object.
For example, the functionality that is implemented with the SAP Business Object type
"Material" includes a check for the materials availability. Thus, the Business Object type
"Material" offers a BAPI called "Material.CheckAvailability".
Use
To use a BAPI method, an application program only needs to know how to call the method;
that is, it needs to know the methods interface definition. Therefore, when including a BAPI
invocation in your application program, you only need to supply the appropriate interface
information.
A BAPI interface is defined by:
Import parameters, which contain data to be transferred from the calling program to
the BAPI
Export parameters, which contain data to be transferred from the BAPI back to the
calling program
Import/export (table) parameters for both importing and exporting data
Structure
The BAPIs in the R/3 System are currently implemented as function modules, all of which are
held in the Function Builder. Each function module underlying a BAPI:
Supports the Remote Function Call (RFC) protocol
Has been assigned as a method to an SAP Business Object in the BOR
Is processed without returning any screen dialogs to the calling application
Integration
The architecture enables SAP to change the details of a BAPIs implementation without
affecting external applications, which are using the BAPI.
Advantages of Using BAPIs
BAPIs are standardized methods of SAP Business Objects that enable customers and third
parties to integrate their software components with the R/3 System and the Business
Framework.
Business Standard
SAP Business Objects and their BAPIs provide a business content standard, rather than a
technical interoperability standard; that is, they enable the integration of R/3 and other
software components on a business level, not on a technical level.
[email protected]
97
Standards Conformance
BAPIs are being developed as part of the SAP joint initiative with customers, partners, and
leading standards organizations. BAPIs are becoming a communication standard between
business systems.
You can access SAP Business Objects and their BAPIs by using object-oriented interfacing
technologies such as Microsofts COM/DCOM (Component Object Model/Distributed Component
Object Model).
The SAP Business Objects already comply with the Open Applications Group (OAG)
specifications, and, in conjunction with ObjectBridge from VisualEdge, conform to the Object
Management Groups CORBA (Common Object Request Broker Architecture) guidelines.
Stability and Downward Compatibility
Once a BAPI is implemented and released by SAP, its interface definition and parameters
remain stable in the long term, thus ensuring that your application program remains
unaffected by any changes to the underlying R/3 software and data.
SAP can make any necessary extensions to the BAPIs, for example, additional optional
parameters, without destabilizing the operation of existing applications and, at the same time,
can offer the enhanced functionality to new applications.
Object Orientation
As methods of the SAP Business Objects, BAPIs provide access to R/3 data and processes
following an object-oriented programming model. BAPIs can be called using object-oriented
interfacing technologies, such as COM/DCOM, thus enabling software components from SAP
and third parties to interact freely.
Openness
You can access BAPIs from all development platforms that support the SAP Remote Function
Call (RFC) protocol.
BAPI Definition
A Business Application Programming Interface (BAPI) is a precisely defined interface providing
access to processes and data in business application systems such as R/3. BAPIs are defined
as API methods of SAP Business Objects. These business objects and their BAPIs are described
and stored in the Business Object Repository (BOR).
A BAPI is implemented, however, as a function module, that is stored and described in the
Function Builder.
BAPIs can be called within the R/3 System from external application systems and other
programs. BAPIs are the communication standard for business applications. BAPI interface
technology forms the basis for the following developments:
R/3 satellite systems
Isolating components within the R/3 System in the context of Business Framework
Distributed R/3 scenarios using Application Link Enabling (ALE)
Connecting R/3 Systems to the Internet using Internet Application Components (IACs)
Visual Basic programs as front-end to R/3 Systems
Workflow applications that extend beyond system boundaries
Customers and partners own developments
Connections to non-SAP software
Connections to legacy systems
[email protected]
98
Standardized BAPIs
Some BAPIs and methods provide basic functions and can be used for most SAP Business
Objects. Such BAPIs are known as "standardized" BAPIs.
Using the descriptions below as a guide, verify whether you can implement the BAPI as a
standardized BAPI.
Features
BAPIs for Reading Data
The following BAPIs provide you with read-only access to data in the associated business
object:
GetList
With this BAPI you can select a range of object key values, for example, company
codes and material numbers. To specify appropriate selection requirements the calling
program must pass the relevant parameters to the interface. The key values selected
by the BAPI GetList are returned to the calling program in a table, together with other
useful information, for example, short texts. The key values can then be passed on to
another BAPI for further processing, for example, the BAPI GetDetail, as listed below.
GetDetail
The BAPI GetDetail uses a key to retrieve details about an instance(s specific
occurrence) of a business object and returns this data to the calling program.
GetStatus
The BAPI GetStatus is used to query the status of an SAP Business Object, for
example, to display the processing status of a sales order. This BAPI is used only for
displaying the status of an object and does not retrieve full details like the BAPI
GetDetail.
ExistenceCheck
The BAPI ExistenceCheck checks, whether an entry exists for an SAP Business Object,
for example, whether the customer master has been created. You should implement
this method as a workflow method and not as a BAPI (RFC capable function module).
The method CompanyCode.ExistenceCheck of the business object CompanyCode
(BUS0002) is an example of this. This workflow method is indirectly invoked when the
calling program instantiates an object, for example, by using
GetSAPObject("CompanyCode") from within Visual Basic.
BAPIs for Creating or Changing Data
The following BAPIs can create, change or delete instances of a business object: If required,
you can implement these BAPIs so that, several instances of a business object can be created,
deleted or modified simultaneously in the same call. In such cases "multiple" is added to the
method name, for example ChangeMultiple.
BAPIs that can create, change or delete instances are:
Create or CreateFromData
The BAPI Create or CreateFromData creates an instance of an SAP Business Object,
for example, a sales order. Create is the preferred name for this BAPI. Use the name
CreateFromData only when a workflow method called Create already exists for the
business object in question.
[email protected]
99
Change
The BAPI Change changes an existing instance of a SAP Business Object, for example,
a sales order.
Delete
The BAPI Delete deletes an instance of a SAP Business Object, for example, sales
order.
BAPIs for Replicating Business Object Instances
The BAPIs below can be implemented as methods of business objects that can be replicated.
They enable specific instances of an object type to be copied to one or more different systems.
These BAPIs are used mainly to transfer data between distributed systems within the context
of Application Link Enabling (ALE).
The method below must be implemented for each business object to be replicated.
Replicate
The BAPI Replicate is called in the system, which contains the originals of the business
object instances to be replicated. It is used to:
Identify the business objects to be replicated and to organize the required data.
Call the clone methods described below in the receiving system
Moreover, at least one of the clone methods below must be implemented for each business
object to be replicated.
Clone
The BAPI Clone is used by a system to replicate one business object on another
system or to modify one business object that has already been cloned.
CloneMultiple
The BAPI CloneMultiple is used by a system to replicate several business objects on
another system or to modify several business objects that have already been cloned.
Defining and Implementing the BAPI
Purpose
Various components of the ABAP Workbench are used when you define and implement a BAPI.
A BAPI is an API method of a business object and is defined as such in the Business Object
Repository (BOR). However, a BAPI is implemented as an RFC capable function module, which
is maintained in the Function Builder. The definitions and descriptions of the data structures
used by the BAPI are stored in the ABAP Dictionary.
For function modules that implement BAPIs, certain standards and rules must be adhered to
over and above the standard programming rules for function modules. For example, COMMIT
WORK commands must not be used in the function modules that a BAPI is based on.
The following sections guide you through the steps involved in developing a BAPI. The sections
contain information about the guidelines and conventions that you should adhere to when
defining and implementing a BAPI. When implementing BAPIs follow the requirements below
to ensure you achieve consistent behavior and representation of BAPIs as object oriented
methods of SAP Business Objects.
[email protected]
100
BAPI Programming
BAPI Definition
A Business Application Programming Interface (BAPI) is a precisely defined interface providing
access to processes and data in business application systems such as R/3.
BAPIs are defined as API methods of SAP Objects. These objects and their BAPIs are described
and stored in the BOR (BOR).
Use
BAPIs can be called within the R/3 System from external application systems and other
programs. A BAPI call can either be made as an object oriented method call or as a remote
function call (RFC).
BAPIs are a global communication standard for business applications.
Examples of what BAPIs can be used for include:
R/3 satellite systems
Distributed R/3 scenarios using Application Link Enabling (ALE)
Connecting R/3 Systems to the Internet using Internet application components (IACs)
Visual Basic programs as front-end to R/3 Systems
Workflow applications that extend beyond system boundaries
Customers and partners own developments
Connections to non-SAP software
Connections to legacy systems
BOR Definition
The Business Object Repository (BOR) is the object-oriented repository in the R/3 System. It
contains, among other objects, SAP Business Objects and their methods. In the BOR a
Business Application Programming Interface (BAPI) is defined as an API method of an SAP
Business Object. Thus defined, the BAPIs become standard with full stability guarantees as
regards their content and interface.
Use
With regard to SAP Business Objects and their BAPIs, the BOR has the following functions:
Provides an object-oriented view of R/3 System data and processes.
R/3 application functions are accessed using methods (BAPIs) of SAP Business
Objects. Implementation information is encapsulated; only the interface functionality
of the method is visible to the user.
Arranges the various interfaces in accordance with the component hierarchy, enabling
functions to be searched and retrieved quickly and simply.
Manages BAPIs in release updates.
BAPI interface enhancements made by adding parameters are recorded in the BOR.
Previous interface versions can thus be reconstructed at any time. When a BAPI is
created the release version of the new BAPI is recorded in the BOR. The same applies
when any interface parameter is created.
The version control of the function module that a BAPI is based on is managed in the
Function Builder.
Ensures interface stability.
Any interface changes that are carried out in the BOR, are automatically checked for
syntax compatibility against the associated development objects in the ABAP
Dictionary.
[email protected]
101
Integration
You should only define a BAPI as a SAP Business Object method in the BOR if the function
module that the BAPI is based on has been fully implemented. Full access to the BOR is
restricted to the persons responsible for the objects involved and for quality control.
BOR-BAPI Wizard
The BOR-BAPI Wizard assists with creating new BAPI methods in the BOR. It takes you
through the creation process step by step.
Transaction Model for Developing BAPIs Purpose
The transaction model in which BAPIs are used determines how you have to program BAPIs.
The transaction model described here has been used to develop BAPIs for R/3 Releases 3.1
and 4.0A.
Logical Unit of Work (LUW) and Statelessness
Within the context of this transaction model a transaction represents one processing step or
one logical unit of work (LUW). When a transaction is called, database operations are either
fully executed or not at all. The whole transaction must be programmed to be stateless.
This transaction model requires that:
No data is imported that may indirectly affect the result. If a transaction is called more
than once, each call must have the same result. For BAPIs this means, for example,
that Set or Get parameters cannot be used. However, you can keep Customizing data
in a global memory, as this data remains unchanged even if transaction calls are
repeated.
There must be no functional dependencies between two transactions.
Either all relevant data has to be changed in the database or none at all.
Determining the SAP Business Object and Its Key Fields
You have to identify the relevant SAP Business Object in the Business Object Repository (BOR)
and determine whether the key fields of the Business Object are relevant for your BAPI.
A key is defined in the BOR for most SAP Business Objects. This key can consist of several key
fields. The content of these key fields uniquely identifies one individual instance of an SAP
Business Object.
You can differentiate between instance-dependent and instance-independent BAPI methods.
Unlike instance-independent methods, instance-dependent methods relate to one instance
(one specific occurrence) of an SAP Business Object type, for example to one specific sales
order.
In the case of instance-dependent BAPIs, the key fields of the corresponding SAP Business
Object must be used as parameters in the function module the BAPI is based on so that the
associated object instance can be identified. The names of the key fields in the SAP Business
Object and the corresponding parameters in the BAPI function module must be the same,
because the name links the key fields to the parameters.
All the key fields defined in the BOR for the SAP Business Object in question must be used as
the parameters in the function module.
Example
SAP Business Object Creditor has a key field named CreditorId.
This key field must be defined as a parameter with the name CREDITORID in the function
modules of the instant-dependent BAPIs for this Business Object.
[email protected]
102
To display the Business Object and its key fields follow the steps below:
1. Select Tools -> ABAP Workbench -> Overview -> Business Object Browser . The
business objects are displayed in the order of the R/3 application hierarchy.
2. Select the required SAP Business Object in the application hierarchy and double click it
to open it.
3. To display the Business Objects key fields, expand the node Key fields.
Defining the Interface Structure of the BAPI
In this step you are going to define the BAPI interface, that is, the individual import, export
and table parameters required for calling the BAPI.
Caution
You cannot use Changing and Exception parameters in a function module which implements a
BAPI.
Process Flow
To define the interface parameters, proceed as follows:
1. Check whether the key fields of the SAP Business Object are required in the interface. The
key fields of the SAP Business Object are some of the most important BAPI parameters.
If a key value is to be passed to the BAPI by the calling program, the key field must be set as
an import parameter in the function module of the BAPI. That way a specific instance of the
Business Object is identified.
For example, this could be a customer number (CustomerNo) in the BAPIs Customer.GetDetail
and Customer.CheckPassword, or the number of a sales document in the BAPI
SalesOrder.GetStatus.
For BAPIs that generate instances, for example, the BAPIs Create or CreateFromData, the key
field of the Business Object should be set as an export parameter in the BAPI function module.
These BAPIs return one key value, for example, an order number in the BAPI
SalesOrder.CreateFromData.
For BAPIs that are class methods a key field is neither set as an import nor as an export
parameter in the BAPI function module. Class methods are instance-independent and are
called without the use of key values. Usually they return a table with a selection of key values.
2. Specify what other data is relevant as import, export or table parameters for the BAPI.
Every BAPI must have an Export parameter return that reports messages back to the calling
program.
Example
The BAPI to be developed is to read data from the SAP Business Object Creditor. To read
creditor details, the calling program has to pass the ID of the creditor and the company code.
The creditor data returned is to include general details, specific details and bank details.
To map these requirements onto the BAPI interface, the following parameters must be set in
the function module which the BAPI is based on:
The key field CreditorID of the SAP Business Object as an import parameter
An import parameter for the company code
A Return parameter that reports messages back to the calling program
A parameter for general details of the creditor
A parameter for specific details of the creditor
A parameter for bank details of the creditor
for BAPI list
refer www.sapbapi.com
for FM's refer www.se37.com
regards
srinivas
<b>*reward for useful answers*</b> -
How to capture error message from standard function module
Dear friends
when i execute standard function module in finance , i am getting error message , pls check the below screen shot,
how to capture the below error message so that i have display in my webdynpro component
Thanks
VijayaHello Vijaya,
Incase of BAPI's they have a return table parameter T_RETURN. Just read that return table to get the error message.
Incase of normal function modules, there will be exceptions raised for the message used inside the function module. Just read the sy-subrc after the FM and based on the sy-subrc value find the respective exception raised.
May be you can try like this, whenever the message is raised it will be stored in the system variable.
CALL FM.
check for the system variables.
sy-msgid = Message ID of the latest message raised.
sy-msgno = message number of the latest message raised.
sy-msgty = message type of the latest message raised.
sy-msgv1 = variable1 of the latest message raised.
sy-msgv2 = variable2 of the latest message raised.
sy-msgv3 = variable3 of the latest message raised.
sy-msgv4 = variable4 of the latest message raised.
Regards,
TP -
Function module does not exixt for TRFC struk
hello All,
A master load daily happens. But for today it is showing short dump error in satus and no errro messag ine detail tab .It is showing ABAP run tim error in status and also showing TRFC stuck in Source system. When i am trying to execute LUW it is shwoinf message Function module doesnot exixt or Exception raised..
ThanksHi,
Delete if any incorrect load.
Restart the load.. just keep checking the LUW ( If its taking for long time to load) .. and there is any trfc struck than run LUW one by one till all queue is completed.
Regards,
SKDDON -
Difference between function module and a method?
Hi Experts
Can anybody pls tell me the technical and functional difference between function moduel and a method?
Thanks
SudhansuHi,
Function modules are procedures that are defined in function groups (special ABAP programs with type F) and can be called from any ABAP program. Function groups act as containers for function modules that logically belong together. You create function groups and function modules in the ABAP Workbench using the Function Builder.
Function modules allow you to encapsulate and reuse global functions in the R/3 System. They are stored in a central library. The R/3 System contains a wide range of predefined function modules that you can call from any ABAP program. Function modules also play an important role in database updates and in remote communications between R/3 Systems or between an R/3 System and a non-SAP system.
You can declare methods in the declaration part of a class or in an interface. To declare instance methods, use the following statement:
METHODS <meth> IMPORTING.. [VALUE(]<ii>[)] TYPE type [OPTIONAL]..
EXPORTING.. [VALUE(]<ei>[)] TYPE type [OPTIONAL]..
CHANGING.. [VALUE(]<ci>[)] TYPE type [OPTIONAL]..
RETURNING VALUE(<r>)
EXCEPTIONS.. <ei>..
When you declare a method, you also define its parameter interface using the additions IMPORTING, EXPORTING, CHANGING, and RETURNING. The additions define the input, output, and input/output parameters, and the return code. They also define the attributes of the interface parameters, namely whether a parameter is to be passed by reference or value (VALUE), its type (TYPE), and whether it is optional (OPTIONAL, DEFAULT).
Unlike in function modules, the default way of passing a parameter in a method is by reference.
As in function modules, you can use exception parameters (EXCEPTIONS) to allow the user to react to error situations when the method is executed.
As in function modules, you can use the RAISE <exception> and MESSAGE RAISING statements to handle error situations.
Regards,
Sruthi -
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 -
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 -
Issue in EP: Function module throwing an exception
Hi Guys,
I have an Issue in EP.....which is a replica of the production system i am working on. I have an excel file to upload. I am using the function module 'text_convert_xls_to_sap' . This is working in Production sytem.
But i am getting an Error" File cannot be processed ".
in portal environment of the same program.
The exception is in the Function Module 'text_convert_xls_to_sap' in the " PERFORM get_spreadsheet_interface USING g_con_excel....".
Here sy-subrc = 1.
Can anyone tell me what exactly is going wrong here?
Thanks,
San
PS:Helpful answers will be rewardedHi!
The file is closed when i access. The issue is elsewhere and it is not reading the file...
Thanks,
San
Maybe you are looking for
-
MIGO values when invoices/credit memos have already been posted
Hi everyone, We are facing an issue with the values the system is calculating when doing the GR (and/or GR reversals) once invoices/credit memos have already been posted regarding the PO (Non Stock POs = non valuated). When a goods receipt is posted
-
Parse xml data and insert into database
Hi Friends, I have an xml document which needs to be parsed and the data need to be inserted into an oracle database table. Please tell me which will be the easiest and optimal way of doing this. Thanks, Achayan
-
1 Thai Character printout wrongly but preview report good
HI Experts, I have a problem when printing Thai Characters in report. When preview the thai characters displayed perfectly. But when printout - Only 1 character is printed wrongly. Example: สำ it will be printed as ส0 I've used other printer to test
-
Hi, I am getting an error while putting the image into jasper reports. the error goes in the folowing way. java.io.FileNotFoundException: D:\Tomcat5\webapps\Test (Access is denied) at java.io.FileInputStream.open(Native Method) at java.io.F
-
Adobe Professional XI crashes when attaching files to Outlook 2013
After opening a PDF if i chose the option of attaching to an email by clicking on mail icon the pdf will attach and send followed by Acrobat hanging and crashing. This behavior is consistent. I am using Outlook 2013 (32 bit) with Windows 8 (64 bit).