Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Function module - source code.

Former Member
0 Kudos

Hi,

I would like to know is there any system table available, where the source code of a function module is stored? I have a requirement like I want to insert code into the function module through code without going to the transaction se37.

Thanks in advance,

Hema

7 REPLIES 7

Former Member
0 Kudos

Hi Hema,

I don't think there is any table which store the code of FM.

Rgds,

Prakashsingh

former_member186741
Active Contributor

this sounds highly risky but I guess you could do it with the 'insert report' statement. Check out the help which is quite detailed.

vinod_gunaware2
Active Contributor
0 Kudos

Hi

I dont think such table is available.

Name

Description

DBCON

Description of database connections (including password)

DD02V

Date dictionary tables

DD03L

Date dictionary tables and fields

DD07T

Texts for Domain Fixed Values

TRDIR

Table of programs

TRMAC

Table of macros

TSTC

Table of transaction codes

TADIR

Directory of R/3 repository objects

TFACD

Factory calender definition

THOCI

Public holiday calendar index

TPARA

Table of PID's

regards

vinod

Former Member

Hi,

You can try using 'READ REPORT' to read the code of the function module.

Also, Check out the program 'RPR_ABAP_SOURCE_SCAN'.

and the FM: 'SCWB_GET_ABAP_CODE_OF_OBJECT'

Regards,

Anjali

Former Member

Hi Hema,

1. REPOSRC

2. This is the table where all source codes,

whether module pool, se38 program, include,

Function module (fM also have associated

program+includes)

3. But we cannot directly edit this table.

(System will give error message that

This table cannot be used for insert/modify)

4. u can however use

READ REPORT

command (see F1 help on it)

regards,

amit m.

Former Member
0 Kudos

HI

GOOD

I DONT THINK THERE IS ANY TABLE WHICH STORE THE SOURCE CODE OF A FUNCTION MODULE.

DO LIKE THIS

1-CONVERT THAT FUNCTION MODULE TO Z* FUNCTION MODULE

2-FIND OUT THE CODE POSITION WHERE YOU WANT TO ADD THE CODE.

THANKS

MRUTYUN

Former Member
0 Kudos

Hi Hema,

There is a Function Module that satisfies your requirement. When the program executes this FM, a new FM is created, with the specified Import,export,changing,tables section. You can also insert source code into the newly created FM.

The Function Module is <b>RS_FUNCTIONMODULE_INSERT</b>.

Just have a look at the code..

Suppose I want to create a FM with an import parameter(type I) and an export parameter( type I) and I want to insert some code into this FM, just execute this code.

REPORT ZSHAIL_1.

data: rtab type table of rssource with header line.

data: imptab type table of rsimp with header line.

data: exptab type table of rsexp with header line.

imptab-parameter = 'IMP_PARAM'.

imptab-typ = 'I'.

append imptab.

exptab-parameter = 'EXP-PARAM'.

exptab-typ = 'I'.

append exptab.

rtab-line = 'Insert your code for the Function Module here'.

append rtab.

CALL FUNCTION 'RS_FUNCTIONMODULE_INSERT'

EXPORTING

funcname = 'ZSP_FMNAME1'

function_pool = 'ZKUN_FUNGRP'

  • INTERFACE_GLOBAL = ' '

  • REMOTE_CALL = ' '

short_text = 'short description'

  • SUPPRESS_CORR_CHECK = 'X'

  • UPDATE_TASK = ' '

  • CORRNUM = ' '

  • NAMESPACE = ' '

  • SUPPRESS_LANGUAGE_CHECK = 'X'

  • AUTHORITY_CHECK = 'X'

  • SAVE_ACTIVE = 'X'

  • NEW_SOURCE =

  • EXCEPTION_CLASS = ' '

  • SUPPRESS_UPGRADE_CHECK = ' '

  • IMPORTING

  • FUNCTION_INCLUDE =

  • CORRNUM_E =

TABLES

IMPORT_PARAMETER = imptab[]

EXPORT_PARAMETER = exptab[]

  • TABLES_PARAMETER =

  • CHANGING_PARAMETER =

  • EXCEPTION_LIST =

  • PARAMETER_DOCU =

SOURCE = rtab[]

EXCEPTIONS

DOUBLE_TASK = 1

ERROR_MESSAGE = 2

FUNCTION_ALREADY_EXISTS = 3

INVALID_FUNCTION_POOL = 4

INVALID_NAME = 5

TOO_MANY_FUNCTIONS = 6

NO_MODIFY_PERMISSION = 7

NO_SHOW_PERMISSION = 8

ENQUEUE_SYSTEM_FAILURE = 9

CANCELED_IN_CORR = 10

OTHERS = 11

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Hope your query is solved.

<b>Hema,

If your query is solved , please close the thread.

</b>

Regards,

SP.

Message was edited by: Sylendra Prasad