Questions tagged [function-module]

A function module is an SAP sub-program containing reusable code. They can be used to modularise ABAP programs. This tag can be used for issues using predefined function modules and for problems writing and implementing user created function modules.

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.

The Function Builder also has a release process for function modules. This ensures that incompatible changes cannot be made to any function modules that have already been released. This applies particularly to the interface. Programs that use a released function module will not cease to work if the function module is changed.

Useful Links

Related Tags

84 questions
6
votes
1 answer

How to test an RFC module that exists only in remote system?

I'm debugging a solution where a program in one SAP system (A) calls a remote-enabled function module in a different SAP system (B) via RFC connection. Is there a way to 'test-run' the RFC from A, like we normally do with SE37 for local function…
maillard
  • 680
  • 1
  • 14
  • 27
6
votes
1 answer

Syntax of a functional method call as an FM parameter?

I have the following piece of code. REPORT ZZY. CLASS lcl_main DEFINITION FINAL CREATE PRIVATE. PUBLIC SECTION. CLASS-METHODS: convert_to_xstring IMPORTING i_param1 TYPE i i_param2 TYPE i RETURNING …
Jagger
  • 10,350
  • 9
  • 51
  • 93
5
votes
3 answers

Pass object instances to RFC function modules

With ABAP construction STARTING NEW TASK I can start a separate task running independently of the current, e.g. for batch execution. I would like to hand over an Object instance RFC functions don't accept these kind of parameters. Is there somebody…
Hartmut Pfarr
  • 5,534
  • 5
  • 36
  • 42
4
votes
1 answer

Function Module for Calculation Schema in MM

I am looking for a function module that does the calculation schema for arbitrary material. When opening ME23N and looking for the position details you have the tab Conditions where the table showing contains the base price and various conditions…
Radinator
  • 1,048
  • 18
  • 58
4
votes
2 answers

Manual function module transport into another system existing function group?

I need to transport function modules from one SAP system into another, which are not connected to each other. I am using CG3Y/CG3Z to download/upload cofiles and data files. I add the transport to import list in STMS. There is function group to…
Maritas225
  • 43
  • 4
4
votes
2 answers

Optional parameters in function modules?

I have an ABAP-OO class where I want to call a function module inside a method foo( ). There are two cases (A & B) where I have to use method foo( ). Lets say case A is default and uses requires the function module like this: METHOD foo. CALL…
SDD64
  • 706
  • 13
  • 28
4
votes
1 answer

LDAPMAP - Mapping SAP data to LDAP via RSLDAPSYNC_USER function

We are looking at syncing some of our LDAP (Active Directory) data with what is stored in SAP. SAP provides several function modules that allow you to write a custom program to handle mapping the data, but we are looking to use the provided solution…
Michael Freake
  • 1,197
  • 2
  • 14
  • 35
3
votes
2 answers

Parameter is not type-compatible with formal parameter when method is called from FM

A static public class method, zcl_abc=>dosomething, has an importing parameter it_lines type TLINE_T optional And there is a FM called zfm_dosame. It has a parameter TABLES IT_LINES TYPE TLINE_T OPTIONAL zfm_dosame calls…
Dustin Sun
  • 5,292
  • 9
  • 49
  • 87
3
votes
1 answer

FAGL_ACCOUNT_ITEMS_GL_API doesn't return any data by I_POSTING_DATES range

In SE37, I am trying to execute FAGL_ACCOUNT_ITEMS_GL_API function module but in import parameters area I_POSTING_DATE is not working and output brings all records to BUDAT column although I insert 01.05.2020 - 30.05.2020. Complete input is: SIGN…
sinan
  • 31
  • 3
3
votes
1 answer

Call logical database via Function Module?

Is there a function Module to call a logical Database via function module or classes? In my case I would need PNPCE, so it is the HCM Module.
Sasku
  • 517
  • 7
  • 23
3
votes
2 answers

Return dynamically-typed table rows via RFC?

I need to return the rows of some tables via RFC, and the names of these tables are not known before the execution. I have this statement which gets executed in a loop: SELECT * up to iv_max_count rows into table FROM…
guettli
  • 25,042
  • 81
  • 346
  • 663
3
votes
2 answers

Maximum records in function module "tables" parameter

What's the maximum number of records that can be passed to a function module via a tables parameter?
BenV
  • 12,052
  • 13
  • 64
  • 92
3
votes
3 answers

Concatenate fields of a dynamic structure

How do we concatenate fields of a dynamic work area? The idea is in the below code: LOOP AT lt_final INTO DATA(ls_final). CONCATENATE ls_final-field1 ls_final-field2 ls_final-field3 ls_final-field4 …
Czarinaaaaa29
  • 311
  • 2
  • 8
  • 23
3
votes
2 answers

Why is this structure declaration allowed in a built-in Function Module but not in a new one?

I'm working on a Function Module to assist with dealing with included text with logic embedded. While looking into the way SAP handles SAPScript files and parses the logic I found a structure that is declared as so: DATA BEGIN OF events OCCURS 100. …
JRSofty
  • 1,216
  • 1
  • 24
  • 49
3
votes
1 answer

Get GOS attachment list for notification via BAPI

I need to find a BAPI (or a chain of BAPIs?) to read the Notification Attachment List (GOS) using as input the Notification number. I've tried many BAPIs, but the only functional result was via SO_OBJECT_READ FM to which I passed Object ID (which I…
SimonFreeman
  • 205
  • 1
  • 7
  • 17
1
2 3 4 5 6