Function Modul export parameter
hi
i need help...
i have programing a function modul.
the type from the export parameter is during runtime to known.
how i do assign my export parameter the right type during runtime and output in same format?
function z_wwi_get_st_kg.
*"*"Lokale Schnittstelle:
*" IMPORTING
*" REFERENCE(PF_MATNR) TYPE MATNR
*" EXPORTING
*" REFERENCE(P_ST_GE)
*" REFERENCE(P_EINHEIT)
data lf_yykeid type ymm_keid.
data lf_meinh type lrmei.
data lf_brgew type brgew.
data lf_gewei type gewei.
data lf_umrez type umrez.
"Konsumenteneinheit lesen
select single yykeid
from mara
into lf_yykeid
where matnr eq pf_matnr.
"Wenn nicht KG dann ST
if lf_yykeid ne 'KG'.
lf_meinh = 'ST'.
else.
lf_meinh = lf_yykeid.
endif.
"Stückartikel oder Gewichtsartikel
case lf_meinh.
when 'ST' .
select single umrez
from marm
into lf_umrez
where matnr eq pf_matnr
and meinh eq 'HE'.
clear lf_meinh.
lf_meinh = 'CU'.
* get reference of lf_umrez into p_st_ge.
* get reference of lf_meinh into p_einheit.
when 'KG'.
select single brgew gewei
from marm
into (lf_brgew, lf_gewei)
where matnr eq pf_matnr
and meinh eq 'HE'.
* get reference of lf_brgew into p_st_ge.
* get reference of lf_gewei into p_einheit.
endcase.
endfunction.
thx anu
Edited by: marty anujit on May 18, 2009 3:02 PM
Hi,
function module is fixed and reuse component..
you will not decide the export parameter is during runtime ..
instead you can assign the structure having field name and field value..
so the export paramater is now having field name and field value you can use this in the programm by
field name..
Regards,
Prabhudas
Similar Messages
-
How to pass select-option filed to Function Module Exporting Parameter
Hi,
How to pass select-option filed to Function Module Exporting Parameter.
ThanksHi,
DATA: BEGIN OF ITAB5_WRK OCCURS 0,
KUNNR TYPE KNKK-KUNNR, "CUSTOMER #
SBGRP TYPE KNKK-SBGRP, "CREDIT REP
KLIMK TYPE KNKK-KLIMK, "CREDIT LIMIT
NAME1 TYPE KNA1-NAME1, "CUSTOMER NAME
SKFOR TYPE KNKK-SKFOR, "TOTAL A/R
AMT1 TYPE KNKK-SKFOR, "CURRENT
AMT2 TYPE KNKK-SKFOR, "01-30
AMT3 TYPE KNKK-SKFOR, "31-60
AMT4 TYPE KNKK-SKFOR, "61-90
AMT5 TYPE KNKK-SKFOR, "91-120
AMT6 TYPE KNKK-SKFOR, "OVR 120
BZIRK TYPE KNVV-BZIRK,
END OF ITAB5_WRK.
SELECT-OPTIONS P_COMP FOR T001-BUKRS
SELECT KUNNR SBGRP FROM KNKK
INTO TABLE ITAB5_WRK
WHERE SBGRP IN P_REP
AND KUNNR GE '0001000000'
AND SKFOR NE 0.
LOOP AT ITAB5_WRK.
DELETE ADJACENT DUPLICATES FROM ITAB5_WRK COMPARING KUNNR.
ENDLOOP.
PERFORM GET_CREDIT_LIMITS.
*=======================================================================
IF P_DIST NE SPACE.
LOOP AT ITAB5_WRK.
SELECT SINGLE * FROM KNVV WHERE KUNNR EQ ITAB5_WRK-KUNNR
AND VKORG EQ P_COMP
AND VTWEG EQ '20'
AND SPART EQ '10'
AND BZIRK IN P_DIST.
IF SY-SUBRC EQ 0.
MOVE KNVV-BZIRK TO ITAB5_WRK-BZIRK.
MODIFY ITAB5_WRK.
ELSE.
DELETE ITAB5_WRK.
ENDIF.
ENDLOOP.
ENDIF.
*==============================================================
LOOP AT ITAB5_WRK.
MOVE: 'F/S' TO WRK-KKBER,
ITAB5_WRK-KUNNR TO WRK-KUNNR.
PERFORM AGING.
ADD: W_SNFAE TO ITAB5_WRK-AMT1,
W_SFAE1 TO ITAB5_WRK-AMT2,
W_SFAE2 TO ITAB5_WRK-AMT3,
W_SFAE3 TO ITAB5_WRK-AMT4,
W_SFAE4 TO ITAB5_WRK-AMT5,
W_SFAE5 TO ITAB5_WRK-AMT6,
W_SFAEL TO ITAB5_WRK-SKFOR,
W_SNFAE TO ITAB5_WRK-SKFOR.
MOVE: 'SPEC' TO WRK-KKBER,
ITAB5_WRK-KUNNR TO WRK-KUNNR.
*PERFORM AGING.*
ADD: W_SNFAE TO ITAB5_WRK-AMT1,
W_SFAE1 TO ITAB5_WRK-AMT2,
W_SFAE2 TO ITAB5_WRK-AMT3,
W_SFAE3 TO ITAB5_WRK-AMT4,
W_SFAE4 TO ITAB5_WRK-AMT5,
W_SFAE5 TO ITAB5_WRK-AMT6,
W_SFAEL TO ITAB5_WRK-SKFOR,
W_SNFAE TO ITAB5_WRK-SKFOR.
MODIFY ITAB5_WRK.
ENDLOOP.
FORM AGING.
*CALL FUNCTION 'CUSTOMER_DUE_DATE_ANALYSIS'*
EXPORTING
BUKRS = P_COMP
KKBER = WRK-KKBER
KUNNR = WRK-KUNNR
RASID = 'FEND'
KLIMP = 'X'
IMPORTING
SFAE1 = W_SFAE1
SFAE2 = W_SFAE2
SFAE3 = W_SFAE3
SFAE4 = W_SFAE4
SFAE5 = W_SFAE5
SFAE6 = W_SFAE6
SFAEL = W_SFAEL
SNFA1 = W_SNFA1
SNFA2 = W_SNFA2
SNFA3 = W_SNFA3
SNFA4 = W_SNFA4
SNFA5 = W_SNFA5
SNFA6 = W_SNFA6
SNFAE = W_SNFAE
EXCEPTIONS
NO-AGING_SCHEDULE = 1
NO_TABLE_INPUT = 2.
CASE SY-SUBRC.
WHEN 1.
MESSAGE E999 WITH 'PLEASE ENTER AGING SCHEDULE'.
WHEN 2.
MESSAGE E999 WITH 'DO NOTHING ??'.
ENDCASE.
ENDFORM. "AGING
Thanks -
Hi,
I get this error while posting a document -
Error accessing function module: FMFK_FKRS_READ parameter: IP_FIKRS IP_FMA_OBJNR
Same error apprears in GL/AR/AP.
Any suggestion?Hi,
Check the following notes 553048, 580494; it might solve your problem.
Regards,
Eli -
Function module import parameter
I had used a bapi in the program and i got a dump.
then i recetified the dump. But kindly tell me the
reason .
My program is like this..
Report xyz.
DATA wa_bapireturn TYPE bapireturn.
DATA it_bapireturn LIKE TABLE OF wa_bapireturn.
DATA wa_bapisdstat TYPE bapisdstat.
DATA it_bapisdstat LIKE TABLE OF wa_bapisdstat.
PARAMETERS p_vbeln LIKE vbap-vbeln.
START-OF-SELECTION.
CALL FUNCTION 'BAPI_SALESORDER_GETSTATUS'
EXPORTING
salesdocument = so_vbeln
IMPORTING
return = it_bapireturn
TABLES
statusinfo = it_bapisdstat.
now i got the dump because i have used
it_bapireturn for importing.
then i modified the program like..
CALL FUNCTION 'BAPI_SALESORDER_GETSTATUS'
EXPORTING
salesdocument = so_vbeln
IMPORTING
return = wa_bapireturn
TABLES
statusinfo = it_bapisdstat.
Now the program working fine because i passed
wa_bapireturn. please tell me why it happened like
this. How to know when to pass internal table and when to
pass just a structure.
And also tell me the difference bet type and type ref to.As per the interface definition of the BAPI, it expects one workarea in the RETURN parameter.
but it_bapireturn was an internal table so was the dump
but wa_bapireturn is a work area so it worked.
You can check the interface of the Function Module to know what to be used. Usually work areas are passed in IMPORT AND EXPORT parameters and internal tables in TABLES parameters.
by using TYPE , we create a variable of a pre difined TYPE.
by using TYPE REF we create object of a particual class
Edited by: Swastik Bharati on Aug 21, 2008 2:16 PM -
Hi..
when I am trying to export some paramters and tables in RFC function module, i m getting error as well as a warning message stating performance will reduce.
So please help me to solve the issue.
Thanks
VimalrajYou are getting this message because you are exporting tables 'by value'. Since this will cause the complete data in that internal table to be copied into a new memory area this might impact the performance of that function in case the table has a lot of data in it.
However - for an RFC you can only define parameters to be called by value, hence this is not an error in your case. It just lets you know that the performance will suffer when you have lots of data in your internal table compared to a function that would pass the data by reference - but you don't have that option for an RFC anyway.
Hope that helps,
Michael -
Function module import parameter....Urgent
Hi Experts,
I am using User Exit M06E0004 which is using <b>FM EXIT_SAPLEBND_002</b>. It has 4 inport parameters
I_CEKKO LIKE CEKKO
IT_BEKPO TYPE MMPUR_BEKPO
IT_BEKET TYPE MMPUR_BEKET
IT_EKKNU TYPE MMPUR_EKKNU
and 1 export paramenter E_CEKKO LIKE CEKKO
I want to pass 1 more field MDSB-matnr(character type matnr for BOM child Items) which is not in any the structure here.
Its a standard FM so we have 1 include for enhancement in this exit. So what to do to get values for this. i need this matnr against a PO in CEKKO.
I need to do all this for my requirement of IDOC. I have to send IDOC when any subcontract PO release and having Child Items(BOM materials MDSB-matnr) started with 'P'.
Regards,
Nik>>>
<i>the requirement is,
I have to send a customized IDOC to external application when a PO release. For sending IDOC automaticaly when PO release, I fount User exit M06E0004.</i>
<<<
OK.
I take you did verify that this user exit is only triggered when you release the PO. Just asking because it's purpose, as it was said, is to influence the release strategy determination. This determination may happen when the PO is saved, not when the PO is actually released. In that case, this would be too early. But I'm not certain about the exact processing time, to be honest.
If you determined that this is the right place, then it's all good.
>>>
<i>And IT_BEKPO, IT_BEKET are not internal tables , they are import parameters of table type MMPUR_BEKPO and MMPUR_BEKET.</i>
<<<
And what type do you think IT_BEKPO, etc. will be? Since they are defined with reference to a table type, they sure will be internal tables.
If you want to read the content, you'd do something like this:
DATA: W_BEKPO TYPE BEKPO.
LOOP AT IT_BEKPO INTO W_BEKPO WHERE... <conditions>
MOVE W_BEKPO-MENGE TO ...
...etc.
ENDLOOP.
As for reading MDSB, I don't know what your selection criterion is, but since MDSB is a view defined for table RESB, it only makes sense to use it if you do know the corresponding reservation number, item etc.
You mentioned MATNR as the field you'd need from MDSB. Why? If you need the material number, it's readily available in IT_BEKPO. If you need reservation data in your IDoc then you'd read RESB with a proper indexed access (so for instance, with the material number from the PO item or something)...
Regarding the whole 'sending IDoc when the PO is released' requirement, I'd probably try a different approach. My way of doing this would probably be to try to set up the regular message control with a specific output type generating the custom IDoc, and in the message determination I'd set a requirement that checks whether the PO is released... something like that. -
Under Function Module
Exporting parameter
*" EXPORTING
*" VALUE(Y_HIGHEST_MSGTYPE) LIKE TE950-DISPLAY_MOVEIN
Here I want to do Error out one Message based on condition.
I Written condition, but how should I incorporate error as output in exporting parameter .
This T9950-DISPlay_movein having following parameters
fields
MSGNR(3)
BPWMODE(1)
DISPLAY_BPE(1)
DISPLAY_BPA(1)
DISPLAY_BPI(1)
Thanks,
SonarHi Sonar,
I hope you are referring to a custom FM. If it is standard, please mention the name and people would be able to provide the details.
To get the error messages, you can create and Error Internal Table and pass it to your Tables parameter. Later on read this table and show your messages.
If you have issues, please elaborate a little more, cut paste some code and it will easier to analyze. -
Hi,
As I am programming ABAP for the first time I have a question which I think is pretty basic.
I have created a function module Z_POPUP_GET_VALUES which calls the function POPUP_GET_VALUES. I got some sample code from another forum post and it defines a table name and fieldname. But I am not sure what this table is suppose to be (or do)? Is it an ABAP dictionary table? If so, how do I create one based on the characteristic I want to display??
The implemented code is as follows:
DATA: i_sval Like sval occurs 1 with Header Line.
data: v_subrc like sy-subrc.
i_sval-tabname =
i_sval-fieldname = '?????'.i_sval-fieldtext = 'Eiendelsområde'.
i_sval-field_obl = 'X'.
append i_sval.
CALL FUNCTION 'POPUP_GET_VALUES'
EXPORTING
NO_VALUE_CHECK = ' '
POPUP_TITLE = 'Asset Area'
START_COLUMN = '5'
START_ROW = '5'
IMPORTING
RETURNCODE = v_subrc
TABLES
FIELDS = i_sval
EXCEPTIONS
ERROR_IN_FIELDS = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
All help appreciated!
Best regards,
TMHi,
Tables in function modules are parameter to that function module.
That can be processed when the function module code is called.
and the result can be stored in the tables.
Tables have a structure like ABAP Dictionary structure .ie. You will be
define the table type as a dictionary table.
Regards,
<b>Ramganesan K</b> -
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> -
Modified Functional module not executing the inserted Code
Hi everyone
I've modified the IW_C_CREATE_TRANSPORT_REQUEST Functional module so that it calls the GUI_EXEC FM which calles my java script which saves the transport ID with a filename specified. The code seems to work when i test it within SAP, but when i come to use STARTRFC to call the function, the added code dosen't seem to be executing, the transport still gets created but my javascript is not being called?
Anyone know why?
Thanks - Peter
Code following
FUNCTION IW_C_CREATE_TRANSPORT_REQUEST.
""Local interface:
*" IMPORTING
*" VALUE(DESCRIPTION) LIKE E07T-AS4TEXT
*" VALUE(TRANSPORT_KIND) LIKE E070-TRFUNCTION DEFAULT 'K'
*" VALUE(LANGU) LIKE SY-LANGU DEFAULT 'EN'
*" VALUE(CQ_ID) LIKE E070-TRKORR DEFAULT 'FileName'
*" EXPORTING
*" VALUE(COMMFILE) LIKE E070-TRKORR
*" VALUE(PROG_PATH) LIKE E070-TRKORR
*" VALUE(CLASSNAME) LIKE E07T-AS4TEXT
*" EXCEPTIONS
*" LANGUAGE_MISSING
*" NUMBER_RANGE_FULL
*" UNALLOWED_TRFUNCTION
*" NO_AUTHORIZATION
*" CREATE_TRANSPORT_ERROR
CLEAR COMMFILE.
CASE TRANSPORT_KIND.
WHEN 'P'.
Stücklisten für Releasewechsel
IF NOT LANGU IS INITIAL.
PERFORM CREATE_RELEASE_REQUEST
USING LANGU
DESCRIPTION
TRANSPORT_KIND
CHANGING COMMFILE.
ELSE.
keine Sprache angegeben und Transportart Stücklisten
RAISE LANGUAGE_MISSING.
ENDIF.
WHEN OTHERS.
Alle anderen Transporte
PERFORM CREATE_REQUEST
USING DESCRIPTION
TRANSPORT_KIND
CHANGING COMMFILE.
ENDCASE.
*{ INSERT SM1K900042 1
WRITE 'Entering My Pogram'.
PROG_PATH = 'java.exe'.
CLASSNAME = '-cp c: writeToFile'.
CONDENSE CLASSNAME.
CONDENSE PROG_PATH.
CONCATENATE CLASSNAME CQ_ID COMMFILE INTO CLASSNAME SEPARATED BY ' '.
CALL FUNCTION 'GUI_EXEC'
EXPORTING
PARAMETER = CLASSNAME
COMMAND = PROG_PATH.
WRITE 'Our path is'.
WRITE PROG_PATH.
WRITE CLASSNAME.
*} INSERT
ENDFUNCTION.
*************************FORMS****************************************
FORM CREATE_RELEASE_REQUEST *
Transportauftrag für Stücklisten erstellen *
FORM CREATE_RELEASE_REQUEST
USING P_LANGU LIKE SY-LANGU
P_TRANSPORT_DESCRIPT LIKE E07T-AS4TEXT
P_TRANS_KIND LIKE E070-TRFUNCTION
CHANGING P_COMMFILE LIKE E070-TRKORR.
DATA: SUBRC LIKE SY-SUBRC,
H_TMP_LANG(2) TYPE C,
H_NUMBER(3) TYPE C,
NUMBER(4) TYPE C.
Anwednungslog öffnen
PERFORM OPEN_LOG
USING P_TRANSPORT_DESCRIPT.
*Nummer ziehen
PERFORM GET_NUMBER USING P_LANGU
CHANGING H_NUMBER
SUBRC.
IF SUBRC = 12.
Fehler beim erstellen des Transportauftrags
RAISE CREATE_TRANSPORT_ERROR.
ELSEIF SUBRC = 11.
Nummernkreis voll
RAISE NUMBER_RANGE_FULL.
ELSE.
WRITE P_LANGU TO H_TMP_LANG.
P_COMMFILE = 'SAPKXXXLYY'.
REPLACE 'XXX' WITH H_NUMBER INTO P_COMMFILE.
REPLACE 'YY' WITH H_TMP_LANG INTO P_COMMFILE.
CALL FUNCTION 'SUBST_CREATE_COMMANDFILE'
EXPORTING
IV_KORRNAME = P_COMMFILE
IV_KORRTYPE = P_TRANS_KIND
IV_KORRTEXT = P_TRANSPORT_DESCRIPT
EXCEPTIONS
NAME_COLLISION = 1
CREATE_HEADER_FAILED = 2
UPDATE_HEADER_FAILED = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
CLEAR P_COMMFILE.
Fehler beim Erstellen des Transportauftrags
RAISE CREATE_TRANSPORT_ERROR.
ELSE.
Transportauftrag erstellt
Log schreiben
PERFORM WRITE_LOGFILE
USING P_COMMFILE.
ENDIF.
ENDIF.
ENDFORM. "CREATE_RELEASE_REQUEST
FORM CREATE_REQUEST *
Transportauftrag erstellen *
FORM CREATE_REQUEST
USING P_TRANSPORT_DESCRIPT LIKE E07T-AS4TEXT
P_TRANS_KIND LIKE E070-TRFUNCTION
CHANGING P_COMMFILE LIKE E070-TRKORR.
CALL FUNCTION 'TRINT_INSERT_NEW_COMM'
EXPORTING
WI_KURZTEXT = P_TRANSPORT_DESCRIPT
WI_TRFUNCTION = P_TRANS_KIND
IMPORTING
WE_TRKORR = P_COMMFILE
EXCEPTIONS
NUMBER_RANGE_FULL = 1
INVALID_INPUT = 2
NO_AUTHORIZATION = 3
OTHERS = 4.
CASE SY-SUBRC.
WHEN 0.
Auftrag erstellt
Anwednungslog öffnen
PERFORM OPEN_LOG
USING P_TRANSPORT_DESCRIPT.
Log schreiben
PERFORM WRITE_LOGFILE
USING P_COMMFILE.
WHEN 1. "Nummernkreis für Aufträge voll
CLEAR P_COMMFILE.
RAISE NUMBER_RANGE_FULL.
p_error_msg-no = '735'.
WHEN 2. "Unbekannter Auftragstyp
CLEAR P_COMMFILE.
RAISE UNALLOWED_TRFUNCTION.
p_error_msg-no = '353'.
WHEN 3. "keine Berechtigung
CLEAR P_COMMFILE.
RAISE NO_AUTHORIZATION.
p_error_msg-no = '328'.
WHEN 4. "Allgemeiner Fehler
CLEAR P_COMMFILE.
RAISE CREATE_TRANSPORT_ERROR.
p_error_msg-no = '353'.
ENDCASE.
ENDFORM. "create_request
FORM OPEN_LOG *
Anwedungslog öffnen *
FORM OPEN_LOG
USING P_TRANSPORT_DESCRIPT LIKE E07T-AS4TEXT.
*init application log
PERFORM LOG_INIT USING C_APPL_LOG_TRANSPORT.
*log header
PERFORM LOG_HEADER
USING C_APPL_LOG_TRANSPORT P_TRANSPORT_DESCRIPT.
ENDFORM. "OPEN_LOG
FORM WRITE_LOGFILE *
Logfile in den Anwendungslog schreiben *
-> P_TRANSPORT_DESCRIPT *
FORM WRITE_LOGFILE
USING P_COMMFILE LIKE E070-TRKORR.
DATA: H_ERROR_MSG LIKE IWERRORMSG.
*log message transport created
CLEAR H_ERROR_MSG.
MOVE '42' TO H_ERROR_MSG-ID.
MOVE 'I' TO H_ERROR_MSG-TYPE.
MOVE '733' TO H_ERROR_MSG-NO.
MOVE P_COMMFILE TO H_ERROR_MSG-V1.
PERFORM LOG_MSG
USING C_APPL_LOG_TRANSPORT '2' H_ERROR_MSG.
*log save
PERFORM LOG_SAVE
USING C_APPL_LOG_TRANSPORT.
ENDFORM. "WRITE_LOGFILE
FORM GET_NUMBER *
--> LANGU *
--> NUMBER *
FORM GET_NUMBER
USING LANGU LIKE SY-LANGU
CHANGING NUMBER TYPE C
SUBRC LIKE SY-SUBRC.
CONSTANTS: OBJECT LIKE INRI-OBJECT VALUE 'SIWBTRANSP'.
DATA: NR_RANGE LIKE INRI-NRRANGENR,
RETURNCODE LIKE INRI-RETURNCODE,
ERROR_MSG LIKE IWERRORMSG.
CLEAR SUBRC.
NR_RANGE = '01'.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
NR_RANGE_NR = NR_RANGE
OBJECT = OBJECT
SUBOBJECT = LANGU
IMPORTING
NUMBER = NUMBER
RETURNCODE = RETURNCODE
EXCEPTIONS
INTERVAL_NOT_FOUND = 1
NUMBER_RANGE_NOT_INTERN = 2
OBJECT_NOT_FOUND = 3
QUANTITY_IS_0 = 4
QUANTITY_IS_NOT_1 = 5
INTERVAL_OVERFLOW = 6
OTHERS = 7.
CASE SY-SUBRC.
WHEN 00.
WHEN 01.
PERFORM NUMBER_RANGE_INTERVAL_INSERT
USING NR_RANGE LANGU
CHANGING NUMBER
RETURNCODE.
WHEN OTHERS.
SUBRC = 12.
PERFORM FILL_ERROR_MSG
USING C_MESSAGE_ERROR 736 SY-SUBRC SPACE SPACE SPACE
CHANGING ERROR_MSG.
PERFORM LOG_MSG USING C_APPL_LOG_TRANSPORT 1 ERROR_MSG.
ENDCASE.
CASE RETURNCODE.
WHEN ' '.
WHEN '1'. "Nummer im kritischen Bereich
PERFORM FILL_ERROR_MSG
USING C_MESSAGE_INFO 734 SPACE SPACE SPACE SPACE
CHANGING ERROR_MSG.
PERFORM LOG_MSG USING C_APPL_LOG_TRANSPORT 2 ERROR_MSG.
WHEN '2'. "letzte Nummer vergeben
PERFORM FILL_ERROR_MSG
USING C_MESSAGE_INFO 735 SPACE SPACE SPACE SPACE
CHANGING ERROR_MSG.
PERFORM LOG_MSG USING C_APPL_LOG_TRANSPORT 1 ERROR_MSG.
SUBRC = 11.
ENDCASE.
ENDFORM. "number_get
Message was edited by:
Peter LaiHi i've tried restarting and starting the server, but it didn't help, would it have anything to do with the fact i'm callin sap which is calling JAVA from a .exe program. The .exe program is having problems connecting to the JAVA program as there is no link?
I did a trace as well and this is what it came up with:
Error in program 'startrfc': ======> Exception condition "NO_BATCH" raised.
>>>> [1] <unknown> : EXT <ac: 7> L DDSLOCTE01 >>> CLOSE abrfcrcv.c 429 (23850562)
-{F0776FA3-F1A7-4662-BF7A-D1352735C394}
*> RfcReceive
handle = 1
Data conversion On
Error in program 'startrfc': <* RfcReceive [1] : returns 3:RFC_SYS_EXCEPTION
Error in program 'startrfc': <* RfcCallReceive [1] : returns 3:RFC_SYS_EXCEPTION
>>>> [1] <unknown> : EXT <ac: 8> L DDSLOCTE01 >>> FREE abrfcio.c 3517 (23850562)
-{F0776FA3-F1A7-4662-BF7A-D1352735C394}
Trace file opened at 20070312 164006 GMT Standard T, SAP-REL 640,0,119 RFC-VER 3 818122 MT-SL
*> RfcClose called by external program ...
handle = 1
*> rfcClose called by RFC-Library in file: abrfc.c, line: 532
handle = 1
Trace file opened at 20070312 164006 GMT Standard T, SAP-REL 640,0,119 RFC-VER 3 818122 MT-SL
<* rfcClose
>* RfcClose
Any help or ideas what it could be would be great -
Hi experts
Is it possible to place F4 help for the function module import parameter like If we excute the FM from se37 the input box should need the F4 help.
if possible , let me know the sample code
thanks
saiyes you can do that..
in side the source code ..
write the select statement according to requirement and pass the internal table to below function moduel and return field to yor help field..
call the below fm inside the function module..
'POPUP_WITH_TABLE_DISPLAY' or 'REUSE_ALV_POPUP_TO_SELECT'
see the sample code...
FUNCTION Z_MFG_PLANTS_F4 .
"*"Local Interface:
" IMPORTING
" REFERENCE(W_WERKS) TYPE WERKS OPTIONAL
" IMPORTING
" REFERENCE(W_MATNR) TYPE MANTR OPTIONAL
* Alv popup display
DATA : gc_selfield TYPE slis_selfield,
gt_fieldcat_drd TYPE slis_t_fieldcat_alv WITH HEADER LINE.
p_werks = W_WERKS.
data : begin of t_marc occurs 0,
werks type werks,
matnr type matnr,
end of t_marc
select matnr werks from marc into table t_marc where werks = p_werks.
IF t_disp[] IS NOT INITIAL.
gt_fieldcat_drd-seltext_m = 'Material'.
gt_fieldcat_drd-fieldname = 'MATNR'.
APPEND gt_fieldcat_drd.
CLEAR : gt_fieldcat_drd.
gt_fieldcat_drd-seltext_m = 'WERKS'.
gt_fieldcat_drd-fieldname = ''WERKS'.
APPEND gt_fieldcat_drd.
CLEAR : gt_fieldcat_drd.
* Allow the user to select the required plant
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = 'Material Selection for Plant'
i_selection = 'X'
i_screen_start_column = 5
i_screen_start_line = 5
i_screen_end_column = 70
i_screen_end_line = 20
i_tabname = 'T_MARC'
it_fieldcat = gt_fieldcat_drd[]
IMPORTING
es_selfield = gc_selfield
TABLES
t_outtab = t_MARC
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
READ TABLE t_MARC INDEX gc_selfield-tabindex.
IF sy-subrc = 0.
w_matnr = t_matnr-matnr.
ENDIF.
ENDIF.
ENDFUNCTION.
Prabhudas
Edited by: Prabhu Das on May 21, 2009 7:35 PM -
How to create function module step by step
hi experts,
i am new to ABAP.
can anybody tell me the step by step process on how to create a function module for adding two numbers without using editor screen.
ex: 2+3=5.Hi,
You can only create function modules and function groups using the Function Builder in the ABAP Workbench. For further information, refer to Creating New Function Modules. This section uses an example to illustrate how a function module is created from the point of view of ABAP programming.
Function Groups and Function Modules:
Firstly, we create a new function group DEMO_SPFLI to hold the function module. Then, we can create the new function module.
Parameter Interface:
You can specify the types of interface parameters in function modules in the
same way as the parameter interfaces of subroutines. Since function
modules can be used anywhere in the system, their interfaces can only contain
references to data types that are declared systemwide. These are the elementary
ABAP data types, the systemwide generic types, such as ANY TABLE, and types
defined in the ABAP Dictionary. You cannot use LIKE to refer to data types
declared in the main program.
Exceptions:
Our function module needs an exception that it can trigger if there are no entries
in table SPFLI that meet the selection criterion. The exception NOT_FOUND
serves this function.
Source Code:
Having defined the parameter interface and exceptions, we can now write the
source code of our function module. To do this, choose Source code in the
Function Builder. This opens the ABAP Editor for the include program
L<fgrp>U<xx> (see Function Groups). This is the include that will
hold the program code for the function module;
Data in Function Modules
You can use the TYPES and DATA statements to create local data types and
objects. The interface parameters also behave like local data objects. In
addition, you can access all of the global data of the main program. This data is
defined in the include program L<fgrp>TOP. To open this include, choose Goto
Global data. The global data behaves like the instance attributes of a class.
The first time you call a function module in a particular function group, the data is
loaded into memory. It can then be accessed and changed by all of the function
modules in the group. The system retains the values until the next time a function
module is called.
Calling Subroutines
You use subroutines for local modularization. Function modules can
also use this technique. The function module that they call are defined in the
corresponding main program.
If you only want to call a subroutine from a single function module, it is best to
define them in the same include program as the function module itself, directly
after the ENDFUNCTION statement. These subroutines can be called from all
function modules in the function group, but for clarity, they should only be called
from the function module that precedes them.
If you want to define a subroutine that will be called from several different function
modules, you can define a special include program for it with the name
L<fgrp>F<xx>.
Raising Exceptions
There are two ABAP statements for raising exceptions. They can only be used in
function modules:
RAISE <except>.
and
MESSAGE..... RAISING <except>.
The effect of these statements depends on whether the calling program handles
the exception or not. If the name <except> of the exception or OTHERS occurs
in the EXCEPTIONS addition of the CALL FUNCTION statement, the exception is
handled by the calling program.
If the calling program does not handle the exception
The RAISE statement terminates the program and switches to debugging mode.
The MESSAGE ..... RAISING statement display the specified message. How the
processing continues depends on the message type.
If the calling program handles the exception, both statements return control to the
program. No values are transferred. The MESSAGE ..... RAISING statement
does not display a message. Instead, it fills the system fields SY-MSGID, SYMSGTY,
SY-MSGNO, and SY-MSGV1 to SY-MSGV4.
Source Code of READ_SPFLI_INTO_TABLE
The entire source code of READ_SPFLI_INTO_TABLE looks like this:
FUNCTION READ_SPFLI_INTO_TABLE.
""Local interface:
*" IMPORTING
*" VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
*" EXPORTING
*" VALUE(ITAB) TYPE SPFLI_TAB
*" EXCEPTIONS
*" NOT_FOUND
SELECT * FROM SPFLI INTO TABLE ITAB WHERE CARRID = ID.
IF SY-SUBRC NE 0.
MESSAGE E007(AT) RAISING NOT_FOUND.
ENDIF.
ENDFUNCTION.
The function module reads all of the data from the database table SPFLI where
the key field CARRID is equal to the import parameter ID and places the entries
that it finds into the internal table SPFLI_TAB. If it cannot find any entries, the
exception NOT_FOUND is triggered using MESSAGE...RAISING. Otherwise, the
table is passed to the caller as an exporting parameter.
Regards,
Chandru -
Query reg. function module ERP_IDOC_INPUT_CREDITOR
Hi Experts,
Please tell how to pass the parameter of function module ERP_IDOC_INPUT_CREDITOR.
parameter like input_method,mass processing,pi_xk99_used .
Thanks,
sameeryou can specify any number fields in file and any number fields in internal table,
see the program and when you specify the count variable in your internal table ,if the data is not available,then it will take some defualt values,other than this one it will be okay.
In my system count variable data is 538976288 if the file does not have value.
report x.
DATA: BEGIN OF ITAB_MATNR OCCURS 0,
MATNR LIKE MARA-MATNR,
COUNT TYPE i,
END OF ITAB_MATNR.
data : v_repid like sy-repid.
parameters p_file like rlgrap-filename.
initialization.
v_repid = sy-repid.
at selection-screen on value-request for p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = v_repid
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = p_file
start-of-selection.
refresh itab_matnr.
clear itab_matnr.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = P_FILE
filetype = 'ASC'
TABLES
DATA_TAB = ITAB_MATNR
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
GUI_REFUSE_FILETRANSFER = 8
OTHERS = 9.
IF SY-SUBRC <> 0.
MESSAGE E699(PP) WITH 'Unable to load input file' P_FILE.
ENDIF.
in my file
data is like ( No count)
matnr
12344
ssss
sddd
sddff
after ws_upload :
material count
12344 | 538976288 |
ssss | 538976288 |
sddd | 538976288 |
sddff | 538976288 -
CS_BOM_EXPLOSION :Looking for a general concept of function modules
Dear friends,
As i am new to abap world,i have a few apprehensions regarding using a function module.I am being asked to use CS_BOM_EXPLOSION to explode BOM list.I searched at google,found some pretty links and this suited to my requirements as given under.However what is not clear to me is that up till now i believe EXPORTING is what result i get from function module and importing is what i pass to function module.In this and many other examples i found that values are itself assigned to EXPORTING while importing are internal tables (probably) assigned to some structures standard used.
In short i am not clear how to use this function module.Could someone help ?
CALL FUNCTION 'CS_BOM_EXPLOSION'
EXPORTING
AUMNG = 0
CAPID = ' '
DATUV = DATVAL "valid-from date
EHNDL = '1'
MKTLS = 'X'
MEHRS = 'X'
MMORY = '1'
MTNRV = MATNR
STLAL = LAL "like mast-stlal default '1'
STLAN = LAN "like mast-stlan default '2'
SVWVO = 'X'
VRSVO = 'X'
WERKS = WERKS
mmaps = 'X'
IMPORTING
TOPMAT = STARTMAT "includes structure CSTMAT
TABLES
STBD = TBD "includes structure CSXDOC
STBE = TBE "includes structure CSXEQUI
STBK = TBK "includes structure CSXKLA
STBM = TBM "includes structure CSXMAT
STBP = TBP "includes structure CSXGEN
STBT = TBT "includes structure CSXTDL
EXCEPTIONS
ALT_NOT_FOUND = 1
CALL_INVALID = 2
MISSING_AUTHORIZATION = 3
NO_BOM_FOUND = 4
NO_PLANT_DATA = 5
NO_SUITABLE_BOM_FOUND = 6
OBJECT_NOT_FOUND = 7
CONVERSION_ERROR = 8
OTHERS = 9.Hi,
when you call the function module, EXPORTING is what you pass to the function module and IMPORTING is what the function module returns, TABLES again maybe returned by the function module.
You will need to define table types to get the tables data from the Function module.
ex : it_sTBD type table of tbd.
you will need to define variable to get the IMPORTING data from the FM.
CALL FUNCTION 'CS_BOM_EXPLOSION'
EXPORTING
AUMNG = 0
CAPID = ' '
DATUV = DATVAL "valid-from date
EHNDL = '1'
MKTLS = 'X'
MEHRS = 'X'
MMORY = '1'
MTNRV = MATNR
STLAL = LAL "like mast-stlal default '1'
STLAN = LAN "like mast-stlan default '2'
SVWVO = 'X'
VRSVO = 'X'
WERKS = WERKS
mmaps = 'X'
IMPORTING
TOPMAT = STARTMAT "includes structure CSTMAT
TABLES
STBD = TBD "includes structure CSXDOC
STBE = TBE "includes structure CSXEQUI
STBK = TBK "includes structure CSXKLA
STBM = TBM "includes structure CSXMAT
STBP = TBP "includes structure CSXGEN
STBT = TBT "includes structure CSXTDL
EXCEPTIONS
ALT_NOT_FOUND = 1
CALL_INVALID = 2
MISSING_AUTHORIZATION = 3
NO_BOM_FOUND = 4
NO_PLANT_DATA = 5
NO_SUITABLE_BOM_FOUND = 6
OBJECT_NOT_FOUND = 7
CONVERSION_ERROR = 8
OTHERS = 9.
Hope you are clear abt FM's.
Shruthi -
Error in function module WWW_DISPATCH_REQUEST
Hi,
I am upgrading standalone ITS to integrated ITS.
In this process I refered to OSS notes number 979467. and i maintained all service files in WEBRFC service.
and when i am testing my services i am getting an error in the browser
saying:
'Error in function module WWW_DISPATCH_REQUEST'
Parameter Name Parameter value
sap-client 100
~USERAGENTTYPE M
~USERAGENTVERSION 6
~CALLED_FROM_ITS 6
~URLWGATE %_WEBRFC_HTTP_SERVICE
~SESSION SID:ANON:essap00_MIL_02:ByAZnf5VaI5DZcamNtjfwtDYdKZb5gkPV4oG3lBO-ATT
~URLIMAGEPATH C:\tmp\sapicons\
So i am not able to find an where i went wrong. Please suggest me or guide me to resolve the above error.
Thanks in advanceI am not sure this is an issue with getting the mime files for your webrfc service. If it is, please try the following:
From page 13 of the SAP document "Developing IACs with the SAP Integrated ITS"
MIME URL
MIME objects in the integrated ITS are accessed at runtime directly in the database. For this, a special ICF service mimes exists with the http request handler CL_HTTP_EXT_ITS_MIMES, which is stored in the ICF path defaulthost u2192 sap u2192 public u2192 bc u2192 its. It is used to fill parameter ~urlmime with the value /sap/public/bc/its/mimes. Also function mimeURL() returns this value as a result.
The ICF service mimes must be active if you want to execute an ITS service that accesses MIME objects.
Changes to the HTML templates are necessary only if the MIME URL in the ITS service does not contain the SAP default values.
Developing
Please also check out this OSS note 1076200 - WebReporting: Icon support for WebRFC Service
It may applies to your case.
The last parameter "~URLIMAGEPATH C:\tmp\sapicons\" may be the cause of the error.
Hope it helps.
Edited by: Danny Mak on Nov 23, 2009 8:03 PM
Maybe you are looking for
-
Hello!! Good, above all I apologize with beginner's mail. I am beginning in Java, and I have been presented a problem that I have to solve. I need to create an interface to send and to receive data of files dbf (files dbase) to Oracle.
-
Specifying alphabetic sort order for other languages.
The alphabetic sort order differs slightly for other languages then the English one. I rewrite the alphabetics in the special text flow of the Reference Page of the index file, regenerate the index file, but the result is wrong. The special Group Tit
-
Update statement, with dups
This query has worked well for me, but now, the driving table (tt) has duplicates in it, because of a database upgrade and the client wants to keep the duplicates there is value to them there... The problem is that now I get, you guessed it: ORA-0142
-
How to add my own pdf into "Kobo Books"?
Anyone knows how to add my own PDFs into "Kobo Books"? The "Adobe Reader" in playbook doesn't have bookmark function.
-
Title by default - Infotype 0002
Hello, colleagues. I´m starting in this SAP´s world and I have one doubt. I´m trying to do a DYNAMIC ACTION that can fill the Q0002-ANRED (infotype 0002), by default, with the title "Sr." ("Mr."), but it´s not working. Someone can help me in this sit