CAPP - standard value calculation origin 9 function module CE22.
Dear,
I've a project where i need to calculate standard value time based on multiple and various criteria. (standard price of a all components assigned to one operation)
I've seen that it should be possible to calculate a characterisitic value based on a function module in a method. (characterisitic value origin 9 - function module).
When i try to use the method with a function module I get a dump. ( CALL_FUNCTION_PARM_MISSING).
I don't find any documentation on the usage of a function module. as origin for CAPP.
Could you please help me ?
Br,
Daniel.
There are so many threads and documentation available on the same..Please search the same.
Moreover if you share the error then it would be easy to know the exact problem
Regards,
AL
Similar Messages
-
Dear SAP Guru,
Could any seniour help me regardsing CAPP Standard Values.Path is SAP MENU-Logistics--Production master dataCAPP Standard Values.
Could anybody put light on this
Regards
Bhupendra SinghHi,
Above SAP help link along with IDES example link should explain you detailed CAPP functionality. It is quite simple to impliment.
Create a test example as described in IDES example link and follow the steps.. you will understand the functionality easily.
Machine Parameters via CAPP
Capp
Regards,
Santosh Sarda
Edited by: santosh sarda on Jun 23, 2011 5:56 PM -
How to capture the User input value to user exist function module.
Hi,
How can i capture user input value.Here i am using User exist in BPS variable.
Calculating days using user exist functin module and my input is another variable i.e user defined value.
How can i capture user defined vaule into my function module.
This is very urgent can you help me..
Thanks....Hi!
You can get the instance using the method get_instance of the class cl_sem_variable, and call the method get_value with the return. Check the example:
CALL METHOD cl_sem_variable=>get_instance
EXPORTING
i_area = (planning area)
i_variable = (variable name)
RECEIVING
rr_variable = lr_var
EXCEPTIONS
not_existing = 1
OTHERS = 2.
CHECK sy-subrc IS INITIAL.
CALL METHOD lr_var->get_value
RECEIVING
rto_value = et_value
EXCEPTIONS
error = 1.
After this, read the first line of the table et_value (it should be the value that the user choose on the screen).
seeya!
Robson -
How can i get currency values from flatfile to function module
Dear All,
I have to take currency values from flat file and i have to assign those flat file value to function module .
Eg: "Convert_to_local_currency". I need technical code how to calculate those amount in work area and how to assign those amount value function module.
I need sample program for currency conversion from flat file to function module. My requirement is based on flat file amount i have to calculate in work area and assign those work area to function module.
With Regards,
BaskaranHi Satish or Baskaran,
First conform in which format the flat file is present, as abhi mentioned if it is there in notepad
try to use F.M GUI_UPLOAD as shown below...
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\Desktop\rpf1.TXT'
TABLES
DATA_TAB = ITAB.
Now loop at ITAB Into Work_area and press the respect currency fields which you want and in the same way
if the file is in EXCEL format use F.M ALSM_EXCEL_TO_INTERNAL_TABLE
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = P_FNAME
i_begin_col = 1
i_begin_row = 1
TABLES
intern = ITAB
LOOP AT ITAB INTO WA.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
foreign_currency = wa-waers
local_currency = wa-waers
IMPORTING
local_amount = tvals-gross.
ENDIF.
endloop.
And as mentioned loop the records into work area and process the currenct field which is present in the
ITAB according to its field name. And make sure within the loop you call your function module.
Regards
VEnk@
Edited by: Venkat Reddy on Dec 9, 2009 5:51 PM -
Default values in tables for function module
Hi,
We've created a function module and it is their requirement to have a default value for the tables in the FM? How do we do this? Cause if it is just an import parameter there is a column for default values, but for tables there is none. How do we code this?
Thanks.Hi,
In the start of the function module you can check the table and set your default values.
FUNCTION ...
"Check whether the table is initial
"Do not override the value passed by the user
IF itab[] IS INITIAL.
itab-field = 'DEFAULT'. "Set your default value
APPEND itab.
ENDIF.
- - - Your functionality
Regards
Wenceslaus. -
Standard Value Calculation with CAP
Hello Seniors,
is anyone able to tell me more about CAP (Computer Aided Planning) in regard to the task lists of the routing.
We are planning to develop this in a textile company in connection with SAP IS-AFS.
Any information is welcome,
Thanks!it is called CAPP
The std value cann be calculated by CAPP depending on the machine charetcistics value
You need to maintain some of the masterv data
Please go through the link below
and come with yr question doubts
http://help.sap.com/saphelp_47x200/helpdata/en/01/d53c6c4ab311d189740000e8322d00/frameset.htm -
SAP Upgrade - Standard function modules & modifications
Hello everybody,
we are doing a SAP Upgrade to SAP ERP 6.0 and I need your help
Some SAP standard funcion modules were modified in the last years and some weeks ago the changes were undone. The last version of the function modules are the same than the original function modules, but the version manager shows that the last version belongs to the user FGZ583 (and not SAP).
The Problem is, that SAP deals with that function modules as a modification (because the last change was done by FGZ583?), but they are identical to the original SAP function modules.
When the Upgrade is done, the SPAU/SPDD/se95 show that function modules as "modifications", although they are the same that the original ones.
What could I do to avoid that SAP deals with that function modules as modifications?
Cheers
PrashadHello Prashad,
Its standard that once the object is changed the corresponding entry is recorded in different tables.Even if you roll back now system will treat as the modifications because corresponding change entries are present in the tables. You can try to activate the older versions but i don't think this will help you.
This is not a point of worry as in SPDD adn SPAU you can choose reset to original for all those objects.
Even if you can get those objects to move back to the source version they will get back to the standard in the new release.So my advise will be to let your upgrade run and then reset these objects to original.
Regards
Niraj -
WWI issue: function module with symbol doesn't work in conditional output
Hi,
I have created a function module to be used in combination with a symbol that represents the quantity of a composition item in a composition. In some cases a average quantity is not filled and the function module calculates the quantity based on the lower and upper limit of the composition item. This function works perfectly if managed in customising with a symbol or called with a symbol in WWI. When displaying the result of the symbol in a WWI word template it shows the expected value.
However when I use the symbol with a function module (or the customised symbol with function module) in a conditional output expression, the value it represents in the expression is always equal to zero. It seems that a symbol value that is calculated using a functional module is not calculated properly when used in a conditional output expression. Setting a break in the functional module always shows the correct value, but the value as I already told, is not seen by the conditional output expression. Within the expression the value is always equal to zero.
Does anyone know if this is a known issue in WWI? Is there any solution to handle this problem? I hope anyone can help.
Thanks,
PaulDear Paul,
only some add on high level ideas:
if you look at:
Example: Layout of an Abridged Material Safety Data Sheet - Basic Data and Tools (EHS-BD) - SAP Library
you find the standard example of SAP for master and slave group:
2 <11BRG003 (M,SAP_EHS_1012_004;*)> ¶
3 <03EHS_L_TEXT(CED
-SDB-01.002)> ¤
<03EHS_L_TEXT(CED-
SDB-02-07)> ¤
<03EHS_L_TEXT(CED-
SDB-02-05)> ¤
4 <11BRG002 (S:POS;*)> ¿
5 <01GESTRIDENT(I:NAM,
6 IUPAC,;*)> <11ERG002>¤
7
8
9
<11BRG002 (S:POS; *)> ¿
<01G1023001R2(C;*)
><11ERG002>¤
<11BRG002 (S:POS;*)> ¿
<01GESTVPRECL>
<01GESTVCOMPL(N:" ZZ9,9")>
<01GESTVCOMPE>
<11ERG002> ¤
10 <11ERG003>¶
The "issue" is that you need to analyse by "line" of POS group; or precisely: it is easy to print lower, upper and average value if it exists.
In conditional output this example is shown in SAP help:
<15BIF001(AND:01G1013005VA GE 1)><01G1013005VA(;*/TL)[D:Value]>
<15CIF001><03EHS_L_TEXT(CUST-100000000000031)[D:Density is less than 1]>
<15EIF001>
I believe you need a "clever" nesting together with your customer symbol
E.g. you need first "test" the contents of the three values and decide about result
The easiest way could be to use a "table" structure as above.
Just use column header "lower"; "average"; "upper" value. Then you need to ask your self in which situation what need to printed.
If you use the table structure and you print just what is there and leave simply lower / upper limit "field" empty if it does not exists (what is bad with this?) you need only this "conditional" output topic done for average value. You could check for: if value > 0.0001 then print the value (as then there is a value); if not use the report symbol in which you calculate something. In my opinion it is worth to try it.
It is known that you can check "numeric values by using conditional output. I belive tis cintional one des work as well with the "composition" values (lwoer, upper, average),
May be this approach might help.
The "stack" examples which are discussed in SAP help and in the links shown are related to "characteristic" values of classes and not for composition ones.
C.B.
PS: If this really works you can clearly extend your solution. E.g. if lower value is empty may be print "0", If upper valus is empty may be print "100" etc. (or prepare a further costumer symbol calculating something). -
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 log input parameters for Function Modules?
Hi,
I need to create a Logging system to trace input parameters for function modules.
The log functionality could be done by developing a class method or a function module (For example 'write_log'), and calling it within each function module that I want to log. The 'write_log' code should be independent from the interface of the Function Module that I want to log.
For example, I'd like to write a function/class method that can log both these functions modules:
Function DummyA
Input parameters: A1 type char10, A2 type char10.
Function DummyB
Input parameters: B1 type char20, B2 type char20, B3 type char20, B4 type Z_MYSTRUCTURE
Now the questions...
- Is there a "standard SAP" function that provide this functionality?
- If not, is there a system variable in which I can access runtime all parameters name, type and value for a particular function module?
- If not, how can I loop at Input parameters in a way that is independent from the function module interface?
Thank you in advance for helping!check this sample code. here i am capturing only parameters (import) values. you can extend this to capture tables, changin, etc.
FUNCTION y_test_fm.
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(PARAM1) TYPE CHAR10
*" REFERENCE(PARAM2) TYPE CHAR10
*" REFERENCE(PARAM3) TYPE CHAR10
DATA: ep TYPE STANDARD TABLE OF rsexp ,
ip TYPE STANDARD TABLE OF rsimp ,
tp TYPE STANDARD TABLE OF rstbl ,
el TYPE STANDARD TABLE OF rsexc ,
vals TYPE tihttpnvp ,
wa_vals TYPE ihttpnvp ,
wa_ip TYPE rsimp .
FIELD-SYMBOLS: <temp> TYPE ANY .
CALL FUNCTION 'FUNCTION_IMPORT_INTERFACE'
EXPORTING
funcname = 'Y_TEST_FM'
* INACTIVE_VERSION = ' '
* WITH_ENHANCEMENTS = 'X'
* IGNORE_SWITCHES = ' '
* IMPORTING
* GLOBAL_FLAG =
* REMOTE_CALL =
* UPDATE_TASK =
* EXCEPTION_CLASSES =
TABLES
exception_list = el
export_parameter = ep
import_parameter = ip
* CHANGING_PARAMETER =
tables_parameter = tp
* P_DOCU =
* ENHA_EXP_PARAMETER =
* ENHA_IMP_PARAMETER =
* ENHA_CHA_PARAMETER =
* ENHA_TBL_PARAMETER =
* ENHA_DOCU =
EXCEPTIONS
error_message = 1
function_not_found = 2
invalid_name = 3
OTHERS = 4
IF sy-subrc = 0.
LOOP AT ip INTO wa_ip .
MOVE: wa_ip-parameter TO wa_vals-name .
ASSIGN (wa_vals-name) TO <temp> .
IF <temp> IS ASSIGNED .
wa_vals-value = <temp> .
ENDIF .
APPEND wa_vals TO vals .
ENDLOOP .
ENDIF.
ENDFUNCTION. -
How to call Function Module in Selection Screen
Hi All,
I have developed one HR Report (Qualification Overview Report: To display all active employees and their Qualifications along with their Proficiency).
Already it has 3 selection fields on selection screen and now I want one more field on selection screen like Qualification Id.
But when the end user press F4 it should display the Popup which comes in TCode: PA30 at the time of Creating Qualification.
I have debugged the Standard Code and searched the Function Module: 'RH_OBJID_REQUEST' which shows Popup which I wanted to show at Selection screen for newly added field.
So I have to define new field like 'Qualification Id' and want to attach above Function Module so that it will cater my requirement.
If anybody has worked on this type of requirement then please let me know.
Thanks,
Jay.Hi Raymond,
I have written following code:
s_quali is used in selection screen for Qualification Id.
SELECT-OPTIONS : s_quali FOR hrp1000-objid NO INTERVALS.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_quali-low.
CALL FUNCTION 'RH_OBJID_REQUEST'
EXPORTING
plvar = '01'
otype = 'Q'
seark = '*'
seark_begda = '18000101'
seark_endda = '99991231'
set_mode = 'X'
TABLES
sel_objects = git_objects.
LOOP AT git_objects INTO wa_objects. " Logic is to fill up the Selection screen field
s_quali-low = wa_objects-objid.
APPEND s_quali TO s_quali.
CLEAR : s_quali, wa_objects.
ENDLOOP.
Now problem is that, its not populating all values in selection screen which I select from Popup screen (Choose Qualification).
I checked that the first value in the internal Table is over written by second records in the internal table
For e.g.: If I select 001,002,003,004 from Popup screen then I am able to see only 002,003,004 in the Multiple selection view of that field though it is available in the internal table s_quali (because I am filling up the table using Loop-Endloop)
Please advise me how to overcome this issue. (How to fill up selection screen)
Thanks,
Jay. -
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> -
Macros, Function modules and subroutines
Hi Experts,
In performance wise which one is best macro or subroutine or Function module?
Thanks.Hi Nandini,
Each and every one has its importance in certain situations..
Macros
If you want to reuse the same set of statements more than once in a program, you can include them in a macro. For example, this can be useful for long calculations or complex WRITE statements. You can only use a macro within the program in which it is defined, and it can only be called in lines of the program following its definition.
Subroutines can call other subroutines (nested calls) and may also call themselves (recursive calls). Once a subroutine has finished running, the calling program carries on processing after the PERFORM statement. You can use the USING and CHANGING additions to supply values to the parameter interface of the subroutine.
Function modules allow you to encapsulate and reuse global functions in the SAP System. They are managed in a central function library. The SAP System contains several predefined functions modules that can be called from any ABAP program. Function modules also play an important role during updating and in interaction between different SAP systems, or between SAP systems and remote systems through remote communications.
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.
Best regards,
raam -
How many types of function modules are there
hi gurus,
how many types of function modules are there...
what type of function module bapi is....
i don't know much about that...
pls help me...
regards,
praveenhi
hope it will help you.
<REMOVED BY MODERATOR>
Function Modules Used in Script:
In the Driver Program we must use all or some of the function modules that are listed below to transfer the data.
Open_Form
Close_Form
Start_Form
Write_Form
Write_Form_Lines
End_Form
Control_Form
Read_Form_elements
Read_Form_Lines
Any driver program must contain Open_Form, Close_Form and Write_Form. Other function modules are optional.
OPEN_FORM: This function module opens layout set printing. One must call this function module before he uses any of other layout set function modules like Write_Form, Start_Form, Control_Form etc., You need specify a layout set name in the export parameters of this function module. If nothing is passed to Open_Form then one should use Start_Form function module to open layout set before starting the output. The layout set opened by Open_Form should be closed by Close_Form function module, other wise output doesnt appear. We can use any number of Open_Form, Close_Form functions in one single program. But Close_Form must be there for every Open_Form in the program.
Some of the important export parameters we have to pass to Open_Form function module.
Form: Enter the Layout set name here, which then controls the output formatting. If nothing is specified then we must use Start_Form for opening layout set.
Language: Layout sets are Language dependent. Enter the desired language here. If the entered layout set is not in that language, then the function tries to open the Form entered in its original language. The default value is SY-LANGU.
Device: SAP Script can format a text on different device types. The device can be PRINTER or TELEX, TELEFAX, ABAP and SCREEN.
Dialog: Use parameter DIALOG to determine whether to display a dialog box before printing, in which the user can set several spool parameters for print formatting. Possible values: SPACE displays no print parameter screen. 'X' display print parameter screen. Default value: 'X'
Options: Use parameter OPTIONS to set several options for print formatting. The parameter has the structure ITCPO. The user can change some of the defined settings on the print control screen. The default value for Options is . We will discuss about ITCPO structure in detail later.
Other Export, Import and Exceptions are self-explanatory.
Close_Form: The function module closes the layout set opened using OPEN_FORM. The system executes any terminating processing steps for the last opened layout set. No Export parameters for this Function Module.
Start_Form: In-between the function modules OPEN_FORM and CLOSE_FORM, we can use different layout sets. This allows us to combine several different layout sets into one print output. However, we can combine only those layout sets that have the same page format. To switch layout sets, use the function module START_FORM. If another layout set is still open, we must close it first using END_FORM. If we specify no layout set name when calling START_FORM, the system restarts the last open layout set. If after OPEN_FORM no layout set was activated yet, the system leaves the function module with the exception UNUSED. Some of the important export parameters for this function module are
Form: The parameter contains the name of the layout set you want to use for printing. If you specify no layout set here, the system restarts the last active layout set.
Language: Layout sets are language-dependent. Enter the desired language here. If the layout set does not exist in this language, the system tries to call the layout set in its original language. If the parameter LANGUAGE is empty, the system uses the language of the last active layout set.
Startpage: Usually, SAP script starts with the page specified as start page in the layout set definition. If we want to start output with another layout set page, enter the name of the desired layout set page here. If the desired page is not defined, the system uses the start page defined in the layout set.
Program: To replace program symbols, SAP script must know which active program contains the work areas for the values to be passed. If we omit the parameter, the system searches for the field values in the program that was specified in the parameter OPTIONS (field TDPROGRAM) of OPEN_FORM. If we enter a program name, the system replaces the program symbols with the values from this program up to the next END_FORM.
Exceptions and other Export, Import parameters are self-explanatory.
Write_Form: The system outputs the layout set element specified in parameter ELEMENT into the currently opened layout set. In the parameter WINDOW we can specify the name of a window for the output. Remember that the layout set element must be defined in this window. The parameter FUNCTION specifies how to merge the text lines to be output with any existing contents in the window. In this case, there are differences between the different window types or areas. Some of the important export parameters used in Write_Form.
Element: Specify the name of the text element you want to output into the layout set window specified in the parameter WINDOW. The element must be defined in that layout set window. If you specify no element, the system uses the default element, if one is defined in the layout set.
Window: Specify the name of the window into which you want to output the layout set element specified in the parameter ELEMENT. Default value for Window is MAIN.
Function: The parameter determines how to output the text element into the respective window. The output type depends on the window type and area:
Window Type: MAIN Area: BODY
SET/APPEND: Appends to previous output.
Window Type: Main Area: Top/Bottom and
Window Type: Other than Main and all areas
SET : Delete the old element contents and prints the new elements
APPEND: Appends the new content to existing elements.
Type: The system interprets this parameter only for output to the main window. The parameter determines the area of the main window into which we want to output the element. Possible values: 'TOP' header area
'BODY' main area
'BOTTOM' footer area
Default value: 'BODY'
Write_Form_Lines: This function module outputs the text lines in table LINES into the specified layout set window. The text lines must have the SAP script ITF format. From the data in the text header, the system uses only the field TDSTYLE to apply the formatting attributes defined in the specified style for this text. If the field is empty, the system uses the identically named formatting attributes (character and paragraph formats) of the layout set.
Use parameter WINDOW to specify into which of the windows defined in the layout set we want to output the text. We can specify any window used in the layout set. The parameter FUNCTION determines how to merge the text lines to be output with any existing contents in the window. There are differences between the different window types or areas.
Header: This parameter contains the header of the text module we want to output in the current layout set. For the formatting process, the system uses only the entries in the header fields TDSTYLE and TDFORM. Structure: THEAD
WINDOW: Enter the name of the window into which we want to output the layout set element specified in parameter ELEMENT. Default value: 'MAIN'
FUNCTION: This parameter determines how to output the text element into the respective window. The output type depends on the window type and area: Window type MAIN, area BODY: 'SET' append to previous output 'APPEND' same as SET. DELETE' no effect. Window type MAIN, areas TOP and BOTTOM; all other windows: 'SET' delete old window or area contents and output the element 'APPEND' append the element to the existing elements 'DELETE' no effect Default value: 'SET'
TYPE: The system interprets this parameter only for output to the main window. The parameter determines the area of the main window into which you want to output the element. Possible values: 'TOP' header area 'BODY' main area 'BOTTOM' footer area Default value: 'BODY'
END_FORM: END_FORM ends the currently open layout set and executes the required termination processing. After calling this function module, no more layout set is active. For further output, we must start a new layout set using START_FORM. No Export parameters.
CONTROL_FORM: Use this function module to pass SAP Script Control Commands to the layout set. The Control command is passed through the export parameter COMMAND in quotes.
READ_FORM_ELEMENTS: This function module fills a table with all text elements that appear in one layout set. If we specify no layout set name, the system includes all elements of the currently open layout set. If we specify a layout set, the system uses the information about the active version of the layout set, retrieved from the database. Here we have two export parameters, Form and Language and a table parameter Elements.
READ_FORM_LINES: Use this function module to transfer the lines of a layout set element into an internal table. If we specify no layout set name, the system transfers the text lines of the currently open layout set. If we specify a layout set, the system uses the text lines of the active version of the layout set from the database. The Export parameters are Form, Language, Window and Element. If we pass these 4 parameters the function module returns a table with the lines from layout set.
Function modules are one element. There are no types. However sometimes an RFC enabled function module is referred to as RFC Function module, but really it is just a function module. Also BAPIs are function modules, but are usually referred to as just BAPI as opposed to BAPI Function module.
There is no different function module types , but calling the function module will be different.
check this function calls syntax
1. Calls a function module:
CALL FUNCTION func.
2. Call a function module in a different mode (asynchronous Remote Function Call):
CALL FUNCTION func STARTING NEW TASK taskname.
3. Call a function module in the update task:
CALL FUNCTION func IN UPDATE TASK.
4. Call a function module in a remote system (Remote Function Call, RFC ):
CALL FUNCTION func DESTINATION dest.
5. Asynchronous call to a function module with transactional processing (transactional Remote Function Call):
CALL FUNCTION func IN BACKGROUND TASK.
qRFC with output queue
6. Call a function module that can be activated in the context of enhancements:
CALL CUSTOMER-FUNCTION func.
Cheers,
Chandru
Edited by: Alvaro Tejada Galindo on Feb 27, 2008 11:53 AM -
Hi,
Can anyone Explain Sapscript Function module open_form,Start_form,control_form,write_form,Read_text
Thanks & Regards,
Mayahi,
Any driver program must contain Open_Form, Close_Form and Write_Form. Other function modules are optional.
OPEN_FORM: This function module opens layout set printing. One must call this function module before he uses any of other layout set function modules like Write_Form, Start_Form, Control_Form etc., You need specify a layout set name in the export parameters of this function module. If nothing is passed to Open_Form then one should use Start_Form function module to open layout set before starting the output. The layout set opened by Open_Form should be closed by Close_Form function module, other wise output doesnt appear. We can use any number of Open_Form, Close_Form functions in one single program. But Close_Form must be there for every Open_Form in the program.
Some of the important export parameters we have to pass to Open_Form function module.
Form: Enter the Layout set name here, which then controls the output formatting. If nothing is specified then we must use Start_Form for opening layout set.
Language: Layout sets are Language dependent. Enter the desired language here. If the entered layout set is not in that language, then the function tries to open the Form entered in its original language. The default value is SY-LANGU.
Device: SAP Script can format a text on different device types. The device can be PRINTER or TELEX, TELEFAX, ABAP and SCREEN.
Dialog: Use parameter DIALOG to determine whether to display a dialog box before printing, in which the user can set several spool parameters for print formatting. Possible values: SPACE displays no print parameter screen. 'X' display print parameter screen. Default value: 'X'
Options: Use parameter OPTIONS to set several options for print formatting. The parameter has the structure ITCPO. The user can change some of the defined settings on the print control screen. The default value for Options is . We will discuss about ITCPO structure in detail later.
Other Export, Import and Exceptions are self-explanatory.
Close_Form: The function module closes the layout set opened using OPEN_FORM. The system executes any terminating processing steps for the last opened layout set. No Export parameters for this Function Module.
Start_Form: In-between the function modules OPEN_FORM and CLOSE_FORM, we can use different layout sets. This allows us to combine several different layout sets into one print output. However, we can combine only those layout sets that have the same page format. To switch layout sets, use the function module START_FORM. If another layout set is still open, we must close it first using END_FORM. If we specify no layout set name when calling START_FORM, the system restarts the last open layout set. If after OPEN_FORM no layout set was activated yet, the system leaves the function module with the exception UNUSED. Some of the important export parameters for this function module are
Form: The parameter contains the name of the layout set you want to use for printing. If you specify no layout set here, the system restarts the last active layout set.
Language: Layout sets are language-dependent. Enter the desired language here. If the layout set does not exist in this language, the system tries to call the layout set in its original language. If the parameter LANGUAGE is empty, the system uses the language of the last active layout set.
Startpage: Usually, SAP script starts with the page specified as start page in the layout set definition. If we want to start output with another layout set page, enter the name of the desired layout set page here. If the desired page is not defined, the system uses the start page defined in the layout set.
Program: To replace program symbols, SAP script must know which active program contains the work areas for the values to be passed. If we omit the parameter, the system searches for the field values in the program that was specified in the parameter OPTIONS (field TDPROGRAM) of OPEN_FORM. If we enter a program name, the system replaces the program symbols with the values from this program up to the next END_FORM.
Exceptions and other Export, Import parameters are self-explanatory.
Write_Form: The system outputs the layout set element specified in parameter ELEMENT into the currently opened layout set. In the parameter WINDOW we can specify the name of a window for the output. Remember that the layout set element must be defined in this window. The parameter FUNCTION specifies how to merge the text lines to be output with any existing contents in the window. In this case, there are differences between the different window types or areas. Some of the important export parameters used in Write_Form.
Element: Specify the name of the text element you want to output into the layout set window specified in the parameter WINDOW. The element must be defined in that layout set window. If you specify no element, the system uses the default element, if one is defined in the layout set.
Window: Specify the name of the window into which you want to output the layout set element specified in the parameter ELEMENT. Default value for Window is MAIN.
Function: The parameter determines how to output the text element into the respective window. The output type depends on the window type and area:
Window Type: MAIN Area: BODY
SET/APPEND: Appends to previous output.
Window Type: Main Area: Top/Bottom and
Window Type: Other than Main and all areas
SET : Delete the old element contents and prints the new elements
APPEND: Appends the new content to existing elements.
Type: The system interprets this parameter only for output to the main window. The parameter determines the area of the main window into which we want to output the element. Possible values: 'TOP' header area
'BODY' main area
'BOTTOM' footer area
Default value: 'BODY'
Write_Form_Lines: This function module outputs the text lines in table LINES into the specified layout set window. The text lines must have the SAP script ITF format. From the data in the text header, the system uses only the field TDSTYLE to apply the formatting attributes defined in the specified style for this text. If the field is empty, the system uses the identically named formatting attributes (character and paragraph formats) of the layout set.
Use parameter WINDOW to specify into which of the windows defined in the layout set we want to output the text. We can specify any window used in the layout set. The parameter FUNCTION determines how to merge the text lines to be output with any existing contents in the window. There are differences between the different window types or areas.
Header: This parameter contains the header of the text module we want to output in the current layout set. For the formatting process, the system uses only the entries in the header fields TDSTYLE and TDFORM. Structure: THEAD
WINDOW: Enter the name of the window into which we want to output the layout set element specified in parameter ELEMENT. Default value: 'MAIN'
FUNCTION: This parameter determines how to output the text element into the respective window. The output type depends on the window type and area: Window type MAIN, area BODY: 'SET' append to previous output 'APPEND' same as SET. DELETE' no effect. Window type MAIN, areas TOP and BOTTOM; all other windows: 'SET' delete old window or area contents and output the element 'APPEND' append the element to the existing elements 'DELETE' no effect Default value: 'SET'
TYPE: The system interprets this parameter only for output to the main window. The parameter determines the area of the main window into which you want to output the element. Possible values: 'TOP' header area 'BODY' main area 'BOTTOM' footer area Default value: 'BODY'
END_FORM: END_FORM ends the currently open layout set and executes the required termination processing. After calling this function module, no more layout set is active. For further output, we must start a new layout set using START_FORM. No Export parameters.
CONTROL_FORM: Use this function module to pass SAP Script Control Commands to the layout set. The Control command is passed through the export parameter COMMAND in quotes.
READ_FORM_ELEMENTS: This function module fills a table with all text elements that appear in one layout set. If we specify no layout set name, the system includes all elements of the currently open layout set. If we specify a layout set, the system uses the information about the active version of the layout set, retrieved from the database. Here we have two export parameters, Form and Language and a table parameter Elements.
READ_FORM_LINES: Use this function module to transfer the lines of a layout set element into an internal table. If we specify no layout set name, the system transfers the text lines of the currently open layout set. If we specify a layout set, the system uses the text lines of the active version of the layout set from the database. The Export parameters are Form, Language, Window and Element. If we pass these 4 parameters the function module returns a table with the lines from layout set.
if help ful reward points
Maybe you are looking for
-
When i try to open itunes i get a message saying itunes is on a locked disk
i cannot open itunes when i try i get a warning message saying that "the folder "Itunes" is on a locked disk or you do not have permission for this folder" whats the problem???
-
Hi there I've tring to produce an aged debtor query and am getting the following error am producing this report in qlikview SQL error: The multi-part identifier "T0.ShortName" could not be bound Please could some one look at my query and tell me wher
-
I've following requirement 1) output XML consist a section of address data which are mandatory (mandatory data are pointed below with * *); *<ShipToParty>* *<Party>* <Identification>
-
Hello, My mac is currently running at 10.5.8 and when I check for software update it says its up to date. But I need to get the new OS X and I don't have the mac app store on my computer I have been all over the apple website trying to upgrade and ha
-
I have tried to get it to remove autocomplete for certain sites. I tried to remove them all. I tried deleting individual entries. It will not remove autocomplete select unless you just tell it not to show autocomplete.