Global declaration in function group.
I have a function group within which i have 6 function modules. I want to declare global data in the function group which can be used in all the function modules. Is it possible? If yes then please give me the details..
Thanks,
Abhishek
Each function module is nothing but INCLUDE program. So, if you see the list of includes, there will be a TOP include which is common and will be accessible to all other function modules.
You can declare variables there.
Regards,
Ravi
Note - Please mark all the helpful answers
Similar Messages
-
What's the lifecycle of Global Data in Function Group?
Hello,
I thought the Global Data in function group will be cleaned for each call stack. While it seems not so.
With a BSP web application, it seems the global data of the function group would persist untill the session times out.
I didn't find exact description regarding this. Could anybody help clarify this? For web session and SAPGUI session.
Thanks and regards,
Saidhi,
based on my understanding of the global data in the funtion group, let's say, when you call a FM a in FG b, all of the content in the FG b is loaded into the stack. so the global data is cleaned after your program or transaction is complete. but this will not happen when the called FM is finished, coz when you call a FM , the whole FG is loaded, so if you call FM c in FG b after you callling FM a, your program will not load the whole FG again. -
Hello Consultants,
my requirement is, i have created one function group and it holds around 6 function modules. when i call my first FM in the group, i want to pass header data and store as a global data and i want to use the same data in other FM also. I don't want pass the same data all the times. how is it possible?
I tried by declaring as STATICS but no use..:-(
Thanks a lot in advance...
Rgds,
MohanHi Mohan,
The best Idea is to use the Global Definition in TOP include at Function Group level.
You may be loosing data.. .Because U may have called this FM in Different reports...
If u call all FMs in SAME report then the Global Data will remain present all the time.. there is no second thought about that..
Please reward this if u are convinced....:)
DARSHAN -
How to declare constant across a function group?
Hi,
I want to define constants for use within a whole function group. How could it be done?
Thanks,
SaidYou can maintain constansts or global variable in the 'Global Data' of function group.
Please go to the function group through SE37 transaction and select display or change. in the Popup select for mainprogram in the mainprogram you can see the a include program which will be with 'Global Data'. this is the section where you can maintain the global variables.
Ex;
include lwbabaptop. " Global Data
Thanks, -
Function group in tablenaintenance generator.
hi experts,
can anybody please tell me why we create a function group
while creating a table maintenance generator?
what is the utility of creating a function group.
regards
pankajFunction 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 (if it has not already been loaded). For further information, refer to Organization of External Procedure Calls.
The following diagram shows the structure of a function group: The name of a function group, fgrpcan be up to 26 characters long. This is used by the system to create the components of the group (main program and corresponding include programs). When you create a function group or function module in the Function Builder , the main program and include programs are generated automatically.
The main program SAPLfgrp contains nothing but the INCLUDE statements for the following include programs:
キ LfgrpTOP. This contains the FUNCTION-POOL statement (equivalent for a function group of the REPORT or PROGRAMstatement) and global data declarations for the entire function group.
キ LfgrpUXX. This contains further INCLUDEstatements for the include programs LfgrpU01, LfgrpU02,... These includes contain the actual function modules.
キ The include programs LfgrpF01, LfgrpF02,... can contain the coding of subroutines that can be called with internal subroutine calls from all function modules of the group.
The creation of these INCLUDE programs is supported from the ABAP Workbench by forward navigation (for example creation of a subroutine include by double clicking on the name of a subroutine in a PERFORM statement within a function module).
You cannot declare a COMMON PART in a function group. Function groups have their own table work areas (TABLES). Function groups encapsulate data. In this respect, they are a precursor of ABAP Objects (see From Function Groups to Objects ).
All of the function modules in a function group can access the global data of the group. For this reason, you should place all function modules that use the same data in a single function group. For example, if you have a set of function modules that all use the same internal table, you could place them in a function group containing the table definition in its global data.
Function groups, like executable programs and module pools, can contain screens (selection screens and lists) as components. User input is processed either in dialog modules or in the corresponding event blocks in the main program of the function group. There are special include programs in which you can write this code. In this way, you can use function groups to encapsulate single screens or screen sequences.
In SAP, it is a function group - instead of function - that is loaded into active memory.
Function ( or function module ) is the one that you call from the program to do things.
A function group contains functionally related function modules, global variables and procedures .
To display / edit function module you use SE37,
To display / edit function group you use SE80 .
Reward if found helpful,
regards
palak -
Global vairable in Function module
Hello Friends,
How to declare a global variable in function module, other than declaring in Function group/data section of function module.
Regards
Elini.PHi Elini,
You can declare the global data after the ENDFUNCTION statement in your function module if you wish, or you can include your own include in the TOP include.
Actually you can declare global data just about anywhere in your function group as long as its not in between statments like FORM ENDFORM or FUNCTION ENDFUNCTION.
I agree with Anand, though, why?
Cheers,
Brad -
Global data declaration in a function group..
hi,
i have created a function group and created 2 FM in that. Both use some common data declarations so i declared those variables in the top include of the function group named LZFGXXXTOP.
is this include automatically recognized in my FM or do i have to include it ? sample statements please ..
thksSorry Rich, I fail to understand what you are saying.
in simple terms, i need to have some common data declarations for 2 function modules in a function group. Can u pl outline the steps I need to follow ? also i need to have a common set of form routines (FORM ENDFORM) to be used in these 2 function modules, where do i create these ?
thks a lot -
Where to set up a TYPE-POOL Declaration in a Function Group ?
Hi,
I ve got a Function Group.
I set up a Function Module in the Function Group.
I must use TABLES I_T_SELECT TYPE SBIWA_T_SELECT.
I get the error:
Type pool SBIWA has not been declared
Message no. FL031
Diagnosis
You used a type from type pool & in the interface of a function module.
Procedure
For the program to be syntactically correct, you must
declare the type pool in the global data declaration of the
function group using the 'TYPE-POOLS: &.' statement.
Where / How do I set up a Type Pool in the global data declaration of the
function group ?
Where / what is the global data Declaration of the Function Group ?
Thank You
Best Wishes
MartinHello Martin,
First off:
TABLES I_T_SELECT TYPE SBIWA_T_SELECT.
Correct me if I'm mistaken here, but tables is expecting a name of a DDIC structure. It is then creating a work area using that structure.
If you have to declare an internal table, the correct code would be:
DATA i_t_select TYPE TABLE OF sbiwa_t_select.
Or:
TABLES sbiwa_t_select.
Regarding your questions:
A global data declaration of a function group is just what it says, a point where you can declare your data usable for the whole function group.
This is usually an Include.
That said, you can fix your issue by creating an Include in your function group.
Within that include you have to write:
TYPE-POOLS: pool1, pool2, pool3.
or, in case you only have one type pool:
TYPE-POOLsbiwa
After creating the include, you have to point your function module to that file.
INCLUDE include_name.
Kind regards,
Michael -
A list of global objects of the function group "bbp_bid_inv"
Hi everyone,
Somebody have a list of all (or some) global objects ( i mean : internal tables, structures, transparent tables, ...etc) of the function group "bbp_bid_inv" ?
Thanks & regardsfind out in se 80
cheers! -
Function Groups and Function Modules
Hi,
Can anyone give me the detail steps for creating Function Group and then from that function group creation of function module with example?
Regards,
ChandruHi,
Function Group creation -
A function group is a program that contains function modules. With each R/3 system, SAP supplies more than 5,000 pre-existing function groups.
In total, they contain more than 30,000 function modules. If the functionality you require is not already covered by these SAP-supplied function modules, you can also create your own function groups and function modules.
We can put all the relevant function modules under one function group and all the global variables can be declared in this FG.
FG Creation:
1) Function group can be created in SE80. There choose the 'Function Group' from the list of objects.
2) Then give a name for ur function group (starts with Y or Z) and press ENTER.
3) The click 'YES' in the create object dialog box and give a short desc. for this FG and save.
Function Module:
A function module is the last of the four main ABAP/4 modularization units. It is very similar to an external subroutine in these ways:
Both exist within an external program.
Both enable parameters to be passed and returned.
Parameters can be passed by value, by value and result, or by reference.
The major differences between function modules and external subroutines are the following:
Function modules have a special screen used for defining parameters-parameters are not defined via ABAP/4 statements.
tables work areas are not shared between the function module and the calling program.
Different syntax is used to call a function module than to call a subroutine.
Leaving a function module is accomplished via the raise statement instead of check, exit, or stop.
A function module name has a practical minimum length of three characters and a maximum length of 30 characters. Customer function modules must begin with Y_ or Z_. The name of each function module is unique within the entire R/3 system.
Defining Data within a Function Module
Data definitions within function modules are similar to those of subroutines.
Within a function module, use the data statement to define local variables that are reinitialized each time the function module is called. Use the statics statement to define local variables that are allocated the first time the function module is called. The value of a static variable is remembered between calls.
Define parameters within the function module interface to create local definitions of variables that are passed into the function module and returned from it (see the next section).
You cannot use the local statement within a function module. Instead, globalized interface parameters serve the same purpose. See the following section on defining global data to learn about local and global interface parameters.
Defining the Function Module Interface
To pass parameters to a function module, you must define a function module interface. The function module interface is the description of the parameters that are passed to and received from the function module. It is also simply known as the interface. In the remainder of this chapter, I will refer to the function module interface simply as the interface.
To define parameters, you must go to one of two parameter definition screens:
1) Import/Export Parameter Interface
2) Table Parameters/Exceptions Interface
Then in the FM interface screen, give the following
1) Import parameters
2) Export parameters
3) Changing parameters
Then give
1) Define internal table parameters
2) Document exceptions
You enter the name of the parameter in the first column and the attributes of the parameter in the remaining columns. Enter one parameter per row.
Import parameters are variables or field strings that contain values passed into the function module from the calling program. These values originate outside of the function module and they are imported into it.
Export parameters are variables or field strings that contain values returned from the function module. These values originate within the function module and they are exported out of it.
Changing parameters are variables or field strings that contain values that are passed into the function module, changed by the code within the function module, and then returned. These values originate outside the function module. They are passed into it, changed, and passed back.
Table parameters are internal tables that are passed to the function module, changed within it, and returned. The internal tables must be defined in the calling program.
An exception is a name for an error that occurs within a function module. Exceptions are described in detail in the following section.
Syntax for the call function Statement
The following is the syntax for the call function statement.
call function 'F'
[exporting p1 = v1 ... ]
[importing p2 = v2 ... ]
[changing p3 = v3 ... ]
[tables p4 = it ... ]
[exceptions x1 = n [others = n]].
where:
F is the function module name.
p1 through p4 are parameter names defined in the function module interface.
v1 through v3 are variable or field string names defined within the calling program.
it is an internal table defined within the calling program.
n is any integer literal; n cannot be a variable.
x1 is an exception name raised within the function module.
The following points apply:
All additions are optional.
call function is a single statement. Do not place periods or commas after parameters or exception names.
The function module name must be coded in uppercase. If it is coded in lowercase, the function will not be found and a short dump will result.
Use the call function statement to transfer control to a function module and specify parameters. Figure 19.9 illustrates how parameters are passed to and received from the function module.
sample FM
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT =
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab =
EXCEPTIONS
PROGRAM_ERROR = 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.
Example
1 report ztx1905.
2 parameters: op1 type i default 2, "operand 1
3 op2 type i default 3. "operand 2
4 data rslt type p decimals 2. "result
5
6 call function 'Z_TX_DIV'
7 exporting
8 p1 = op1
9 p2 = op2
10 importing
11 p3 = rslt.
12
13 write: / op1, '/', op2, '=', rslt.
Regards,
Shanthi.P
Reward points if useful ****
Edited by: shanthi ps on Jan 26, 2008 12:03 PM -
Function group memory with RFC calls
We have a system where a web front-end interacts with our 4.6C system through RFC calls.
I am having a number of problems where variables declared in a function group are not being cleared out between separate RFC calls to functions in the same group.
I would not have expected separate RFC calls from an external system to use the same memory area.
I have seen this happen at other sites too, but have never found an explanation for it.
Has anyone else experienced this problem and if so can you give me more information about why it happens?
Thanks for you help,
Denis.This does make sense as global data within a function group is accessable by all function modules of the group. Normally, in the ABAP system, you call multiple function modules of the same group, and they all share the data. If you are calling from outside the system, I would expect a different behavior if you are connecting one by one. But if you are using a pooled connection, this may be the issue. Not sure though. It seems that the session on r/3 has not ended and you are accessing the same when calling the second function module. Is there any function module of the group that looks like it is a "refresher". In some groups, there is a function module that will refresh the global data.
http://help.sap.com/saphelp_46c/helpdata/en/9f/db992335c111d1829f0000e829fbfe/frameset.htm
Regards,
Rich Heilman -
Error - Copying Function Group STXW
Friends,
I am trying to copy Function Group STXW into Z_STXW with one function module CONVERT_ABAPSPOOLJOB_2_PDF.
But I am not able to activate the main program SAPLZ_STXW. I get an error 'Field OTF is unknown'. But OTF is an internal table already defined in the function module CONVERT_ABAPSPOOLJOB_2_PDF (I have activated this FM). I also have activated all other includes.
Please resolve. Thanks in advance.
Warm Regards
Sagar<u>Scenario 1(when you copied only 1 function module).</u>
If you are able to successfully activate, then the problem may be with navigation index not being regenerated correctly. To do that, go to your function module display in SE37. Once inside the source code, in the menu, 'Utilities--> update navigation index' will do the trick.
<u>Scenario 2(where you copied all the function modules)</u>
Here the error is coming because the function module in question has its parameters declared as global. Probably when you copied yours are not. You can check that in attributes tab of the function module. To globalize your function module's parameters, you have to be in change mode. In the menu, 'Edit>Interface> Globalize parameter' will do the trick. -
Is there any program to download function group?
Hi
I just want to download whole function group and dictionary object (table type and structure) in specific package.
not need to table contents though.
is there anyway to download these object quick?Hi
You can try this code
[code]tables: trdir, seoclass, tfdir, enlfdir, dd02l.
Types
text element structure
types: tTextTable like textpool.
GUI titles
types: tGUITitle like d347t.
Message classes
types: begin of tMessage,
arbgb like t100-arbgb,
stext like t100a-stext,
msgnr like t100-msgnr,
text like t100-text,
end of tMessage.
Screen flow.
types: begin of tScreenFlow,
screen like d020s-dnum,
code like d022s-line,
end of tScreenFlow.
Holds a table\structure definition
types: begin of tDictTableStructure,
fieldname like dd03l-fieldname,
position like dd03l-position,
keyflag like dd03l-keyflag,
rollname like dd03l-rollname,
domname like dd03l-domname,
datatype like dd03l-datatype,
leng like dd03l-leng,
ddtext like dd04t-ddtext,
end of tdictTableStructure.
Holds a tables attributes + its definition
types: begin of tDictTable,
tablename like dd03l-tabname,
tableTitle like dd02t-ddtext,
iStructure type tDictTableStructure occurs 0,
end of tDictTable.
Include program names
types: begin of tInclude,
includeName like trdir-name,
includeTitle like tftit-stext,
end of tInclude.
Exception class texts
types: begin of tConcept,
constName type string,
concept type sotr_conc,
end of tConcept.
Method
types: begin of tMethod,
cmpName like vseomethod-cmpname,
descript like vseomethod-descript,
exposure like vseomethod-exposure,
methodKey type string,
end of tMethod.
Class
types: begin of tClass,
scanned(1),
clsname like vseoclass-clsname,
descript like vseoclass-descript,
msg_id like vseoclass-msg_id,
exposure like vseoclass-exposure,
state like vseoclass-state,
clsfinal like vseoclass-clsfinal,
r3release like vseoclass-r3release,
iMethods type tMethod occurs 0,
iDictStruct type tDictTable occurs 0,
iTextElements type tTextTable occurs 0,
iMessages type tMessage occurs 0,
iConcepts type tConcept occurs 0,
textElementKey type string,
publicClassKey type string,
privateClassKey type string,
protectedClassKey type string,
typesClassKey type string,
exceptionClass type i,
end of tClass.
function modules
types: begin of tFunction,
functionName like tfdir-funcName,
functionGroup like enlfdir-area,
includeNumber like tfdir-include,
functionMainInclude like tfdir-funcName,
functionTitle like tftit-stext,
topIncludeName like tfdir-funcName,
progname like tfdir-pname,
programLinkName like tfdir-pname,
messageClass like t100-arbgb,
iTextElements type tTextTable occurs 0,
iSelectiontexts type tTextTable occurs 0,
iMessages type tMessage occurs 0,
iIncludes type tInclude occurs 0,
iDictStruct type tDictTable occurs 0,
iGUITitle type tGUITitle occurs 0,
iScreenFlow type tScreenFlow occurs 0,
end of tFunction.
types: begin of tProgram,
progname like trdir-name,
programTitle like tftit-stext,
subc like trdir-subc,
messageClass like t100-arbgb,
iMessages type tMessage occurs 0,
iTextElements type tTextTable occurs 0,
iSelectiontexts type tTextTable occurs 0,
iGUITitle type tGUITitle occurs 0,
iScreenFlow type tScreenFlow occurs 0,
iIncludes type tInclude occurs 0,
iDictStruct type tDictTable occurs 0,
end of tProgram.
Internal tables
Dictionary object
data: iDictionary type standard table of tDictTable with header line.
Function modules.
data: iFunctions type standard table of tFunction with header line.
Tree display structure.
data: iTreeDisplay type standard table of snodetext with header line.
Message class data
data: iMessages type standard table of tMessage with header line.
Holds a single message class an all of its messages
data: iSingleMessageClass type standard table of tMessage with header line.
Holds program related data
data: iPrograms type standard table of tProgram with header line.
Classes
data: iClasses type standard table of tClass with header line.
Table of paths created on the SAP server
data: iServerPaths type standard table of string with header line.
Table prototypes
data: dumiDictStructure type standard table of tDictTableStructure.
data: dumiTextTab type standard table of tTextTable.
data: dumiIncludes type standard table of tInclude.
data: dumiHtml type standard table of string.
data: dumiHeader type standard table of string .
data: dumiScreen type standard table of tScreenFlow .
data: dumIGUITitle type standard table of tGUITitle.
data: dumiMethods type standard table of tMethod.
data: dumiConcepts type standard table of tConcept.
Global objects
data: objFile type ref to cl_gui_frontend_services.
data: objRuntimeError type ref to cx_root.
Constants
constants: VERSIONNO type string value '1.3.1'.
constants: TABLES type string value 'TABLES'.
constants: TABLE type string value 'TABLE'.
constants: LIKE type string value 'LIKE'.
constants: TYPE type string value 'TYPE'.
constants: TYPEREFTO type string value 'TYPE REF TO'.
constants: STRUCTURE type string value 'STRUCTURE'.
constants: LOWSTRUCTURE type string value 'structure'.
constants: OCCURS type string value 'OCCURS'.
constants: FUNCTION type string value 'FUNCTION'.
constants: CALLFUNCTION type string value ' CALL FUNCTION'.
constants: MESSAGE type string value 'MESSAGE'.
constants: INCLUDE type string value 'INCLUDE'.
constants: LOWINCLUDE type string value 'include'.
constants: DESTINATION type string value 'DESTINATION'.
constants: IS_TABLE type string value 'T'.
constants: IS_PROGRAM type string value 'P'.
constants: IS_SCREEN type string value 'S'.
constants: IS_GUITITLE type string value 'G'.
constants: IS_DOCUMENTATION type string value 'D'.
constants: IS_MESSAGECLASS type string value 'MC'.
constants: IS_FUNCTION type string value 'F'.
constants: IS_CLASS type string value 'C'.
constants: IS_METHOD type string value 'M'.
constants: ASTERIX type string value '*'.
constants: COMMA type string value ','.
constants: PERIOD type string value '.'.
constants: DASH type string value '-'.
constants: TRUE type i value 1.
constants: FALSE type i value 0.
constants: LT type string value '<'.
constants: GT type string value '>'.
constants: UNIX type string value 'UNIX'.
constants: NON_UNIX type string value 'not UNIX'.
constants: BACKGROUND_COLOUR type string value '#FFFFE0'.
constants: COLOUR_WHITE type string value '#FFFFFF'.
constants: COLOUR_BLACK type string value '#000000'.
constants: COLOUR_YELLOW type string value '#FFFF00'.
constants: COMMENT_COLOUR type string value '#0000FF'.
constants: HTMLEXTENSION type string value 'html'.
constants: TEXTEXTENSION type string value 'txt'.
Global variables
data: statusBarMessage(100).
data: forcedExit type i value 0.
data: startTime like sy-uzeit.
data: runTime like sy-uzeit.
data: downloadFileExtension type string.
data: downloadFolder type string.
data: serverSlashSeparator type string.
data: frontendSlashSeparator type string.
data: slashSeparatorToUse type string.
data: serverFilesystem type filesys_d.
data: serverFolder type string.
data: frontendOpSystem type string.
data: serverOpSystem type string.
data: customerNameSpace type string.
ranges: soProgramName for trdir-name.
ranges: soAuthor for usr02-bname.
ranges: soTableNames for dd02l-tabname.
ranges: soFunctionName for tfdir-funcName.
ranges: soClassName for vseoclass-clsname.
ranges: soFunctionGroup for enlfdir-area.
field-symbols: <waDictStruct> type tDictTable.
Selection screen declaration
Author
selection-screen: begin of block b1 with frame title tBlock1.
selection-screen begin of line.
selection-screen comment 5(23) tAuth.
parameters: pAuth like usr02-bname memory id MAUTH.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 5(36) tPmod.
parameters: pMod as checkbox.
selection-screen end of line.
Local objects
selection-screen begin of line.
selection-screen comment 5(36) t$tmp.
parameters: p$tmp as checkbox default ''.
selection-screen end of line.
selection-screen: end of block b1.
selection-screen begin of block b2 with frame title tBlock2.
Tables
selection-screen begin of line.
parameters: rTable radiobutton group r1.
selection-screen comment 5(15) tRtable.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 10(15) tPtable.
select-options: soTable for dd02l-tabname.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 10(79) tTnote.
selection-screen end of line.
Message classes
selection-screen begin of line.
parameters: rMess radiobutton group r1.
selection-screen comment 5(18) tPMes.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 10(18) tMname.
parameters: pMname like t100-arbgb memory id MMNAME.
selection-screen end of line.
Function modules
selection-screen begin of line.
parameters: rFunc radiobutton group r1.
selection-screen comment 5(30) tRfunc.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 10(15) tPfname.
select-options: soFname for tfdir-funcName.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 10(15) tFgroup.
select-options: soFgroup for enlfdir-area.
selection-screen end of line.
Classes
selection-screen begin of line.
parameters: rClass radiobutton group r1.
selection-screen comment 5(30) tRClass.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 10(15) tPcName.
select-options: soClass for seoclass-clsname.
selection-screen end of line.
Programs / includes
selection-screen begin of line.
parameters: rProg radiobutton group r1 default 'X'.
selection-screen comment 5(18) tProg.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 10(15) tRpname.
select-options: soProg for trdir-name.
selection-screen end of line.
selection-screen skip.
Language
selection-screen begin of line.
selection-screen comment 1(18) tMLang.
parameters: pMLang like t100-sprsl default 'EN'.
selection-screen end of line.
Package
selection-screen begin of line.
selection-screen comment 1(18) tPack.
parameters: pPack like tadiv-devclass memory id MPACK.
selection-screen end of line.
Customer objects
selection-screen begin of line.
selection-screen comment 1(27) tCust.
parameters: pCust as checkbox default 'X'.
selection-screen comment 32(25) tNRange.
parameters: pCName type namespace memory id MNAMESPACE.
selection-screen end of line.
selection-screen: end of block b2.
Additional things to download.
selection-screen: begin of block b3 with frame title tBlock3.
selection-screen begin of line.
selection-screen comment 1(33) tPtext.
parameters: pText as checkbox default 'X' memory id MTEXT.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(33) tMess.
parameters: pMess as checkbox default 'X' memory id MMESS.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(33) tPinc.
parameters: pInc as checkbox default 'X' memory id MINC.
selection-screen comment 40(20) tRecc.
parameters: pReci as checkbox default 'X' memory id MRECI.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(33) tPfunc.
parameters: pFunc as checkbox default 'X' memory id MFUNC.
selection-screen comment 40(20) tRecf.
parameters: pRecf as checkbox default 'X' memory id MRECF.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(33) tDoc.
parameters: pDoc as checkbox default 'X' memory id MDOC.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(33) tPscr.
parameters: pScr as checkbox default 'X' memory id MSCR.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(33) tPdict.
parameters: pDict as checkbox default 'X' memory id MDICT.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(33) tSortT.
parameters: pSortT as checkbox default ' ' memory id MSORTT.
selection-screen end of line.
selection-screen: end of block b3.
File details
selection-screen: begin of block b4 with frame title tBlock4.
selection-screen begin of line.
selection-screen comment 1(20) tPhtml.
parameters: pHtml radiobutton group g1 default 'X'.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 5(29) tComm.
parameters: pComm as checkbox default 'X'.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 5(29) tBack.
parameters: pBack as checkbox default 'X'.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(20) tPtxt.
parameters: pTxt radiobutton group g1.
selection-screen end of line.
selection-screen skip.
Download to SAP server
selection-screen begin of line.
selection-screen comment 1(25) tServ.
parameters: pServ radiobutton group g2.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 8(20) tSPath.
parameters: pLogical like filename-fileintern memory id MLOGICAL.
selection-screen end of line.
selection-screen comment /28(60) tSDPath.
Download to PC
selection-screen begin of line.
selection-screen comment 1(25) tPc.
parameters: pPc radiobutton group g2 default 'X'.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 8(20) tPpath.
parameters: pFolder like rlgrap-filename memory id MFOLDER.
selection-screen end of line.
selection-screen: end of block b4.
Display options
selection-screen: begin of block b5 with frame title tBlock5.
Display final report
selection-screen begin of line.
selection-screen comment 1(33) tRep.
parameters: pRep as checkbox default 'X'.
selection-screen end of line.
Display progress messages
selection-screen begin of line.
selection-screen comment 1(33) tProMess.
parameters: pProMess as checkbox default 'X'.
selection-screen end of line.
selection-screen: end of block b5.
Display a directory picker window
at selection-screen on value-request for pFolder.
data: objFile type ref to cl_gui_frontend_services.
data: pickedFolder type string.
data: initialFolder type string.
if sy-batch is initial.
create object objFile.
if not pFolder is initial.
initialFolder = pFolder.
else.
objFile->get_temp_directory( changing temp_dir = initialFolder
exceptions cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3 ).
endif.
objFile->directory_browse( exporting initial_folder = initialFolder
changing selected_folder = pickedFolder
exceptions cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3 ).
if sy-subrc = 0.
pFolder = pickedFolder.
else.
write: / 'An error has occured picking a folder'.
endif.
endif.
at selection-screen.
case 'X'.
when pPc.
if pFolder is initial.
User must enter a path to save to
message e000(oo) with 'You must enter a file path'.
endif.
when pServ.
if pLogical is initial.
User must enter a logical path to save to
message e000(oo) with 'You must enter a logical file name'.
endif.
endcase.
at selection-screen on pLogical.
if not pServ is initial.
call function 'FILE_GET_NAME' exporting logical_filename = pLogical
importing file_name = serverFolder
exceptions file_not_found = 1
others = 2.
if sy-subrc = 0.
if serverFolder is initial.
message e000(oo) with 'No file path returned from logical filename'.
else.
Path to display on the selection screen
tSDPath = serverFolder.
Remove the trailing slash off the path as the subroutine buildFilename will add an extra one
shift serverFolder right deleting trailing serverSlashSeparator.
shift serverFolder left deleting leading space.
endif.
else.
message e000(oo) with 'Logical filename does not exist'.
endif.
endif.
at selection-screen on value-request for soProg-low.
call function 'REPOSITORY_INFO_SYSTEM_F4' exporting object_type = 'PROG'
object_name = soProg-low
suppress_selection = 'X'
use_alv_grid = ''
without_personal_list = ''
importing object_name_selected = soProg-low
exceptions cancel = 1.
at selection-screen on value-request for soProg-high.
call function 'REPOSITORY_INFO_SYSTEM_F4' exporting object_type = 'PROG'
object_name = soProg-high
suppress_selection = 'X'
use_alv_grid = ''
without_personal_list = ''
importing object_name_selected = soProg-high
exceptions cancel = 1.
at selection-screen on value-request for soClass-low.
call function 'F4_DD_ALLTYPES' exporting object = soClass-low
suppress_selection = 'X'
display_only = ''
only_types_for_clifs = 'X'
importing result = soClass-low.
at selection-screen on value-request for soClass-high.
call function 'F4_DD_ALLTYPES' exporting object = soClass-high
suppress_selection = 'X'
display_only = ''
only_types_for_clifs = 'X'
importing result = soClass-high.
at selection-screen on value-request for soFName-low.
call function 'REPOSITORY_INFO_SYSTEM_F4' exporting object_type = 'FUNC'
object_name = soFname-low
suppress_selection = 'X'
use_alv_grid = ''
without_personal_list = ''
importing object_name_selected = soFName-low
exceptions cancel = 1.
at selection-screen on value-request for soFName-high.
call function 'REPOSITORY_INFO_SYSTEM_F4' exporting object_type = 'FUNC'
object_name = soFname-high
suppress_selection = 'X'
use_alv_grid = ''
without_personal_list = ''
importing object_name_selected = soFName-high
exceptions cancel = 1.
at selection-screen on value-request for soFGroup-low.
call function 'REPOSITORY_INFO_SYSTEM_F4' exporting object_type = 'FUGR'
object_name = soFGroup-low
suppress_selection = 'X'
use_alv_grid = ''
without_personal_list = ''
importing object_name_selected = soFGroup-low
exceptions cancel = 1.
at selection-screen on value-request for soFGroup-high.
call function 'REPOSITORY_INFO_SYSTEM_F4' exporting object_type = 'FUGR'
object_name = soFGroup-high
suppress_selection = 'X'
use_alv_grid = ''
without_personal_list = ''
importing object_name_selected = soFGroup-high
exceptions cancel = 1.
initialisation
initialization.
Parameter screen texts.
tBlock1 = 'Author (Optional)'.
t$tmp = 'Programs only: include local objects'.
tBlock2 = 'Objects to download'.
tBlock3 = 'Additional downloads for programs, function modules and classes'.
tBlock4 = 'Download parameters'.
tBlock5 = 'Display options'.
tAuth = 'Author name'.
tPmod = 'Include programs modified by author'.
tCust = 'Only customer objects'.
tNRange = 'Alt customer name range'.
tRtable = 'Tables / Structures'.
tPtable = 'Table name'.
tTnote = 'Note: tables are stored under the username of the last person who modified them'.
tRfunc = 'Function modules'.
tPfname = 'Function name'.
tFgroup = 'Function group'.
tRClass = 'Classes'.
tPcname = 'Class name'.
tMess = 'Message class'.
tMName = 'Class name'.
tMLang = 'Language'.
tProg = 'Programs'.
tRpname = 'Program name'.
tPack = 'Package'.
tPtxt = 'Text document'.
tPhtml = 'HTML document'.
tComm = 'Highlight comments'.
tBack = 'Include background colour'.
tPtext = 'Text elements'.
tPinc = 'Include programs'.
tRecc = 'Recursive search'.
tPpath = 'File path'.
tSPath = 'Logical file name'.
tPmes = 'Message classes'.
tPfunc = 'Function modules'.
tDoc = 'Function module documentation'.
tRecf = 'Recursive search'.
tPscr = 'Screens'.
tPdict = 'Dictionary structures'.
tSortT = 'Sort table fields alphabetically'.
tServ = 'Download to server'.
tPc = 'Download to PC'.
tRep = 'Display download report'.
tProMess = 'Display progress messages'.
Determine the frontend operating system type.
if sy-batch is initial.
perform determineFrontendOPSystem using frontendSlashSeparator frontendOpSystem.
endif.
perform determineServerOpsystem using serverSlashSeparator serverFileSystem serverOpsystem.
Determine if the external command exists. If it doesn't then disable the server input field
perform findExternalCommand.
start-of-selection.
start-of-selection.
perform checkComboBoxes.
perform fillSelectionRanges.
startTime = sy-uzeit.
Don't display status messages if we are running in the background
if not sy-batch is initial.
pProMess = ''.
endif.
Fool the HTML routines to stop them hyperlinking anything with a space in them
if pCName is initial.
customerNameSpace = '^'.
else.
customerNameSpace = pCName.
endif.
Determine which operating slash and download directory to use
case 'X'.
when pPc.
slashSeparatorToUse = frontendSlashSeparator.
downloadFolder = pFolder.
when pServ.
slashSeparatorToUse = serverSlashSeparator.
downloadFolder = serverFolder.
endcase.
Main program flow.
case 'X'.
Select tables
when rTable.
perform retrieveTables using iDictionary[]
soTableNames[]
soAuthor[].
Select message classes tables
when rMess.
perform retrieveMessageClass using iMessages[]
soAuthor[] "Author
pMname "Message class name
pMLang "Message class language
pMod. "Modified by author
Select function modules
when rFunc.
perform retrieveFunctions using soFunctionName[] "Function name
soFunctionGroup[] "Function group
iFunctions[] "Found functions
soAuthor[] "Author
pText "Get text elements
pScr "Get screens
pCust "Customer data only
customerNameSpace. "Customer name range
loop at iFunctions.
Find Dict structures, messages, functions, includes etc.
perform scanForAdditionalFuncStuff using iFunctions[]
pRecI "Search for includes recursively
pRecF "Search for functions recursively
pInc "Search for includes
pFunc "Search for functions
pDict "search for dictionary objects
pMess "Search for messages
pCust "Customer data only
customerNameSpace. "Customer name range
endloop.
Select Classes
when rClass.
perform retrieveClasses using iClasses[]
iFunctions[]
soClassName[] "Class name
soAuthor[] "Author
customerNameSpace "Customer name range
pMod "Also modified by author
pCust "Customer object only
pMess "Find messages
pText "Text Elements
pDict "Dictionary structures
pFunc "Get functions
pInc "Get includes
pRecF "Search recursively for functions
pRecI "Search recursively for includes
'X' "Search recursively for classes
pMLang. "Language
loop at iFunctions.
Find Dict structures, messages, functions, includes etc.
perform scanForAdditionalFuncStuff using iFunctions[]
pRecI "Search for includes recursively
pRecF "Search for functions recursively
pInc "Search for includes
pFunc "Search for functions
pDict "search for dictionary objects
pMess "Search for messages
pCust "Customer data only
customerNameSpace. "Customer name range
endloop.
Select programs
when rProg.
perform retrievePrograms using iPrograms[]
iFunctions[]
soProgramName[] "Program name
soAuthor[] "Author
customerNamespace "Customer name range
pMod "Also modified by author
pCust "Customer object only
pMess "Find messages
pText "Text Elements
pDict "Dictionay structures
pFunc "Get functions
pInc "Get includes
pScr "Get screens
pRecF "Search recursively for functions
pRecI "Search recursively for includes
p$Tmp "local objects
pPack. "Package
endcase.
end-of-selection
end-of-selection.
if forcedExit = 0.
Set the file extension and output type of the file
if pTxt is initial.
downloadFileExtension = HTMLEXTENSION.
else.
downloadFileExtension = TEXTEXTENSION.
endif.
Decide what to download
case 'X'.
Download tables
when rTable.
if not ( iDictionary[] is initial ).
perform downloadDDStructures using iDictionary[]
downloadFolder
HTMLEXtension
space
pSortT
slashSeparatorToUse
pServ
pProMess.
Free up any memory used for caching HTML versions of tables
loop at iDictionary.
free memory id iDictionary-tablename.
endloop.
Display donwload report
if not pRep is initial.
get time.
runTime = sy-uzeit - startTime.
perform fillTreeNodeTables using iDictionary[]
iTreeDisplay[]
runTime.
endif.
clear iDictionary[].
endif.
Download message class
when rMess.
if not ( iMessages[] is initial ).
sort iMessages ascending by arbgb msgnr.
loop at iMessages.
append iMessages to iSingleMessageClass.
at end of arbgb.
perform downloadMessageClass using iSingleMessageClass[]
iMessages-arbgb
downloadFolder
downloadFileExtension
pHtml
space
pComm
customerNameSpace
pInc
pDict
pMess
slashSeparatorToUse
pServ
pProMess.
clear iSingleMessageClass[].
endat.
endloop.
Display download report
if not pRep is initial.
get time.
runTime = sy-uzeit - startTime.
perform fillTreeNodeMessages using iMessages[]
iTreeDisplay[]
runTime.
endif.
clear iMessages[].
endif.
Download functions
when rFunc.
if not ( iFunctions[] is initial ).
perform downloadFunctions using iFunctions[]
downloadFolder
downloadFileExtension
space
pDoc
pHtml
pComm
customerNameSpace
pInc
pDict
TEXTEXTENSION
HTMLEXTENSION
pSortT
slashSeparatorToUse
pServ
pProMess.
Free up any memory used for caching HTML versions of tables
loop at iFunctions.
loop at iFunctions-iDictStruct assigning <waDictStruct>.
free memory id <waDictStruct>-tablename.
endloop.
endloop.
Display donwload report
if not pRep is initial.
get time.
runTime = sy-uzeit - startTime.
perform fillTreeNodeFunctions using iFunctions[]
iTreeDisplay[]
runTime.
endif.
clear iFunctions[].
endif.
Download Classes
when rClass.
if not ( iClasses[] is initial ).
perform downloadClasses using iClasses[]
iFunctions[]
downloadFolder
downloadFileExtension
HTMLEXTENSION
TEXTEXTENSION
pHtml
pComm
custo -
Function modules and function groups
Hi alll
Can anybody explain me abt function module and function groups...please
Thanks and Regards
vijaya<b>Function groups</b> are containers for function modules. You cannot execute a function group. When you call an function module, the system loads the whole of its function group into the internal session of the calling program (if it has not already been loaded).
The name of a function group can be up to 26 characters long. This is used by the system to create the components of the group (main program and corresponding include programs). When you create a function group or
function module in the Function Builder [Ext.] , the main program and include programs are generated automatically.
When you create a new function group, the system automatically creates a main program containing two includes. Like any other programs and includes, you can display them in the Repository Browser.
The name of the main program is assigned by the system. This is made up of the prefix SAPL followed by the function group name. For example, the main program for function group SXXX is called SAPLSXXX.
The names of the include files begin with L followed by the name of the function group, and conclude with UXX ( or TOP for the TOP include). The TOP include contains global data declarations that are used by all of the function modules in the function group. The other include file within the main program is used to hold the function modules within the group.
You cannot declare a COMMON PART in a function group. Function groups have their own table work areas (TABLES). Function groups encapsulate data.
All of the function modules in a function group can access the global data of the group. For this
reason, you should place all function modules that use the same data in a single function group.
For example, if you have a set of function modules that all use the same internal table, you could
place them in a function group containing the table definition in its global data.
Like executable programs (type 1) and module pools (type M), function groups can contain screens, selection screens, and lists. User input is processed either in dialog modules or in the corresponding event blocks in the main program of the function group. There are special include programs in which you can write this code. In this way, you can use function groups to
encapsulate single screens or screen sequences.
For function module, have a look at
http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm
I hope it helps.
Best Regards,
Vibha -
Hi....
Any body send me what are the uses of the include programs generates function groups while creating...?
And what is the Difference between those two?
And in which cases we have to go for change them?
Thank you,
Naveen Inuganti.Hi
Include Programs
Include programs are global R/3 Repository objects. They are solely for modularizing source code, and have no parameter interface.
They have the following functions:
Library: Include programs allow you to use the same source code in different programs. For example, this can be useful if you have lengthy data declarations that you want to use in different programs.
Order. Include programs allow you to manage complex programs in an orderly way. Function groups and module pools use include programs to store parts of the program that belong together. The ABAP Workbench supports you extensively when you create such complex programs by creating the include programs automatically and by assigning them unique names. A special include is the TOP include of a program. If you name it according to the naming convention, it is always included in program navigation and in the syntax check.
Creating Your Own Include Programs
If you create an include program yourself, you must assign it the type I in its program attributes. You can also create or change an include program by double-clicking on the name of the program after the INCLUDE statement in your ABAP program. If the program exists, the ABAP Workbench navigates to it. If it does not exist, the system creates it for you.
An include program cannot run independently, but must be built into other programs. Include programs can contain other includes.
The only restrictions for writing the source code of include programs are:
Include programs cannot call themselves.
Include programs must contain complete statements.
You must ensure that the statements of your include program fit logically into the source code of the programs from which it is called. Choosing Check while editing an include program in the ABAP Editor is normally not sufficient for this.
se37 funcation group used for funcation module store on sap library.
Function Groups
function group creates two includes.
include lfgidtop.
include lfgiduxx. wher fgid is function group
The first include program-lfgidtop-is known as the top include. Within it you can place global data definitions. These are data definitions that are global to all function modules within the group.
The second include program-lfgiduxx-is known as the UXX. You are not allowed to modify the UXX. The system will automatically place an include statement in the UXX for each function module you create in this function group. For the first function module, the statement include lfgidu01 will be inserted into the UXX. When you create a second function module in this group, the system will add a second statement: include lfgidu02.
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 (if it has not already been loaded). For further information, refer to Organization of External Procedure Calls.
The following diagram shows the structure of a function group: The name of a function group, fgrpcan be up to 26 characters long. This is used by the system to create the components of the group (main program and corresponding include programs). When you create a function group or function module in the Function Builder , the main program and include programs are generated automatically.
The main program SAPLfgrp contains nothing but the INCLUDE statements for the following include programs:
In SAP, it is a function group - instead of function - that is loaded into active memory.
Function ( or function module ) is the one that you call from the program to do things.
A function group contains functionally related function modules, global variables and procedures .
To display / edit function module you use SE37,
To display / edit function group you use SE80 .
Reward If Helpfull,
Naresh.
Maybe you are looking for
-
I face a problem while making a confirmation on portal.
Hello , Can anyone help me I am facing a problem while making confirmation in the portal. the system pops up an error as mentioned below. Please help Folgender Fehlertext wurde im System SRP prozessiert: Speicherungsform der Produkt-ID ist im C
-
Scheduled webi report error in dashboard
Hi , we are using SAP BW as backend and Dashboard is created using Live ofive connectivity with latest instance of scheduled report which is scheduled every morning. But some of the reports scheduled is failing and throwing this error as A database e
-
All apps/programs are current OS 03/2015 I imported an Excel spreadsheet to Numbers and lost the the formulas. The spreadsheet is a basic invoice - using dollar amounts: $ SUBTOTAL+ PERCENTAGE = $ TOTAL However, this is what I keep coming up with:
-
I have a HP Pavilion 6000 series, actual model number dv6928us which came with a 250GB Serial ATA 9.5mm, 2.5in hard drive. Can I use the 320GB unit I found on line which has the same specs but has the larger capacity? Thank you for your help
-
Hi, I need to watch a table (ex: TABLE_1) every hour and the tables has 100 columns I created another table (ex: TABLE_2) with the same columns plus an extra column name: SYSDATE I am planning on insert data from the TABLE_1 to TABLE_2 every hour usi