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: 

How to copy Function Group or FM???

Former Member
0 Kudos

Hi,

I hav to copy all the function module present in a function group from one system to another. In short I hav to create a function group with all its FM in another system. Is there any standard utility with which i can download the complete Function group or FM and upload it to another sytem.

Here transporting the request from one system to another is not possible.

So how it can be done.

Plz help.

Thanks and Regards,

Rahul

13 REPLIES 13

Former Member
0 Kudos

Hi Rahul,

go to se80 give your fngroup name and now press enter it will show all the things in that.

go to fn group name below right click there copy option you will get. give the fn group to your zfngrp in the popup.

Look at this thread

Regards,

Priyanka.

0 Kudos

Hi Priyanka,

I hav to copy Function group to another system, not on the same system.

Also i cant transport the request to another system. Hence i hav to find out a way to first download it and then upload it on another system.

Thanks and Regards,

Rahul.

Message was edited by:

Rahul Ghag

0 Kudos

Hi Rahul,

A FM is also has a ABAP name attached to it usually starting with SAPL*. But usually the code is all in the INCLUDE ABAPs.

So for FM, you need to get the module name ie SAPL<funcgroup>.

find all the includes L<funcgroup>.

read report <include> into t.

download t.

Check this link:

check the program:

SAPBC405_OTH_DOWNLOAD_SOURCE iif you are on 4.7 or above.

Regards,

Priyanka.

0 Kudos

Hi Priyanka,

Plz, can u explain me with a short example.

Consider i hav to download all the FM along with its parameters and tables, etc.

of Function group "SAPLFCJ_BALANCE".

Also after downloading how to upload it.

So how it can be done.

Thanks and regards,

Rahul

0 Kudos
run this program...

*&---------------------------------------------------------------------*
*& Report  Z_DOWNLOAD_FM_DATA                                          *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  z_download_fm_data                      .

*----------------------------------------------------------------------*
* Tables
*----------------------------------------------------------------------*

*----------------------------------------------------------------------*
* TYPES - Structures
*----------------------------------------------------------------------*
* Structure for Function Module Attributes
TYPES: BEGIN OF s_fm_attributes         ,
        global_flag   LIKE rs38l-global ,
        remote_call   LIKE rs38l-remote ,
        update_task   LIKE rs38l-utask  ,
        short_text    LIKE tftit-stext  ,
        function_pool LIKE rs38l-area   ,
       END   OF s_fm_attributes         .

* Structure for Import Paramters
TYPES: BEGIN OF s_import_parameter .
        INCLUDE STRUCTURE rsimp    .
TYPES: END   OF s_import_parameter .

* Structure for Changing Paramters
TYPES: BEGIN OF s_changing_parameter .
        INCLUDE STRUCTURE rscha      .
TYPES: END   OF s_changing_parameter .

* Structure for Export Paramters
TYPES: BEGIN OF s_export_parameter  .
        INCLUDE STRUCTURE rsexp     .
TYPES: END   OF s_export_parameter  .

* Structure for Table Paramters
TYPES: BEGIN OF s_tables_parameter .
        INCLUDE STRUCTURE rstbl    .
TYPES: END   OF s_tables_parameter .

* Structure for Exception list
TYPES: BEGIN OF s_exception_list  .
        INCLUDE STRUCTURE rsexc.
TYPES: END   OF s_exception_list .

* Structure for Documentation
TYPES: BEGIN OF s_documentation  .
        INCLUDE STRUCTURE rsfdo.
TYPES: END   OF s_documentation .

* Structure for Exception list
TYPES: BEGIN OF s_source           .
        INCLUDE STRUCTURE rssource .
TYPES: END   OF s_source           .


*----------------------------------------------------------------------*
* Internal Tables
*----------------------------------------------------------------------*
DATA:  t_fm_attributes      TYPE s_fm_attributes       OCCURS 0
                            WITH HEADER LINE                     ,
       t_import_parameter   TYPE s_import_parameter    OCCURS 0
                            WITH HEADER LINE                     ,
       t_changing_parameter TYPE s_changing_parameter  OCCURS 0
                            WITH HEADER LINE                     ,
       t_export_parameter   TYPE s_export_parameter    OCCURS 0
                            WITH HEADER LINE                     ,
       t_tables_parameter   TYPE s_tables_parameter    OCCURS 0
                            WITH HEADER LINE                     ,
       t_exception_list     TYPE s_exception_list      OCCURS 0
                            WITH HEADER LINE                     ,
       t_documentation      TYPE s_documentation       OCCURS 0
                            WITH HEADER LINE                     ,
       t_source             TYPE s_source              OCCURS 0
                            WITH HEADER LINE                     .

*----------------------------------------------------------------------*
* Constants
*----------------------------------------------------------------------*
CONSTANTS: c_dir(6)        TYPE c  VALUE 'C:FM'         ,
           c_bslash(1)     TYPE c  VALUE ''              ,
           c_file_attrib   TYPE string        " FM Attributes file
                            VALUE 'FM_ATTRIBUTES.XLS' ,
           c_file_ip       TYPE string        " Import parameters File
                            VALUE 'IMPORT_PARAMTER.XLS' ,
           c_file_cp       TYPE string        " Changing parameters File
                            VALUE 'CHANGING_PARAMTER.XLS' ,
           c_file_ep       TYPE string         " Export parameters File
                            VALUE 'EXPORT_PARAMTER.XLS'   ,
           c_file_tp       TYPE string         " Tables parameters File
                            VALUE 'TABLES_PARAMTER.XLS'   ,
           c_file_el       TYPE string         " Exception list File
                            VALUE 'EXCEPTION_LIST.XLS'    ,
           c_file_docu     TYPE string         " Documentation File
                            VALUE 'DOCUMENTATION.XLS'     ,
           c_file_source   TYPE string         " Code Source File
                            VALUE 'SOURCE.XLS'            .


*----------------------------------------------------------------------*
* Work-fields
*----------------------------------------------------------------------*
DATA: w_functionname  LIKE rs38l-name       ,      " FM Name
      w_file          TYPE string           ,      " File name
      w_global_flag   LIKE rs38l-global     ,
      w_remote_call   LIKE rs38l-remote     ,
      w_update_task   LIKE rs38l-utask      ,
      w_short_text    LIKE tftit-stext      ,
      w_function_pool LIKE rs38l-area       .

*----------------------------------------------------------------------*
* Selection-Screen
*----------------------------------------------------------------------*
SELECT-OPTIONS: s_fm FOR w_functionname OBLIGATORY NO INTERVALS.

*----------------------------------------------------------------------*
* At selection-screen
*----------------------------------------------------------------------*


*----------------------------------------------------------------------*
* Start-of-selection
*----------------------------------------------------------------------*
START-OF-SELECTION.
* Download Function Modules.
  PERFORM sub_download_fm_data.

*----------------------------------------------------------------------*
* End-of-selection
*----------------------------------------------------------------------*
END-OF-SELECTION.


*----------------------------------------------------------------------*
* Subroutines
*----------------------------------------------------------------------

*&---------------------------------------------------------------------*
*&      Form  sub_download_fm_data
*&---------------------------------------------------------------------*
*       Download Function Module data
*----------------------------------------------------------------------*
FORM sub_download_fm_data .

  LOOP AT s_fm.

    REFRESH: t_fm_attributes       ,
             t_import_parameter    ,
             t_changing_parameter  ,
             t_export_parameter    ,
             t_tables_parameter    ,
             t_exception_list      ,
             t_documentation       ,
             t_source              .

    CLEAR: w_functionname   ,
           w_global_flag    ,
           w_remote_call    ,
           w_update_task    ,
           w_short_text     ,
           w_function_pool  .

    MOVE s_fm-low TO w_functionname.

*   Get Function Module data
    CALL FUNCTION 'ZRPY_FUNCTIONMODULE_READ'
      EXPORTING
        functionname       = w_functionname
      IMPORTING
        global_flag        = w_global_flag
        remote_call        = w_remote_call
        update_task        = w_update_task
        short_text         = w_short_text
        function_pool      = w_function_pool
      TABLES
        import_parameter   = t_import_parameter
        changing_parameter = t_changing_parameter
        export_parameter   = t_export_parameter
        tables_parameter   = t_tables_parameter
        exception_list     = t_exception_list
        documentation      = t_documentation
        SOURCE             = t_source
      EXCEPTIONS
        error_message      = 1
        function_not_found = 2
        invalid_name       = 3
        OTHERS             = 4.
    IF sy-subrc NE 0.
      WRITE: / 'Error in Function Module:' ,
               w_functionname              .
      CONTINUE.
    else.
      WRITE: / 'Downloaded Function Module:' ,
               w_functionname              .
    ENDIF.                  " IF sy-subrc NE 0.

*   Download Function Module attributes
    CLEAR t_fm_attributes.
    MOVE: w_global_flag    TO t_fm_attributes-global_flag    ,
          w_remote_call    TO t_fm_attributes-remote_call    ,
          w_update_task    TO t_fm_attributes-update_task    ,
          w_short_text     TO t_fm_attributes-short_text     ,
          w_function_pool  TO t_fm_attributes-function_pool  .
    APPEND t_fm_attributes.

*   Download FUNCTION MODULE Attributes
    CLEAR w_file.
    CONCATENATE c_dir
                w_functionname
                c_bslash
                c_file_attrib
           INTO w_file.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                = w_file
        filetype                = 'ASC'
        append                  = ' '
        write_field_separator   = 'X'
      TABLES
        data_tab                = t_fm_attributes
      EXCEPTIONS
        file_write_error        = 1
        no_batch                = 2
        gui_refuse_filetransfer = 3
        invalid_type            = 4
        no_authority            = 5
        unknown_error           = 6
        header_not_allowed      = 7
        separator_not_allowed   = 8
        filesize_not_allowed    = 9
        header_too_long         = 10
        dp_error_create         = 11
        dp_error_send           = 12
        dp_error_write          = 13
        unknown_dp_error        = 14
        access_denied           = 15
        dp_out_of_memory        = 16
        disk_full               = 17
        dp_timeout              = 18
        file_not_found          = 19
        dataprovider_exception  = 20
        control_flush_error     = 21
        OTHERS                  = 22.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

*   Download IMPORT Parameters
    CLEAR w_file.
    CONCATENATE c_dir
                w_functionname
                c_bslash
                c_file_ip
           INTO w_file.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                = w_file
        filetype                = 'ASC'
        append                  = ' '
        write_field_separator   = 'X'
      TABLES
        data_tab                = t_import_parameter
      EXCEPTIONS
        file_write_error        = 1
        no_batch                = 2
        gui_refuse_filetransfer = 3
        invalid_type            = 4
        no_authority            = 5
        unknown_error           = 6
        header_not_allowed      = 7
        separator_not_allowed   = 8
        filesize_not_allowed    = 9
        header_too_long         = 10
        dp_error_create         = 11
        dp_error_send           = 12
        dp_error_write          = 13
        unknown_dp_error        = 14
        access_denied           = 15
        dp_out_of_memory        = 16
        disk_full               = 17
        dp_timeout              = 18
        file_not_found          = 19
        dataprovider_exception  = 20
        control_flush_error     = 21
        OTHERS                  = 22.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

*   Download CHANGING Parameters
    CLEAR w_file.
    CONCATENATE c_dir
                w_functionname
                c_bslash
                c_file_cp
           INTO w_file.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                = w_file
        filetype                = 'ASC'
        append                  = ' '
        write_field_separator   = 'X'
      TABLES
        data_tab                = t_changing_parameter
      EXCEPTIONS
        file_write_error        = 1
        no_batch                = 2
        gui_refuse_filetransfer = 3
        invalid_type            = 4
        no_authority            = 5
        unknown_error           = 6
        header_not_allowed      = 7
        separator_not_allowed   = 8
        filesize_not_allowed    = 9
        header_too_long         = 10
        dp_error_create         = 11
        dp_error_send           = 12
        dp_error_write          = 13
        unknown_dp_error        = 14
        access_denied           = 15
        dp_out_of_memory        = 16
        disk_full               = 17
        dp_timeout              = 18
        file_not_found          = 19
        dataprovider_exception  = 20
        control_flush_error     = 21
        OTHERS                  = 22.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

* Download EXPORT Parameters
    CLEAR w_file.
    CONCATENATE c_dir
                w_functionname
                c_bslash
                c_file_ep
           INTO w_file.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                = w_file
        filetype                = 'ASC'
        append                  = ' '
        write_field_separator   = 'X'
      TABLES
        data_tab                = t_export_parameter
      EXCEPTIONS
        file_write_error        = 1
        no_batch                = 2
        gui_refuse_filetransfer = 3
        invalid_type            = 4
        no_authority            = 5
        unknown_error           = 6
        header_not_allowed      = 7
        separator_not_allowed   = 8
        filesize_not_allowed    = 9
        header_too_long         = 10
        dp_error_create         = 11
        dp_error_send           = 12
        dp_error_write          = 13
        unknown_dp_error        = 14
        access_denied           = 15
        dp_out_of_memory        = 16
        disk_full               = 17
        dp_timeout              = 18
        file_not_found          = 19
        dataprovider_exception  = 20
        control_flush_error     = 21
        OTHERS                  = 22.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

*   Download TABLES Parameters
    CLEAR w_file.
    CONCATENATE c_dir
                w_functionname
                c_bslash
                c_file_tp
           INTO w_file.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                = w_file
        filetype                = 'ASC'
        append                  = ' '
        write_field_separator   = 'X'
      TABLES
        data_tab                = t_tables_parameter
      EXCEPTIONS
        file_write_error        = 1
        no_batch                = 2
        gui_refuse_filetransfer = 3
        invalid_type            = 4
        no_authority            = 5
        unknown_error           = 6
        header_not_allowed      = 7
        separator_not_allowed   = 8
        filesize_not_allowed    = 9
        header_too_long         = 10
        dp_error_create         = 11
        dp_error_send           = 12
        dp_error_write          = 13
        unknown_dp_error        = 14
        access_denied           = 15
        dp_out_of_memory        = 16
        disk_full               = 17
        dp_timeout              = 18
        file_not_found          = 19
        dataprovider_exception  = 20
        control_flush_error     = 21
        OTHERS                  = 22.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

*   Download EXCEPTIONS List
    CLEAR w_file.
    CONCATENATE c_dir
                w_functionname
                c_bslash
                c_file_el
           INTO w_file.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                = w_file
        filetype                = 'ASC'
        append                  = ' '
        write_field_separator   = 'X'
      TABLES
        data_tab                = t_exception_list
      EXCEPTIONS
        file_write_error        = 1
        no_batch                = 2
        gui_refuse_filetransfer = 3
        invalid_type            = 4
        no_authority            = 5
        unknown_error           = 6
        header_not_allowed      = 7
        separator_not_allowed   = 8
        filesize_not_allowed    = 9
        header_too_long         = 10
        dp_error_create         = 11
        dp_error_send           = 12
        dp_error_write          = 13
        unknown_dp_error        = 14
        access_denied           = 15
        dp_out_of_memory        = 16
        disk_full               = 17
        dp_timeout              = 18
        file_not_found          = 19
        dataprovider_exception  = 20
        control_flush_error     = 21
        OTHERS                  = 22.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

*   Download DOCUMENTATION
    CLEAR w_file.
    CONCATENATE c_dir
                w_functionname
                c_bslash
                c_file_docu
           INTO w_file.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                = w_file
        filetype                = 'ASC'
        append                  = ' '
        write_field_separator   = 'X'
      TABLES
        data_tab                = t_documentation
      EXCEPTIONS
        file_write_error        = 1
        no_batch                = 2
        gui_refuse_filetransfer = 3
        invalid_type            = 4
        no_authority            = 5
        unknown_error           = 6
        header_not_allowed      = 7
        separator_not_allowed   = 8
        filesize_not_allowed    = 9
        header_too_long         = 10
        dp_error_create         = 11
        dp_error_send           = 12
        dp_error_write          = 13
        unknown_dp_error        = 14
        access_denied           = 15
        dp_out_of_memory        = 16
        disk_full               = 17
        dp_timeout              = 18
        file_not_found          = 19
        dataprovider_exception  = 20
        control_flush_error     = 21
        OTHERS                  = 22.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

*   Download SOURCE Code
    CLEAR w_file.
    CONCATENATE c_dir
                w_functionname
                c_bslash
                c_file_source
           INTO w_file.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                = w_file
        filetype                = 'ASC'
        append                  = ' '
        write_field_separator   = 'X'
      TABLES
        data_tab                = t_source
      EXCEPTIONS
        file_write_error        = 1
        no_batch                = 2
        gui_refuse_filetransfer = 3
        invalid_type            = 4
        no_authority            = 5
        unknown_error           = 6
        header_not_allowed      = 7
        separator_not_allowed   = 8
        filesize_not_allowed    = 9
        header_too_long         = 10
        dp_error_create         = 11
        dp_error_send           = 12
        dp_error_write          = 13
        unknown_dp_error        = 14
        access_denied           = 15
        dp_out_of_memory        = 16
        disk_full               = 17
        dp_timeout              = 18
        file_not_found          = 19
        dataprovider_exception  = 20
        control_flush_error     = 21
        OTHERS                  = 22.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

  ENDLOOP.                  " LOOP AT s_fm.

ENDFORM.                    " sub_download_fm_data
*

0 Kudos

Hi Kishan,

The code is giving dump.

IT requires FM "ZRPY_FUNCTIONMODULE_READ."

Pls send me the code of tat FM.

Also after downloading how to upload FM.

Thanks a lot for the code.

Regards,

Rahul

Former Member
0 Kudos

U can download each every FM seperately not as a whole.

0 Kudos

Hi,

But when we download it only sorce code is downloaded and the remaining input/output parameters, tables ,etc. are not downloaded. hence we cant upload it.

Thanks and Regards,

Rahul

0 Kudos

Hi,

U choose the different tabs in the FM and choose download, so taht u can download the code, parameters seperately.

Try this.

0 Kudos

Hi Judith,

I hav tried downloading different tabs but its not working. i.e. I cant download other tabs except source code.

Thanks and Regards

Rahul

0 Kudos

Then u need to create parameters on ur own.

Former Member
0 Kudos

Hi,

Execute the Transacatiion SE80 and give the FM group name which u wanted to copy.

After displaying the Function group and just right click ,

then you will get option for copy the Function group.

Regards

Nagaraju

0 Kudos

Hi Nagaraju,

I hav to copy Function group to another system, not on the same system.

Also i cant transport the request to another system. Hence i hav to find out a way to first download it and then upload it on another system.

Thanks and Regards,

Rahul.