Application Development and Automation 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: 
Read only

Reading Source code from different system

Former Member
0 Likes
2,148

Hi All,

Using the syntax READ REPORT , I can read the source code of a report into an internal table (in same system).

However what if I need to read the source code of System B from System A.

Are there any RFC which we can use to read the source code of a report in two different systems which are connected.

Thanks,

Faiz

1 ACCEPTED SOLUTION
Read only

rosenberg_eitan
Active Contributor
0 Likes
1,570

Hi,

Try

FUNCTION 'RPY_PROGRAM_READ'

Regards.


TYPES: tp_include_tab TYPE TABLE OF rpy_repo .

TYPES: tp_source_extended_tab TYPE TABLE OF abaptxt255  .

*----------------------------------------------------------------------*

FORM do_rpy_program_read

  USING

    program TYPE program

    rfcdest TYPE rfcdest

  CHANGING

    it_include         TYPE tp_include_tab

    it_source_extended TYPE tp_source_extended_tab .



  CALL FUNCTION 'RPY_PROGRAM_READ' DESTINATION rfcdest

    EXPORTING

      language                  = 'E'

      program_name              = program

      with_includelist          = 'X'

*     ONLY_SOURCE               = ' '

*     ONLY_TEXTS                = ' '

      read_latest_version       = 'X'

*     WITH_LOWERCASE            = ' '

*   IMPORTING

*     PROG_INF                  =

    TABLES

      include_tab               = it_include

*     SOURCE                    = it_source

      source_extended           = it_source_extended

*     TEXTELEMENTS              =

    EXCEPTIONS

      cancelled                 = 1

      not_found                 = 2

      permission_error          = 3

      OTHERS                    = 4

            .

  IF sy-subrc NE 0.

*    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

*            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  ENDIF.



ENDFORM .                    "do_rpy_program_read

*----------------------------------------------------------------------*

3 REPLIES 3
Read only

sivaganesh_krishnan
Contributor
0 Likes
1,570

HI faizur,

you can use the Tcode SE39 to see the codes of different server.Usually this tcode is used to compare the source code of different system.

Or you can use Program RS_WB_SPLIT_EDITOR.

Regards,

Sivaganesh

Read only

rosenberg_eitan
Active Contributor
0 Likes
1,571

Hi,

Try

FUNCTION 'RPY_PROGRAM_READ'

Regards.


TYPES: tp_include_tab TYPE TABLE OF rpy_repo .

TYPES: tp_source_extended_tab TYPE TABLE OF abaptxt255  .

*----------------------------------------------------------------------*

FORM do_rpy_program_read

  USING

    program TYPE program

    rfcdest TYPE rfcdest

  CHANGING

    it_include         TYPE tp_include_tab

    it_source_extended TYPE tp_source_extended_tab .



  CALL FUNCTION 'RPY_PROGRAM_READ' DESTINATION rfcdest

    EXPORTING

      language                  = 'E'

      program_name              = program

      with_includelist          = 'X'

*     ONLY_SOURCE               = ' '

*     ONLY_TEXTS                = ' '

      read_latest_version       = 'X'

*     WITH_LOWERCASE            = ' '

*   IMPORTING

*     PROG_INF                  =

    TABLES

      include_tab               = it_include

*     SOURCE                    = it_source

      source_extended           = it_source_extended

*     TEXTELEMENTS              =

    EXCEPTIONS

      cancelled                 = 1

      not_found                 = 2

      permission_error          = 3

      OTHERS                    = 4

            .

  IF sy-subrc NE 0.

*    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

*            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  ENDIF.



ENDFORM .                    "do_rpy_program_read

*----------------------------------------------------------------------*

Read only

former_member214915
Participant
0 Likes
1,570

Faizurrehman,

              Yes RFC is required to get data.Better way is to create the Function Module as RFC and than write all code of report in Function module and take the output in tables parameter . If you want data from system B so you have to create Function Module on system B and than create your report program on system A and use following syntax to call RFC FM

    

    "lv_rfc: Name of RFC FM that is on system A

    "lv_destination:RFC destination which has been created through SM59 for system B


    CALL FUNCTION lv_rfc_name DESTINATION lv_destination
      EXPORTING
        e_field                = e_field
      IMPORTING
        return                = return
      TABLES
        data                  = data
      EXCEPTIONS
        system_failure        = 1000  MESSAGE lv_exc_msg
        communication_failure = 1001  MESSAGE lv_exc_msg
        OTHERS                = 1002.


Hope this will help.


thanks & Regards,

Muhammad Shahezad